1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kim.api.identity.personal; |
17 | |
|
18 | |
import java.io.Serializable; |
19 | |
import java.util.Collection; |
20 | |
import javax.xml.bind.annotation.XmlAccessType; |
21 | |
import javax.xml.bind.annotation.XmlAccessorType; |
22 | |
import javax.xml.bind.annotation.XmlAnyElement; |
23 | |
import javax.xml.bind.annotation.XmlElement; |
24 | |
import javax.xml.bind.annotation.XmlRootElement; |
25 | |
import javax.xml.bind.annotation.XmlType; |
26 | |
|
27 | |
import org.apache.commons.lang.StringUtils; |
28 | |
import org.kuali.rice.core.api.CoreConstants; |
29 | |
import org.kuali.rice.core.api.mo.AbstractDataTransferObject; |
30 | |
import org.kuali.rice.core.api.mo.ModelBuilder; |
31 | |
import org.kuali.rice.kim.api.KimApiConstants; |
32 | |
import org.w3c.dom.Element; |
33 | |
|
34 | |
@XmlRootElement(name = EntityEthnicity.Constants.ROOT_ELEMENT_NAME) |
35 | |
@XmlAccessorType(XmlAccessType.NONE) |
36 | |
@XmlType(name = EntityEthnicity.Constants.TYPE_NAME, propOrder = { |
37 | |
EntityEthnicity.Elements.ID, |
38 | |
EntityEthnicity.Elements.ENTITY_ID, |
39 | |
EntityEthnicity.Elements.ETHNICITY_CODE, |
40 | |
EntityEthnicity.Elements.ETHNICITY_CODE_UNMASKED, |
41 | |
EntityEthnicity.Elements.SUB_ETHNICITY_CODE, |
42 | |
EntityEthnicity.Elements.SUB_ETHNICITY_CODE_UNMASKED, |
43 | |
EntityEthnicity.Elements.SUPPRESS_PERSONAL, |
44 | |
CoreConstants.CommonElements.VERSION_NUMBER, |
45 | |
CoreConstants.CommonElements.OBJECT_ID, |
46 | |
CoreConstants.CommonElements.FUTURE_ELEMENTS |
47 | |
}) |
48 | 0 | public final class EntityEthnicity extends AbstractDataTransferObject |
49 | |
implements EntityEthnicityContract |
50 | |
{ |
51 | |
|
52 | |
@XmlElement(name = Elements.ENTITY_ID, required = false) |
53 | |
private final String entityId; |
54 | |
@XmlElement(name = Elements.ETHNICITY_CODE, required = false) |
55 | |
private final String ethnicityCode; |
56 | |
@XmlElement(name = Elements.ETHNICITY_CODE_UNMASKED, required = false) |
57 | |
private final String ethnicityCodeUnmasked; |
58 | |
@XmlElement(name = Elements.SUB_ETHNICITY_CODE, required = false) |
59 | |
private final String subEthnicityCode; |
60 | |
@XmlElement(name = Elements.SUB_ETHNICITY_CODE_UNMASKED, required = false) |
61 | |
private final String subEthnicityCodeUnmasked; |
62 | |
@XmlElement(name = Elements.SUPPRESS_PERSONAL, required = false) |
63 | |
private final boolean suppressPersonal; |
64 | |
@XmlElement(name = CoreConstants.CommonElements.VERSION_NUMBER, required = false) |
65 | |
private final Long versionNumber; |
66 | |
@XmlElement(name = CoreConstants.CommonElements.OBJECT_ID, required = false) |
67 | |
private final String objectId; |
68 | |
@XmlElement(name = Elements.ID, required = false) |
69 | |
private final String id; |
70 | 0 | @SuppressWarnings("unused") |
71 | |
@XmlAnyElement |
72 | |
private final Collection<Element> _futureElements = null; |
73 | |
|
74 | |
|
75 | |
|
76 | |
|
77 | |
|
78 | 0 | private EntityEthnicity() { |
79 | 0 | this.entityId = null; |
80 | 0 | this.ethnicityCode = null; |
81 | 0 | this.ethnicityCodeUnmasked = null; |
82 | 0 | this.subEthnicityCode = null; |
83 | 0 | this.subEthnicityCodeUnmasked = null; |
84 | 0 | this.suppressPersonal = false; |
85 | 0 | this.versionNumber = null; |
86 | 0 | this.objectId = null; |
87 | 0 | this.id = null; |
88 | 0 | } |
89 | |
|
90 | 0 | private EntityEthnicity(Builder builder) { |
91 | 0 | this.entityId = builder.getEntityId(); |
92 | 0 | this.ethnicityCode = builder.getEthnicityCode(); |
93 | 0 | this.ethnicityCodeUnmasked = builder.getEthnicityCodeUnmasked(); |
94 | 0 | this.subEthnicityCode = builder.getSubEthnicityCode(); |
95 | 0 | this.subEthnicityCodeUnmasked = builder.getSubEthnicityCodeUnmasked(); |
96 | 0 | this.suppressPersonal = builder.isSuppressPersonal(); |
97 | 0 | this.versionNumber = builder.getVersionNumber(); |
98 | 0 | this.objectId = builder.getObjectId(); |
99 | 0 | this.id = builder.getId(); |
100 | 0 | } |
101 | |
|
102 | |
@Override |
103 | |
public String getEntityId() { |
104 | 0 | return this.entityId; |
105 | |
} |
106 | |
|
107 | |
@Override |
108 | |
public String getEthnicityCode() { |
109 | 0 | return this.ethnicityCode; |
110 | |
} |
111 | |
|
112 | |
@Override |
113 | |
public String getEthnicityCodeUnmasked() { |
114 | 0 | return this.ethnicityCodeUnmasked; |
115 | |
} |
116 | |
|
117 | |
@Override |
118 | |
public String getSubEthnicityCode() { |
119 | 0 | return this.subEthnicityCode; |
120 | |
} |
121 | |
|
122 | |
@Override |
123 | |
public String getSubEthnicityCodeUnmasked() { |
124 | 0 | return this.subEthnicityCodeUnmasked; |
125 | |
} |
126 | |
|
127 | |
@Override |
128 | |
public boolean isSuppressPersonal() { |
129 | 0 | return this.suppressPersonal; |
130 | |
} |
131 | |
|
132 | |
@Override |
133 | |
public Long getVersionNumber() { |
134 | 0 | return this.versionNumber; |
135 | |
} |
136 | |
|
137 | |
@Override |
138 | |
public String getObjectId() { |
139 | 0 | return this.objectId; |
140 | |
} |
141 | |
|
142 | |
@Override |
143 | |
public String getId() { |
144 | 0 | return this.id; |
145 | |
} |
146 | |
|
147 | |
|
148 | |
|
149 | |
|
150 | |
|
151 | 0 | public final static class Builder |
152 | |
implements Serializable, ModelBuilder, EntityEthnicityContract |
153 | |
{ |
154 | |
|
155 | |
private String entityId; |
156 | |
private String ethnicityCode; |
157 | |
private String subEthnicityCode; |
158 | |
private boolean suppressPersonal; |
159 | |
private Long versionNumber; |
160 | |
private String objectId; |
161 | |
private String id; |
162 | |
|
163 | 0 | private Builder() { } |
164 | |
|
165 | |
public static Builder create() { |
166 | 0 | return new Builder(); |
167 | |
} |
168 | |
|
169 | |
public static Builder create(EntityEthnicityContract contract) { |
170 | 0 | if (contract == null) { |
171 | 0 | throw new IllegalArgumentException("contract was null"); |
172 | |
} |
173 | 0 | Builder builder = create(); |
174 | 0 | builder.setEntityId(contract.getEntityId()); |
175 | 0 | builder.setEthnicityCode(contract.getEthnicityCode()); |
176 | 0 | builder.setSubEthnicityCode(contract.getSubEthnicityCode()); |
177 | 0 | builder.setSuppressPersonal(contract.isSuppressPersonal()); |
178 | 0 | builder.setVersionNumber(contract.getVersionNumber()); |
179 | 0 | builder.setObjectId(contract.getObjectId()); |
180 | 0 | builder.setId(contract.getId()); |
181 | 0 | return builder; |
182 | |
} |
183 | |
|
184 | |
public EntityEthnicity build() { |
185 | 0 | return new EntityEthnicity(this); |
186 | |
} |
187 | |
|
188 | |
@Override |
189 | |
public String getEntityId() { |
190 | 0 | return this.entityId; |
191 | |
} |
192 | |
|
193 | |
@Override |
194 | |
public String getEthnicityCode() { |
195 | 0 | if (isSuppressPersonal()) { |
196 | 0 | return KimApiConstants.RestrictedMasks.RESTRICTED_DATA_MASK; |
197 | |
} |
198 | 0 | return this.ethnicityCode; |
199 | |
} |
200 | |
|
201 | |
@Override |
202 | |
public String getEthnicityCodeUnmasked() { |
203 | 0 | return this.ethnicityCode; |
204 | |
} |
205 | |
|
206 | |
@Override |
207 | |
public String getSubEthnicityCode() { |
208 | 0 | if (isSuppressPersonal()) { |
209 | 0 | return KimApiConstants.RestrictedMasks.RESTRICTED_DATA_MASK; |
210 | |
} |
211 | 0 | return this.subEthnicityCode; |
212 | |
} |
213 | |
|
214 | |
@Override |
215 | |
public String getSubEthnicityCodeUnmasked() { |
216 | 0 | return this.subEthnicityCode; |
217 | |
} |
218 | |
|
219 | |
@Override |
220 | |
public boolean isSuppressPersonal() { |
221 | 0 | return this.suppressPersonal; |
222 | |
} |
223 | |
|
224 | |
@Override |
225 | |
public Long getVersionNumber() { |
226 | 0 | return this.versionNumber; |
227 | |
} |
228 | |
|
229 | |
@Override |
230 | |
public String getObjectId() { |
231 | 0 | return this.objectId; |
232 | |
} |
233 | |
|
234 | |
@Override |
235 | |
public String getId() { |
236 | 0 | return this.id; |
237 | |
} |
238 | |
|
239 | |
public void setEntityId(String entityId) { |
240 | |
|
241 | 0 | this.entityId = entityId; |
242 | 0 | } |
243 | |
|
244 | |
public void setEthnicityCode(String ethnicityCode) { |
245 | 0 | this.ethnicityCode = ethnicityCode; |
246 | 0 | } |
247 | |
|
248 | |
public void setSubEthnicityCode(String subEthnicityCode) { |
249 | 0 | this.subEthnicityCode = subEthnicityCode; |
250 | 0 | } |
251 | |
|
252 | |
private void setSuppressPersonal(boolean suppressPersonal) { |
253 | 0 | this.suppressPersonal = suppressPersonal; |
254 | 0 | } |
255 | |
|
256 | |
public void setVersionNumber(Long versionNumber) { |
257 | 0 | this.versionNumber = versionNumber; |
258 | 0 | } |
259 | |
|
260 | |
public void setObjectId(String objectId) { |
261 | 0 | this.objectId = objectId; |
262 | 0 | } |
263 | |
|
264 | |
public void setId(String id) { |
265 | 0 | if (StringUtils.isWhitespace(id)) { |
266 | 0 | throw new IllegalArgumentException("id is blank"); |
267 | |
} |
268 | 0 | this.id = id; |
269 | 0 | } |
270 | |
|
271 | |
} |
272 | |
|
273 | |
|
274 | |
|
275 | |
|
276 | |
|
277 | |
|
278 | 0 | static class Constants { |
279 | |
|
280 | |
final static String ROOT_ELEMENT_NAME = "entityEthnicity"; |
281 | |
final static String TYPE_NAME = "EntityEthnicityType"; |
282 | |
} |
283 | |
|
284 | |
|
285 | |
|
286 | |
|
287 | |
|
288 | |
|
289 | 0 | static class Elements { |
290 | |
|
291 | |
final static String ENTITY_ID = "entityId"; |
292 | |
final static String ETHNICITY_CODE = "ethnicityCode"; |
293 | |
final static String ETHNICITY_CODE_UNMASKED = "ethnicityCodeUnmasked"; |
294 | |
final static String SUB_ETHNICITY_CODE = "subEthnicityCode"; |
295 | |
final static String SUB_ETHNICITY_CODE_UNMASKED = "subEthnicityCodeUnmasked"; |
296 | |
final static String SUPPRESS_PERSONAL = "suppressPersonal"; |
297 | |
final static String ID = "id"; |
298 | |
|
299 | |
} |
300 | |
|
301 | |
} |