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 | 0 | public DictionaryEntryInfo() { |
63 | 0 | } |
64 | |
|
65 | |
|
66 | |
|
67 | |
|
68 | |
|
69 | |
|
70 | 0 | public DictionaryEntryInfo(DictionaryEntry entry) { |
71 | 0 | if (entry != null) { |
72 | 0 | this.objectClass = entry.getObjectClass(); |
73 | 0 | this.name = entry.getName(); |
74 | 0 | this.objectLabel = entry.getObjectLabel(); |
75 | 0 | this.objectDescription = entry.getObjectDescription(); |
76 | 0 | this.titleAttribute = entry.getTitleAttribute(); |
77 | 0 | if (entry.getPrimaryKeys() != null) { |
78 | 0 | this.primaryKeys = Collections.unmodifiableList(entry.getPrimaryKeys()); |
79 | |
} |
80 | 0 | if (entry.getAttributes() != null) { |
81 | 0 | List<AttributeDefinitionInfo> list = new ArrayList(entry.getAttributes().size()); |
82 | 0 | for (AttributeDefinitionInfc ad : entry.getAttributes()) { |
83 | 0 | list.add(new AttributeDefinitionInfo.Builder(ad).build()); |
84 | |
} |
85 | 0 | this.attributes = Collections.unmodifiableList(list); |
86 | |
} |
87 | |
} |
88 | 0 | } |
89 | |
|
90 | |
@Override |
91 | |
public String getObjectClass() { |
92 | 0 | return objectClass; |
93 | |
} |
94 | |
|
95 | |
@Override |
96 | |
public String getName() { |
97 | 0 | return name; |
98 | |
} |
99 | |
|
100 | |
@Override |
101 | |
public String getObjectLabel() { |
102 | 0 | return objectLabel; |
103 | |
} |
104 | |
|
105 | |
@Override |
106 | |
public String getObjectDescription() { |
107 | 0 | return objectDescription; |
108 | |
} |
109 | |
|
110 | |
@Override |
111 | |
public String getTitleAttribute() { |
112 | 0 | return titleAttribute; |
113 | |
} |
114 | |
|
115 | |
@Override |
116 | |
public List<String> getPrimaryKeys() { |
117 | 0 | return primaryKeys; |
118 | |
} |
119 | |
|
120 | |
@Override |
121 | |
public List<AttributeDefinitionInfo> getAttributes() { |
122 | 0 | 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 | 0 | public Builder() { |
136 | 0 | } |
137 | |
|
138 | 0 | public Builder(DictionaryEntry entry) { |
139 | 0 | this.objectClass = entry.getObjectClass(); |
140 | 0 | this.name = entry.getName(); |
141 | 0 | this.objectLabel = entry.getObjectLabel(); |
142 | 0 | this.objectDescription = entry.getObjectDescription(); |
143 | 0 | this.titleAttribute = entry.getTitleAttribute(); |
144 | 0 | this.primaryKeys = new ArrayList(entry.getPrimaryKeys()); |
145 | 0 | this.attributes = new ArrayList(entry.getAttributes()); |
146 | 0 | } |
147 | |
|
148 | |
public DictionaryEntryInfo build() { |
149 | 0 | return new DictionaryEntryInfo(this); |
150 | |
} |
151 | |
|
152 | |
@Override |
153 | |
public List<AttributeDefinitionInfo> getAttributes() { |
154 | 0 | return attributes; |
155 | |
} |
156 | |
|
157 | |
public Builder setAttributes(List<AttributeDefinitionInfo> attributes) { |
158 | 0 | this.attributes = attributes; |
159 | 0 | return this; |
160 | |
} |
161 | |
|
162 | |
@Override |
163 | |
public String getName() { |
164 | 0 | return name; |
165 | |
} |
166 | |
|
167 | |
public Builder setName(String name) { |
168 | 0 | this.name = name; |
169 | 0 | return this; |
170 | |
} |
171 | |
|
172 | |
@Override |
173 | |
public String getObjectClass() { |
174 | 0 | return objectClass; |
175 | |
} |
176 | |
|
177 | |
public Builder setObjectClass(String objectClass) { |
178 | 0 | this.objectClass = objectClass; |
179 | 0 | return this; |
180 | |
} |
181 | |
|
182 | |
@Override |
183 | |
public String getObjectDescription() { |
184 | 0 | return objectDescription; |
185 | |
} |
186 | |
|
187 | |
public Builder setObjectDescription(String objectDescription) { |
188 | 0 | this.objectDescription = objectDescription; |
189 | 0 | return this; |
190 | |
} |
191 | |
|
192 | |
@Override |
193 | |
public String getObjectLabel() { |
194 | 0 | return objectLabel; |
195 | |
} |
196 | |
|
197 | |
public Builder setObjectLabel(String objectLabel) { |
198 | 0 | this.objectLabel = objectLabel; |
199 | 0 | return this; |
200 | |
} |
201 | |
|
202 | |
@Override |
203 | |
public List<String> getPrimaryKeys() { |
204 | 0 | return primaryKeys; |
205 | |
} |
206 | |
|
207 | |
public Builder setPrimaryKeys(List<String> primaryKeys) { |
208 | 0 | this.primaryKeys = primaryKeys; |
209 | 0 | return this; |
210 | |
} |
211 | |
|
212 | |
@Override |
213 | |
public String getTitleAttribute() { |
214 | 0 | return titleAttribute; |
215 | |
} |
216 | |
|
217 | |
public Builder setTitleAttribute(String titleAttribute) { |
218 | 0 | this.titleAttribute = titleAttribute; |
219 | 0 | return this; |
220 | |
} |
221 | |
} |
222 | |
} |