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.DictionaryEntry; |
27 | |
|
28 | |
|
29 | |
@XmlAccessorType(XmlAccessType.NONE) |
30 | 35 | public class DictionaryEntryInfo implements DictionaryEntry, 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 | 0 | public DictionaryEntryInfo() { |
49 | 0 | this.objectClass = null; |
50 | 0 | this.name = null; |
51 | 0 | this.objectLabel = null; |
52 | 0 | this.objectDescription = null; |
53 | 0 | this.titleAttribute = null; |
54 | 0 | this.primaryKeys = null; |
55 | 0 | this.attributes = null; |
56 | 0 | } |
57 | |
|
58 | 35 | private DictionaryEntryInfo(DictionaryEntry infc) { |
59 | 35 | this.objectClass = infc.getObjectClass(); |
60 | 35 | this.name = infc.getName(); |
61 | 35 | this.objectLabel = infc.getObjectLabel(); |
62 | 35 | this.objectDescription = infc.getObjectDescription(); |
63 | 35 | this.titleAttribute = infc.getTitleAttribute(); |
64 | 35 | if (infc.getPrimaryKeys() != null) { |
65 | 35 | this.primaryKeys = Collections.unmodifiableList(infc.getPrimaryKeys()); |
66 | |
} |
67 | 35 | if (infc.getAttributes() != null) { |
68 | 35 | List<AttributeDefinitionInfo> list = new ArrayList(infc.getAttributes().size()); |
69 | 35 | for (AttributeDefinitionInfc ad : infc.getAttributes()) { |
70 | 255 | list.add(new AttributeDefinitionInfo.Builder(ad).build()); |
71 | |
} |
72 | 35 | this.attributes = Collections.unmodifiableList(list); |
73 | |
} |
74 | 35 | } |
75 | |
|
76 | |
@Override |
77 | |
public String getObjectClass() { |
78 | 0 | return objectClass; |
79 | |
} |
80 | |
|
81 | |
@Override |
82 | |
public String getName() { |
83 | 0 | return name; |
84 | |
} |
85 | |
|
86 | |
@Override |
87 | |
public String getObjectLabel() { |
88 | 0 | return objectLabel; |
89 | |
} |
90 | |
|
91 | |
@Override |
92 | |
public String getObjectDescription() { |
93 | 0 | return objectDescription; |
94 | |
} |
95 | |
|
96 | |
@Override |
97 | |
public String getTitleAttribute() { |
98 | 0 | return titleAttribute; |
99 | |
} |
100 | |
|
101 | |
@Override |
102 | |
public List<String> getPrimaryKeys() { |
103 | 0 | return primaryKeys; |
104 | |
} |
105 | |
|
106 | |
@Override |
107 | |
public List<AttributeDefinitionInfo> getAttributes() { |
108 | 0 | return attributes; |
109 | |
} |
110 | |
|
111 | |
public static class Builder implements DictionaryEntry { |
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 | 35 | public Builder() { |
122 | 35 | } |
123 | |
|
124 | 0 | public Builder(DictionaryEntry infc) { |
125 | 0 | this.objectClass = infc.getObjectClass(); |
126 | 0 | this.name = infc.getName(); |
127 | 0 | this.objectLabel = infc.getObjectLabel(); |
128 | 0 | this.objectDescription = infc.getObjectDescription(); |
129 | 0 | this.titleAttribute = infc.getTitleAttribute(); |
130 | 0 | this.primaryKeys = new ArrayList(infc.getPrimaryKeys()); |
131 | 0 | this.attributes = new ArrayList(infc.getAttributes()); |
132 | 0 | } |
133 | |
|
134 | |
public DictionaryEntryInfo build() { |
135 | 35 | return new DictionaryEntryInfo(this); |
136 | |
} |
137 | |
|
138 | |
@Override |
139 | |
public List<AttributeDefinitionInfo> getAttributes() { |
140 | 105 | return attributes; |
141 | |
} |
142 | |
|
143 | |
public Builder setAttributes(List<AttributeDefinitionInfo> attributes) { |
144 | 35 | this.attributes = attributes; |
145 | 35 | return this; |
146 | |
} |
147 | |
|
148 | |
@Override |
149 | |
public String getName() { |
150 | 35 | return name; |
151 | |
} |
152 | |
|
153 | |
public Builder setName(String name) { |
154 | 35 | this.name = name; |
155 | 35 | return this; |
156 | |
} |
157 | |
|
158 | |
@Override |
159 | |
public String getObjectClass() { |
160 | 35 | return objectClass; |
161 | |
} |
162 | |
|
163 | |
public Builder setObjectClass(String objectClass) { |
164 | 35 | this.objectClass = objectClass; |
165 | 35 | return this; |
166 | |
} |
167 | |
|
168 | |
@Override |
169 | |
public String getObjectDescription() { |
170 | 35 | return objectDescription; |
171 | |
} |
172 | |
|
173 | |
public Builder setObjectDescription(String objectDescription) { |
174 | 35 | this.objectDescription = objectDescription; |
175 | 35 | return this; |
176 | |
} |
177 | |
|
178 | |
@Override |
179 | |
public String getObjectLabel() { |
180 | 35 | return objectLabel; |
181 | |
} |
182 | |
|
183 | |
public Builder setObjectLabel(String objectLabel) { |
184 | 35 | this.objectLabel = objectLabel; |
185 | 35 | return this; |
186 | |
} |
187 | |
|
188 | |
@Override |
189 | |
public List<String> getPrimaryKeys() { |
190 | 70 | return primaryKeys; |
191 | |
} |
192 | |
|
193 | |
public Builder setPrimaryKeys(List<String> primaryKeys) { |
194 | 35 | this.primaryKeys = primaryKeys; |
195 | 35 | return this; |
196 | |
} |
197 | |
|
198 | |
@Override |
199 | |
public String getTitleAttribute() { |
200 | 35 | return titleAttribute; |
201 | |
} |
202 | |
|
203 | |
public Builder setTitleAttribute(String titleAttribute) { |
204 | 35 | this.titleAttribute = titleAttribute; |
205 | 35 | return this; |
206 | |
} |
207 | |
} |
208 | |
} |