1 package org.kuali.kpme.edo.api.candidate;
2
3 import java.io.Serializable;
4 import java.util.Collection;
5
6 import javax.xml.bind.annotation.XmlAccessType;
7 import javax.xml.bind.annotation.XmlAccessorType;
8 import javax.xml.bind.annotation.XmlAnyElement;
9 import javax.xml.bind.annotation.XmlElement;
10 import javax.xml.bind.annotation.XmlRootElement;
11 import javax.xml.bind.annotation.XmlType;
12 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
13
14 import org.apache.commons.lang.StringUtils;
15 import org.joda.time.DateTime;
16 import org.joda.time.LocalDate;
17 import org.kuali.kpme.core.api.groupkey.HrGroupKey;
18 import org.kuali.kpme.core.api.util.jaxb.LocalTimeAdapter;
19 import org.kuali.rice.core.api.CoreConstants;
20 import org.kuali.rice.core.api.mo.AbstractDataTransferObject;
21 import org.kuali.rice.core.api.mo.ModelBuilder;
22 import org.kuali.rice.core.api.util.jaxb.DateTimeAdapter;
23 import org.kuali.rice.core.api.util.jaxb.LocalDateAdapter;
24 import org.w3c.dom.Element;
25
26 @XmlRootElement(name = EdoCandidate.Constants.ROOT_ELEMENT_NAME)
27 @XmlAccessorType(XmlAccessType.NONE)
28 @XmlType(name = EdoCandidate.Constants.TYPE_NAME, propOrder = {
29
30 EdoCandidate.Elements.CANDIDACY_SCHOOL,
31 EdoCandidate.Elements.EDO_CANDIDATE_ID,
32 EdoCandidate.Elements.PRINCIPAL_NAME,
33 EdoCandidate.Elements.PRIMARY_DEPT_ID,
34 EdoCandidate.Elements.TNP_DEPT_ID,
35 EdoCandidate.Elements.FIRST_NAME,
36 EdoCandidate.Elements.LAST_NAME,
37 CoreConstants.CommonElements.VERSION_NUMBER,
38 CoreConstants.CommonElements.OBJECT_ID,
39 EdoCandidate.Elements.ACTIVE,
40 EdoCandidate.Elements.ID,
41 EdoCandidate.Elements.EFFECTIVE_LOCAL_DATE,
42 EdoCandidate.Elements.CREATE_TIME,
43 EdoCandidate.Elements.USER_PRINCIPAL_ID,
44 EdoCandidate.Elements.GROUP_KEY_CODE,
45 EdoCandidate.Elements.GROUP_KEY,
46 CoreConstants.CommonElements.FUTURE_ELEMENTS
47 })
48 public final class EdoCandidate extends AbstractDataTransferObject implements EdoCandidateContract
49 {
50 @XmlElement(name = Elements.CANDIDACY_SCHOOL, required = false)
51 private final String candidacySchool;
52 @XmlElement(name = Elements.EDO_CANDIDATE_ID, required = false)
53 private final String edoCandidateId;
54 @XmlElement(name = Elements.PRINCIPAL_NAME, required = false)
55 private final String principalName;
56 @XmlElement(name = Elements.PRIMARY_DEPT_ID, required = false)
57 private final String primaryDeptId;
58 @XmlElement(name = Elements.TNP_DEPT_ID, required = false)
59 private final String tnpDeptId;
60 @XmlElement(name = Elements.FIRST_NAME, required = false)
61 private final String firstName;
62 @XmlElement(name = Elements.LAST_NAME, required = false)
63 private final String lastName;
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.ACTIVE, required = false)
69 private final boolean active;
70 @XmlElement(name = Elements.ID, required = false)
71 private final String id;
72 @XmlJavaTypeAdapter(LocalDateAdapter.class)
73 @XmlElement(name = Elements.EFFECTIVE_LOCAL_DATE, required = false)
74 private final LocalDate effectiveLocalDate;
75 @XmlJavaTypeAdapter(DateTimeAdapter.class)
76 @XmlElement(name = Elements.CREATE_TIME, required = false)
77 private final DateTime createTime;
78 @XmlElement(name = Elements.USER_PRINCIPAL_ID, required = false)
79 private final String userPrincipalId;
80 @XmlElement(name = Elements.GROUP_KEY_CODE, required = false)
81 private final String groupKeyCode;
82 @XmlElement(name = Elements.GROUP_KEY, required = false)
83 private final HrGroupKey groupKey;
84 @SuppressWarnings("unused")
85 @XmlAnyElement
86 private final Collection<Element> _futureElements = null;
87
88
89
90
91
92 private EdoCandidate() {
93 this.candidacySchool = null;
94 this.edoCandidateId = null;
95 this.principalName = null;
96 this.primaryDeptId = null;
97 this.tnpDeptId = null;
98 this.firstName = null;
99 this.lastName = null;
100 this.versionNumber = null;
101 this.objectId = null;
102 this.active = false;
103 this.id = null;
104 this.effectiveLocalDate = null;
105 this.createTime = null;
106 this.userPrincipalId = null;
107 this.groupKeyCode = null;
108 this.groupKey = null;
109 }
110
111 private EdoCandidate(Builder builder) {
112 this.candidacySchool = builder.getCandidacySchool();
113 this.edoCandidateId = builder.getEdoCandidateId();
114 this.principalName = builder.getPrincipalName();
115 this.primaryDeptId = builder.getPrimaryDeptId();
116 this.tnpDeptId = builder.getTnpDeptId();
117 this.firstName = builder.getFirstName();
118 this.lastName = builder.getLastName();
119 this.versionNumber = builder.getVersionNumber();
120 this.objectId = builder.getObjectId();
121 this.active = builder.isActive();
122 this.id = builder.getId();
123 this.effectiveLocalDate = builder.getEffectiveLocalDate();
124 this.createTime = builder.getCreateTime();
125 this.userPrincipalId = builder.getUserPrincipalId();
126 this.groupKeyCode = builder.getGroupKeyCode();
127 this.groupKey = builder.getGroupKey() == null ? null : builder.getGroupKey().build();
128 }
129
130 @Override
131 public String getCandidacySchool() {
132 return this.candidacySchool;
133 }
134
135 @Override
136 public String getEdoCandidateId() {
137 return this.edoCandidateId;
138 }
139
140 @Override
141 public String getPrincipalName() {
142 return this.principalName;
143 }
144
145 @Override
146 public String getPrimaryDeptId() {
147 return this.primaryDeptId;
148 }
149
150
151 @Override
152 public String getTnpDeptId() {
153 return this.tnpDeptId;
154 }
155
156 @Override
157 public String getFirstName() {
158 return this.firstName;
159 }
160
161 @Override
162 public String getLastName() {
163 return this.lastName;
164 }
165
166 @Override
167 public Long getVersionNumber() {
168 return this.versionNumber;
169 }
170
171 @Override
172 public String getObjectId() {
173 return this.objectId;
174 }
175
176 @Override
177 public boolean isActive() {
178 return this.active;
179 }
180
181 @Override
182 public String getId() {
183 return this.id;
184 }
185
186 @Override
187 public LocalDate getEffectiveLocalDate() {
188 return this.effectiveLocalDate;
189 }
190
191 @Override
192 public DateTime getCreateTime() {
193 return this.createTime;
194 }
195
196 @Override
197 public String getUserPrincipalId() {
198 return this.userPrincipalId;
199 }
200
201 @Override
202 public String getGroupKeyCode() {
203 return this.groupKeyCode;
204 }
205
206 @Override
207 public HrGroupKey getGroupKey() {
208 return this.groupKey;
209 }
210
211
212
213
214
215
216 public final static class Builder implements Serializable, EdoCandidateContract, ModelBuilder
217 {
218 private String candidacySchool;
219 private String edoCandidateId;
220 private String principalName;
221 private String primaryDeptId;
222 private String tnpDeptId;
223 private String firstName;
224 private String lastName;
225 private Long versionNumber;
226 private String objectId;
227 private boolean active;
228 private String id;
229 private LocalDate effectiveLocalDate;
230 private DateTime createTime;
231 private String userPrincipalId;
232 private String groupKeyCode;
233 private HrGroupKey.Builder groupKey;
234
235 private Builder() {
236
237 }
238
239 public static Builder create() {
240
241 return new Builder();
242 }
243
244 private Builder(String principalName) {
245
246 setPrincipalName(principalName);
247 }
248
249 public static Builder create(String principalName) {
250
251 return new Builder(principalName);
252 }
253
254 public static Builder create(EdoCandidateContract contract) {
255 if (contract == null) {
256 throw new IllegalArgumentException("contract was null");
257 }
258
259 Builder builder = create();
260 builder.setCandidacySchool(contract.getCandidacySchool());
261 builder.setEdoCandidateId(contract.getEdoCandidateId());
262 builder.setPrincipalName(contract.getPrincipalName());
263 builder.setPrimaryDeptId(contract.getPrimaryDeptId());
264 builder.setTnpDeptId(contract.getTnpDeptId());
265 builder.setFirstName(contract.getFirstName());
266 builder.setLastName(contract.getLastName());
267 builder.setVersionNumber(contract.getVersionNumber());
268 builder.setObjectId(contract.getObjectId());
269 builder.setActive(contract.isActive());
270 builder.setId(contract.getId());
271 builder.setEffectiveLocalDate(contract.getEffectiveLocalDate());
272 builder.setCreateTime(contract.getCreateTime());
273 builder.setUserPrincipalId(contract.getUserPrincipalId());
274 builder.setGroupKeyCode(contract.getGroupKeyCode());
275 builder.setGroupKey(contract.getGroupKey() == null ? null : HrGroupKey.Builder.create(contract.getGroupKey()));
276 return builder;
277 }
278
279 public EdoCandidate build() {
280 return new EdoCandidate(this);
281 }
282
283
284 @Override
285 public String getCandidacySchool() {
286 return this.candidacySchool;
287 }
288
289 @Override
290 public String getEdoCandidateId() {
291 return this.edoCandidateId;
292 }
293
294 @Override
295 public String getPrincipalName() {
296 return this.principalName;
297 }
298
299 @Override
300 public String getPrimaryDeptId() {
301 return this.primaryDeptId;
302 }
303
304 @Override
305 public String getTnpDeptId() {
306 return this.tnpDeptId;
307 }
308
309 @Override
310 public String getFirstName() {
311 return this.firstName;
312 }
313
314 @Override
315 public String getLastName() {
316 return this.lastName;
317 }
318
319 @Override
320 public Long getVersionNumber() {
321 return this.versionNumber;
322 }
323
324 @Override
325 public String getObjectId() {
326 return this.objectId;
327 }
328
329 @Override
330 public boolean isActive() {
331 return this.active;
332 }
333
334 @Override
335 public String getId() {
336 return this.id;
337 }
338
339 @Override
340 public LocalDate getEffectiveLocalDate() {
341 return this.effectiveLocalDate;
342 }
343
344 @Override
345 public DateTime getCreateTime() {
346 return this.createTime;
347 }
348
349 @Override
350 public String getUserPrincipalId() {
351 return this.userPrincipalId;
352 }
353
354 @Override
355 public String getGroupKeyCode() {
356 return this.groupKeyCode;
357 }
358
359 @Override
360 public HrGroupKey.Builder getGroupKey() {
361 return this.groupKey;
362 }
363
364 public void setCandidacySchool(String candidacySchool) {
365
366 this.candidacySchool = candidacySchool;
367 }
368
369 public void setEdoCandidateId(String edoCandidateId) {
370
371 this.edoCandidateId = edoCandidateId;
372 }
373
374 public void setPrincipalName(String principalName) {
375
376 this.principalName = principalName;
377 }
378
379 public void setPrimaryDeptId(String primaryDeptId) {
380
381 this.primaryDeptId = primaryDeptId;
382 }
383
384 public void setTnpDeptId(String tnpDeptId) {
385
386 this.tnpDeptId = tnpDeptId;
387 }
388
389 public void setFirstName(String firstName) {
390
391 this.firstName = firstName;
392 }
393
394 public void setLastName(String lastName) {
395
396 this.lastName = lastName;
397 }
398
399 public void setVersionNumber(Long versionNumber) {
400
401 this.versionNumber = versionNumber;
402 }
403
404 public void setObjectId(String objectId) {
405
406 this.objectId = objectId;
407 }
408
409 public void setActive(boolean active) {
410
411 this.active = active;
412 }
413
414 public void setId(String id) {
415
416 this.id = id;
417 }
418
419 public void setEffectiveLocalDate(LocalDate effectiveLocalDate) {
420
421 this.effectiveLocalDate = effectiveLocalDate;
422 }
423
424 public void setCreateTime(DateTime createTime) {
425
426 this.createTime = createTime;
427 }
428
429 public void setUserPrincipalId(String userPrincipalId) {
430
431 this.userPrincipalId = userPrincipalId;
432 }
433
434 public void setGroupKeyCode(String groupKeyCode) {
435 if (StringUtils.isWhitespace(groupKeyCode)) {
436 throw new IllegalArgumentException("groupKeyCode is blank");
437 }
438 this.groupKeyCode = groupKeyCode;
439 }
440
441 public void setGroupKey(HrGroupKey.Builder groupKey) {
442 this.groupKey = groupKey;
443 }
444 }
445
446
447
448
449
450
451 static class Constants {
452
453 final static String ROOT_ELEMENT_NAME = "edoCandidate";
454 final static String TYPE_NAME = "EdoCandidateType";
455
456 }
457
458
459
460
461
462
463 static class Elements {
464 final static String CANDIDACY_SCHOOL = "candidacySchool";
465 final static String EDO_CANDIDATE_ID = "edoCandidateId";
466 final static String PRINCIPAL_NAME = "principalName";
467 final static String PRIMARY_DEPT_ID = "primaryDeptId";
468 final static String TNP_DEPT_ID = "tnpDeptId";
469 final static String FIRST_NAME = "firstName";
470 final static String LAST_NAME = "lastName";
471 final static String ACTIVE = "active";
472 final static String ID = "id";
473 final static String EFFECTIVE_LOCAL_DATE = "effectiveLocalDate";
474 final static String CREATE_TIME = "createTime";
475 final static String USER_PRINCIPAL_ID = "userPrincipalId";
476 final static String GROUP_KEY_CODE = "groupKeyCode";
477 final static String GROUP_KEY = "groupKey";
478 }
479
480 }
481
482