1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kim.impl.identity.employment;
17
18 import javax.persistence.CascadeType;
19 import javax.persistence.Column;
20 import javax.persistence.Entity;
21 import javax.persistence.GeneratedValue;
22 import javax.persistence.Id;
23 import javax.persistence.JoinColumn;
24 import javax.persistence.ManyToOne;
25 import javax.persistence.Table;
26
27 import org.kuali.rice.kim.api.identity.employment.EntityEmployment;
28 import org.kuali.rice.kim.impl.identity.affiliation.EntityAffiliationBo;
29 import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator;
30
31 @Entity
32 @Table(name = "KRIM_ENTITY_EMP_INFO_T")
33 public class EntityEmploymentBo extends EntityEmploymentBase {
34
35 private static final long serialVersionUID = 1L;
36
37 @PortableSequenceGenerator(name = "KRIM_ENTITY_EMP_ID_S")
38 @GeneratedValue(generator = "KRIM_ENTITY_EMP_ID_S")
39 @Id
40 @Column(name = "ENTITY_EMP_ID")
41 private String id;
42
43 @ManyToOne(targetEntity = EntityEmploymentTypeBo.class, cascade = { CascadeType.REFRESH })
44 @JoinColumn(name = "EMP_TYP_CD", referencedColumnName = "EMP_TYP_CD", insertable = false, updatable = false)
45 private EntityEmploymentTypeBo employeeType;
46
47 @ManyToOne(targetEntity = EntityEmploymentStatusBo.class, cascade = { CascadeType.REFRESH })
48 @JoinColumn(name = "EMP_STAT_CD", referencedColumnName = "EMP_STAT_CD", insertable = false, updatable = false)
49 private EntityEmploymentStatusBo employeeStatus;
50
51 @ManyToOne(targetEntity = EntityAffiliationBo.class, cascade = { CascadeType.REFRESH })
52 @JoinColumn(name = "ENTITY_AFLTN_ID", referencedColumnName = "ENTITY_AFLTN_ID", insertable = false, updatable = false)
53 private EntityAffiliationBo entityAffiliation;
54
55 @Override
56 public EntityAffiliationBo getEntityAffiliation() {
57 return this.entityAffiliation;
58 }
59
60 @Override
61 public EntityEmploymentStatusBo getEmployeeStatus() {
62 return this.employeeStatus;
63 }
64
65 @Override
66 public EntityEmploymentTypeBo getEmployeeType() {
67 return this.employeeType;
68 }
69
70 public static EntityEmployment to(EntityEmploymentBo bo) {
71 if (bo == null) {
72 return null;
73 }
74 return EntityEmployment.Builder.create(bo).build();
75 }
76
77
78
79
80
81
82
83 public static EntityEmploymentBo from(EntityEmployment immutable) {
84 if (immutable == null) {
85 return null;
86 }
87 EntityEmploymentBo bo = new EntityEmploymentBo();
88 bo.id = immutable.getId();
89 bo.setActive(immutable.isActive());
90 bo.setEntityId(immutable.getEntityId());
91 if (immutable.getEmployeeType() != null) {
92 bo.setEmployeeTypeCode(immutable.getEmployeeType().getCode());
93 bo.setEmployeeType(EntityEmploymentTypeBo.from(immutable.getEmployeeType()));
94 }
95 if (immutable.getEmployeeStatus() != null) {
96 bo.setEmployeeStatusCode(immutable.getEmployeeStatus().getCode());
97 bo.setEmployeeStatus(EntityEmploymentStatusBo.from(immutable.getEmployeeStatus()));
98 }
99 if (immutable.getEntityAffiliation() != null) {
100 bo.setEntityAffiliationId(immutable.getEntityAffiliation().getId());
101 bo.setEntityAffiliation(EntityAffiliationBo.from(immutable.getEntityAffiliation()));
102 }
103 bo.setPrimaryDepartmentCode(immutable.getPrimaryDepartmentCode());
104 bo.setEmployeeId(immutable.getEmployeeId());
105 bo.setEmploymentRecordId(immutable.getEmploymentRecordId());
106 bo.setBaseSalaryAmount(immutable.getBaseSalaryAmount());
107 bo.setPrimary(immutable.isPrimary());
108 bo.setVersionNumber(immutable.getVersionNumber());
109 bo.setObjectId(immutable.getObjectId());
110 return bo;
111 }
112
113 @Override
114 public String getId() {
115 return id;
116 }
117
118 public void setId(String id) {
119 this.id = id;
120 }
121
122 public void setEmployeeType(EntityEmploymentTypeBo employeeType) {
123 this.employeeType = employeeType;
124 }
125
126 public void setEmployeeStatus(EntityEmploymentStatusBo employeeStatus) {
127 this.employeeStatus = employeeStatus;
128 }
129
130 public void setEntityAffiliation(EntityAffiliationBo entityAffiliation) {
131 this.entityAffiliation = entityAffiliation;
132 }
133 }