1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.student.datadictionary.dto;
17
18 import java.io.Serializable;
19 import java.util.ArrayList;
20 import java.util.Collections;
21 import java.util.List;
22 import javax.xml.bind.annotation.XmlAccessType;
23 import javax.xml.bind.annotation.XmlAccessorType;
24 import javax.xml.bind.annotation.XmlElement;
25 import org.kuali.student.datadictionary.infc.AttributeDefinitionInfc;
26 import org.kuali.student.datadictionary.infc.DictionaryEntryInfc;
27
28
29 @XmlAccessorType(XmlAccessType.NONE)
30 public class DictionaryEntryInfo implements DictionaryEntryInfc, Serializable {
31
32 private static final long serialVersionUID = 1L;
33 @XmlElement
34 private String objectClass;
35 @XmlElement
36 private String name;
37 @XmlElement
38 private String objectLabel;
39 @XmlElement
40 private String objectDescription;
41 @XmlElement
42 private String titleAttribute;
43 @XmlElement
44 private List<String> primaryKeys;
45 @XmlElement
46 private List<AttributeDefinitionInfo> attributes;
47
48 public DictionaryEntryInfo() {
49 this.objectClass = null;
50 this.name = null;
51 this.objectLabel = null;
52 this.objectDescription = null;
53 this.titleAttribute = null;
54 this.primaryKeys = null;
55 this.attributes = null;
56 }
57
58 private DictionaryEntryInfo(DictionaryEntryInfc infc) {
59 this.objectClass = infc.getObjectClass();
60 this.name = infc.getName();
61 this.objectLabel = infc.getObjectLabel();
62 this.objectDescription = infc.getObjectDescription();
63 this.titleAttribute = infc.getTitleAttribute();
64 if (infc.getPrimaryKeys() != null) {
65 this.primaryKeys = Collections.unmodifiableList(infc.getPrimaryKeys());
66 }
67 if (infc.getAttributes() != null) {
68 List<AttributeDefinitionInfo> list = new ArrayList(infc.getAttributes().size());
69 for (AttributeDefinitionInfc ad : infc.getAttributes()) {
70 list.add(new AttributeDefinitionInfo.Builder(ad).build());
71 }
72 this.attributes = Collections.unmodifiableList(list);
73 }
74 }
75
76 @Override
77 public String getObjectClass() {
78 return objectClass;
79 }
80
81 @Override
82 public String getName() {
83 return name;
84 }
85
86 @Override
87 public String getObjectLabel() {
88 return objectLabel;
89 }
90
91 @Override
92 public String getObjectDescription() {
93 return objectDescription;
94 }
95
96 @Override
97 public String getTitleAttribute() {
98 return titleAttribute;
99 }
100
101 @Override
102 public List<String> getPrimaryKeys() {
103 return primaryKeys;
104 }
105
106 @Override
107 public List<AttributeDefinitionInfo> getAttributes() {
108 return attributes;
109 }
110
111 public static class Builder implements DictionaryEntryInfc {
112
113 private String objectClass;
114 private String name;
115 private String objectLabel;
116 private String objectDescription;
117 private String titleAttribute;
118 private List<String> primaryKeys;
119 private List<AttributeDefinitionInfo> attributes;
120
121 public Builder() {
122 }
123
124 public Builder(DictionaryEntryInfc infc) {
125 this.objectClass = infc.getObjectClass();
126 this.name = infc.getName();
127 this.objectLabel = infc.getObjectLabel();
128 this.objectDescription = infc.getObjectDescription();
129 this.titleAttribute = infc.getTitleAttribute();
130 this.primaryKeys = new ArrayList(infc.getPrimaryKeys());
131 this.attributes = new ArrayList(infc.getAttributes());
132 }
133
134 public DictionaryEntryInfo build() {
135 return new DictionaryEntryInfo(this);
136 }
137
138 @Override
139 public List<AttributeDefinitionInfo> getAttributes() {
140 return attributes;
141 }
142
143 public Builder setAttributes(List<AttributeDefinitionInfo> attributes) {
144 this.attributes = attributes;
145 return this;
146 }
147
148 @Override
149 public String getName() {
150 return name;
151 }
152
153 public Builder setName(String name) {
154 this.name = name;
155 return this;
156 }
157
158 @Override
159 public String getObjectClass() {
160 return objectClass;
161 }
162
163 public Builder setObjectClass(String objectClass) {
164 this.objectClass = objectClass;
165 return this;
166 }
167
168 @Override
169 public String getObjectDescription() {
170 return objectDescription;
171 }
172
173 public Builder setObjectDescription(String objectDescription) {
174 this.objectDescription = objectDescription;
175 return this;
176 }
177
178 @Override
179 public String getObjectLabel() {
180 return objectLabel;
181 }
182
183 public Builder setObjectLabel(String objectLabel) {
184 this.objectLabel = objectLabel;
185 return this;
186 }
187
188 @Override
189 public List<String> getPrimaryKeys() {
190 return primaryKeys;
191 }
192
193 public Builder setPrimaryKeys(List<String> primaryKeys) {
194 this.primaryKeys = primaryKeys;
195 return this;
196 }
197
198 @Override
199 public String getTitleAttribute() {
200 return titleAttribute;
201 }
202
203 public Builder setTitleAttribute(String titleAttribute) {
204 this.titleAttribute = titleAttribute;
205 return this;
206 }
207 }
208 }