1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kim.api.identity.employment; |
17 | |
|
18 | |
import org.apache.commons.lang.StringUtils; |
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.KualiDecimalAdapter; |
23 | |
import org.kuali.rice.core.api.util.type.KualiDecimal; |
24 | |
import org.kuali.rice.kim.api.identity.CodedAttribute; |
25 | |
import org.kuali.rice.kim.api.identity.affiliation.EntityAffiliation; |
26 | |
import org.w3c.dom.Element; |
27 | |
|
28 | |
import javax.xml.bind.annotation.XmlAccessType; |
29 | |
import javax.xml.bind.annotation.XmlAccessorType; |
30 | |
import javax.xml.bind.annotation.XmlAnyElement; |
31 | |
import javax.xml.bind.annotation.XmlElement; |
32 | |
import javax.xml.bind.annotation.XmlRootElement; |
33 | |
import javax.xml.bind.annotation.XmlType; |
34 | |
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; |
35 | |
import java.io.Serializable; |
36 | |
import java.util.Collection; |
37 | |
|
38 | 0 | @XmlRootElement(name = EntityEmployment.Constants.ROOT_ELEMENT_NAME) |
39 | |
@XmlAccessorType(XmlAccessType.NONE) |
40 | |
@XmlType(name = EntityEmployment.Constants.TYPE_NAME, propOrder = { |
41 | |
EntityEmployment.Elements.ID, |
42 | |
EntityEmployment.Elements.ENTITY_ID, |
43 | |
EntityEmployment.Elements.EMPLOYEE_ID, |
44 | |
EntityEmployment.Elements.EMPLOYMENT_RECORD_ID, |
45 | |
EntityEmployment.Elements.ENTITY_AFFILIATION, |
46 | |
EntityEmployment.Elements.EMPLOYEE_STATUS, |
47 | |
EntityEmployment.Elements.EMPLOYEE_TYPE, |
48 | |
EntityEmployment.Elements.PRIMARY_DEPARTMENT_CODE, |
49 | |
EntityEmployment.Elements.BASE_SALARY_AMOUNT, |
50 | |
EntityEmployment.Elements.PRIMARY, |
51 | |
CoreConstants.CommonElements.VERSION_NUMBER, |
52 | |
CoreConstants.CommonElements.OBJECT_ID, |
53 | |
EntityEmployment.Elements.ACTIVE, |
54 | |
|
55 | |
CoreConstants.CommonElements.FUTURE_ELEMENTS |
56 | |
}) |
57 | 0 | public final class EntityEmployment extends AbstractDataTransferObject |
58 | |
implements EntityEmploymentContract |
59 | |
{ |
60 | |
@XmlElement(name = Elements.ID, required = false) |
61 | |
private final String id; |
62 | |
@XmlElement(name = Elements.ENTITY_ID, required = false) |
63 | |
private final String entityId; |
64 | |
@XmlElement(name = Elements.ENTITY_AFFILIATION, required = false) |
65 | |
private final EntityAffiliation entityAffiliation; |
66 | |
@XmlElement(name = Elements.EMPLOYEE_STATUS, required = false) |
67 | |
private final CodedAttribute employeeStatus; |
68 | |
@XmlElement(name = Elements.EMPLOYEE_TYPE, required = false) |
69 | |
private final CodedAttribute employeeType; |
70 | |
@XmlElement(name = Elements.PRIMARY_DEPARTMENT_CODE, required = false) |
71 | |
private final String primaryDepartmentCode; |
72 | |
@XmlElement(name = Elements.EMPLOYEE_ID, required = false) |
73 | |
private final String employeeId; |
74 | |
@XmlElement(name = Elements.EMPLOYMENT_RECORD_ID, required = false) |
75 | |
private final String employmentRecordId; |
76 | |
@XmlElement(name = Elements.BASE_SALARY_AMOUNT, required = false) |
77 | |
@XmlJavaTypeAdapter(KualiDecimalAdapter.class) |
78 | |
private final KualiDecimal baseSalaryAmount; |
79 | |
@XmlElement(name = Elements.PRIMARY, required = false) |
80 | |
private final boolean primary; |
81 | |
@XmlElement(name = CoreConstants.CommonElements.VERSION_NUMBER, required = false) |
82 | |
private final Long versionNumber; |
83 | |
@XmlElement(name = CoreConstants.CommonElements.OBJECT_ID, required = false) |
84 | |
private final String objectId; |
85 | |
@XmlElement(name = Elements.ACTIVE, required = false) |
86 | |
private final boolean active; |
87 | |
|
88 | 0 | @SuppressWarnings("unused") |
89 | |
@XmlAnyElement |
90 | |
private final Collection<Element> _futureElements = null; |
91 | |
|
92 | |
|
93 | |
|
94 | |
|
95 | |
|
96 | 0 | private EntityEmployment() { |
97 | 0 | this.entityAffiliation = null; |
98 | 0 | this.employeeStatus = null; |
99 | 0 | this.employeeType = null; |
100 | 0 | this.primaryDepartmentCode = null; |
101 | 0 | this.employeeId = null; |
102 | 0 | this.employmentRecordId = null; |
103 | 0 | this.baseSalaryAmount = null; |
104 | 0 | this.primary = false; |
105 | 0 | this.versionNumber = null; |
106 | 0 | this.objectId = null; |
107 | 0 | this.active = false; |
108 | 0 | this.entityId = null; |
109 | 0 | this.id = null; |
110 | 0 | } |
111 | |
|
112 | 0 | private EntityEmployment(Builder builder) { |
113 | 0 | this.entityAffiliation = builder.getEntityAffiliation() != null ? builder.getEntityAffiliation().build() : null; |
114 | 0 | this.employeeStatus = builder.getEmployeeStatus() != null ? builder.getEmployeeStatus().build() : null; |
115 | 0 | this.employeeType = builder.getEmployeeType() != null ? builder.getEmployeeType().build() : null; |
116 | 0 | this.primaryDepartmentCode = builder.getPrimaryDepartmentCode(); |
117 | 0 | this.employeeId = builder.getEmployeeId(); |
118 | 0 | this.employmentRecordId = builder.getEmploymentRecordId(); |
119 | 0 | this.baseSalaryAmount = builder.getBaseSalaryAmount(); |
120 | 0 | this.primary = builder.isPrimary(); |
121 | 0 | this.versionNumber = builder.getVersionNumber(); |
122 | 0 | this.objectId = builder.getObjectId(); |
123 | 0 | this.active = builder.isActive(); |
124 | 0 | this.id = builder.getId(); |
125 | 0 | this.entityId = builder.getEntityId(); |
126 | 0 | } |
127 | |
|
128 | |
@Override |
129 | |
public String getEntityId() { |
130 | 0 | return this.entityId; |
131 | |
} |
132 | |
@Override |
133 | |
public EntityAffiliation getEntityAffiliation() { |
134 | 0 | return this.entityAffiliation; |
135 | |
} |
136 | |
|
137 | |
@Override |
138 | |
public CodedAttribute getEmployeeStatus() { |
139 | 0 | return this.employeeStatus; |
140 | |
} |
141 | |
|
142 | |
@Override |
143 | |
public CodedAttribute getEmployeeType() { |
144 | 0 | return this.employeeType; |
145 | |
} |
146 | |
|
147 | |
@Override |
148 | |
public String getPrimaryDepartmentCode() { |
149 | 0 | return this.primaryDepartmentCode; |
150 | |
} |
151 | |
|
152 | |
@Override |
153 | |
public String getEmployeeId() { |
154 | 0 | return this.employeeId; |
155 | |
} |
156 | |
|
157 | |
@Override |
158 | |
public String getEmploymentRecordId() { |
159 | 0 | return this.employmentRecordId; |
160 | |
} |
161 | |
|
162 | |
@Override |
163 | |
public KualiDecimal getBaseSalaryAmount() { |
164 | 0 | return this.baseSalaryAmount; |
165 | |
} |
166 | |
|
167 | |
@Override |
168 | |
public boolean isPrimary() { |
169 | 0 | return this.primary; |
170 | |
} |
171 | |
|
172 | |
@Override |
173 | |
public Long getVersionNumber() { |
174 | 0 | return this.versionNumber; |
175 | |
} |
176 | |
|
177 | |
@Override |
178 | |
public String getObjectId() { |
179 | 0 | return this.objectId; |
180 | |
} |
181 | |
|
182 | |
@Override |
183 | |
public boolean isActive() { |
184 | 0 | return this.active; |
185 | |
} |
186 | |
|
187 | |
@Override |
188 | |
public String getId() { |
189 | 0 | return this.id; |
190 | |
} |
191 | |
|
192 | |
|
193 | |
|
194 | |
|
195 | |
|
196 | 0 | public final static class Builder |
197 | |
implements Serializable, ModelBuilder, EntityEmploymentContract |
198 | |
{ |
199 | |
private String entityId; |
200 | |
private EntityAffiliation.Builder entityAffiliation; |
201 | |
private CodedAttribute.Builder employeeStatus; |
202 | |
private CodedAttribute.Builder employeeType; |
203 | |
private String primaryDepartmentCode; |
204 | |
private String employeeId; |
205 | |
private String employmentRecordId; |
206 | |
private KualiDecimal baseSalaryAmount; |
207 | |
private boolean primary; |
208 | |
private Long versionNumber; |
209 | |
private String objectId; |
210 | |
private boolean active; |
211 | |
private String id; |
212 | |
|
213 | 0 | private Builder() { } |
214 | |
|
215 | |
public static Builder create() { |
216 | 0 | return new Builder(); |
217 | |
} |
218 | |
|
219 | |
public static Builder create(EntityEmploymentContract contract) { |
220 | 0 | if (contract == null) { |
221 | 0 | throw new IllegalArgumentException("contract was null"); |
222 | |
} |
223 | 0 | Builder builder = create(); |
224 | 0 | builder.setEntityId(contract.getEntityId()); |
225 | 0 | if (contract.getEntityAffiliation() != null) { |
226 | 0 | builder.setEntityAffiliation(EntityAffiliation.Builder.create(contract.getEntityAffiliation())); |
227 | |
} |
228 | 0 | if (contract.getEmployeeStatus() != null) { |
229 | 0 | builder.setEmployeeStatus(CodedAttribute.Builder.create(contract.getEmployeeStatus())); |
230 | |
} |
231 | 0 | if (contract.getEmployeeType() != null) { |
232 | 0 | builder.setEmployeeType(CodedAttribute.Builder.create(contract.getEmployeeType())); |
233 | |
} |
234 | 0 | builder.setPrimaryDepartmentCode(contract.getPrimaryDepartmentCode()); |
235 | 0 | builder.setEmployeeId(contract.getEmployeeId()); |
236 | 0 | builder.setEmploymentRecordId(contract.getEmploymentRecordId()); |
237 | 0 | builder.setBaseSalaryAmount(contract.getBaseSalaryAmount()); |
238 | 0 | builder.setPrimary(contract.isPrimary()); |
239 | 0 | builder.setVersionNumber(contract.getVersionNumber()); |
240 | 0 | builder.setObjectId(contract.getObjectId()); |
241 | 0 | builder.setActive(contract.isActive()); |
242 | 0 | builder.setId(contract.getId()); |
243 | 0 | return builder; |
244 | |
} |
245 | |
|
246 | |
public EntityEmployment build() { |
247 | 0 | return new EntityEmployment(this); |
248 | |
} |
249 | |
|
250 | |
@Override |
251 | |
public String getEntityId() { |
252 | 0 | return this.entityId; |
253 | |
} |
254 | |
@Override |
255 | |
public EntityAffiliation.Builder getEntityAffiliation() { |
256 | 0 | return this.entityAffiliation; |
257 | |
} |
258 | |
|
259 | |
@Override |
260 | |
public CodedAttribute.Builder getEmployeeStatus() { |
261 | 0 | return this.employeeStatus; |
262 | |
} |
263 | |
|
264 | |
@Override |
265 | |
public CodedAttribute.Builder getEmployeeType() { |
266 | 0 | return this.employeeType; |
267 | |
} |
268 | |
|
269 | |
@Override |
270 | |
public String getPrimaryDepartmentCode() { |
271 | 0 | return this.primaryDepartmentCode; |
272 | |
} |
273 | |
|
274 | |
@Override |
275 | |
public String getEmployeeId() { |
276 | 0 | return this.employeeId; |
277 | |
} |
278 | |
|
279 | |
@Override |
280 | |
public String getEmploymentRecordId() { |
281 | 0 | return this.employmentRecordId; |
282 | |
} |
283 | |
|
284 | |
@Override |
285 | |
public KualiDecimal getBaseSalaryAmount() { |
286 | 0 | return this.baseSalaryAmount; |
287 | |
} |
288 | |
|
289 | |
@Override |
290 | |
public boolean isPrimary() { |
291 | 0 | return this.primary; |
292 | |
} |
293 | |
|
294 | |
@Override |
295 | |
public Long getVersionNumber() { |
296 | 0 | return this.versionNumber; |
297 | |
} |
298 | |
|
299 | |
@Override |
300 | |
public String getObjectId() { |
301 | 0 | return this.objectId; |
302 | |
} |
303 | |
|
304 | |
@Override |
305 | |
public boolean isActive() { |
306 | 0 | return this.active; |
307 | |
} |
308 | |
|
309 | |
@Override |
310 | |
public String getId() { |
311 | 0 | return this.id; |
312 | |
} |
313 | |
|
314 | |
public void setEntityAffiliation(EntityAffiliation.Builder entityAffiliation) { |
315 | 0 | this.entityAffiliation = entityAffiliation; |
316 | 0 | } |
317 | |
|
318 | |
public void setEmployeeStatus(CodedAttribute.Builder employeeStatus) { |
319 | 0 | this.employeeStatus = employeeStatus; |
320 | 0 | } |
321 | |
|
322 | |
public void setEmployeeType(CodedAttribute.Builder employeeType) { |
323 | 0 | this.employeeType = employeeType; |
324 | 0 | } |
325 | |
|
326 | |
public void setEntityId(String entityId) { |
327 | 0 | this.entityId = entityId; |
328 | 0 | } |
329 | |
|
330 | |
public void setPrimaryDepartmentCode(String primaryDepartmentCode) { |
331 | 0 | this.primaryDepartmentCode = primaryDepartmentCode; |
332 | 0 | } |
333 | |
|
334 | |
public void setEmployeeId(String employeeId) { |
335 | 0 | this.employeeId = employeeId; |
336 | 0 | } |
337 | |
|
338 | |
public void setEmploymentRecordId(String employmentRecordId) { |
339 | 0 | this.employmentRecordId = employmentRecordId; |
340 | 0 | } |
341 | |
|
342 | |
public void setBaseSalaryAmount(KualiDecimal baseSalaryAmount) { |
343 | 0 | this.baseSalaryAmount = baseSalaryAmount; |
344 | 0 | } |
345 | |
|
346 | |
public void setPrimary(boolean primary) { |
347 | 0 | this.primary = primary; |
348 | 0 | } |
349 | |
|
350 | |
public void setVersionNumber(Long versionNumber) { |
351 | 0 | this.versionNumber = versionNumber; |
352 | 0 | } |
353 | |
|
354 | |
public void setObjectId(String objectId) { |
355 | 0 | this.objectId = objectId; |
356 | 0 | } |
357 | |
|
358 | |
public void setActive(boolean active) { |
359 | 0 | this.active = active; |
360 | 0 | } |
361 | |
|
362 | |
public void setId(String id) { |
363 | 0 | if (StringUtils.isWhitespace(id)) { |
364 | 0 | throw new IllegalArgumentException("id is blank"); |
365 | |
} |
366 | 0 | this.id = id; |
367 | 0 | } |
368 | |
|
369 | |
} |
370 | |
|
371 | |
|
372 | |
|
373 | |
|
374 | |
|
375 | |
|
376 | 0 | static class Constants { |
377 | |
|
378 | |
final static String ROOT_ELEMENT_NAME = "entityEmployment"; |
379 | |
final static String TYPE_NAME = "EntityEmploymentType"; |
380 | |
} |
381 | |
|
382 | |
|
383 | |
|
384 | |
|
385 | |
|
386 | |
|
387 | 0 | static class Elements { |
388 | |
|
389 | |
final static String ENTITY_AFFILIATION = "entityAffiliation"; |
390 | |
final static String EMPLOYEE_STATUS = "employeeStatus"; |
391 | |
final static String EMPLOYEE_TYPE = "employeeType"; |
392 | |
final static String PRIMARY_DEPARTMENT_CODE = "primaryDepartmentCode"; |
393 | |
final static String EMPLOYEE_ID = "employeeId"; |
394 | |
final static String EMPLOYMENT_RECORD_ID = "employmentRecordId"; |
395 | |
final static String BASE_SALARY_AMOUNT = "baseSalaryAmount"; |
396 | |
final static String PRIMARY = "primary"; |
397 | |
final static String ACTIVE = "active"; |
398 | |
final static String ENTITY_ID = "entityId"; |
399 | |
final static String ID = "id"; |
400 | |
|
401 | |
} |
402 | |
|
403 | |
} |