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