| 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.Column |
| 19 | |
import javax.persistence.FetchType |
| 20 | |
import javax.persistence.Id |
| 21 | |
import javax.persistence.JoinColumn |
| 22 | |
import javax.persistence.ManyToOne |
| 23 | |
import org.hibernate.annotations.Type |
| 24 | |
import org.kuali.rice.core.api.util.type.KualiDecimal |
| 25 | |
import org.kuali.rice.kim.api.identity.employment.EntityEmployment |
| 26 | |
import org.kuali.rice.kim.api.identity.employment.EntityEmploymentContract |
| 27 | |
import org.kuali.rice.kim.impl.identity.affiliation.EntityAffiliationBo |
| 28 | |
import org.kuali.rice.krad.bo.PersistableBusinessObjectBase |
| 29 | |
|
| 30 | |
class EntityEmploymentBo extends PersistableBusinessObjectBase implements EntityEmploymentContract { |
| 31 | |
private static final long serialVersionUID = 1L; |
| 32 | |
|
| 33 | |
@Id |
| 34 | |
@Column(name = "ENTITY_EMP_ID") |
| 35 | |
String id; |
| 36 | |
|
| 37 | |
@Column(name = "ENTITY_ID") |
| 38 | |
String entityId; |
| 39 | |
|
| 40 | |
@Column(name = "EMP_ID") |
| 41 | |
String employeeId; |
| 42 | |
|
| 43 | |
@Column(name = "EMP_REC_ID") |
| 44 | |
String employmentRecordId; |
| 45 | |
|
| 46 | |
@Column(name = "ENTITY_AFLTN_ID") |
| 47 | |
String entityAffiliationId; |
| 48 | |
|
| 49 | |
@Column(name = "EMP_STAT_CD") |
| 50 | |
String employeeStatusCode; |
| 51 | |
|
| 52 | |
@Column(name = "EMP_TYP_CD") |
| 53 | |
String employeeTypeCode; |
| 54 | |
|
| 55 | |
@Column(name = "PRMRY_DEPT_CD") |
| 56 | |
String primaryDepartmentCode; |
| 57 | |
|
| 58 | |
@Type(type="rice_decimal") |
| 59 | |
@Column(name = "BASE_SLRY_AMT") |
| 60 | |
KualiDecimal baseSalaryAmount; |
| 61 | |
|
| 62 | |
@Type(type="yes_no") |
| 63 | |
@Column(name="PRMRY_IND") |
| 64 | |
boolean primary; |
| 65 | |
|
| 66 | |
@Type(type="yes_no") |
| 67 | |
@Column(name="ACTV_IND") |
| 68 | |
boolean active; |
| 69 | |
|
| 70 | |
@ManyToOne(targetEntity=EntityEmploymentTypeBo.class, fetch=FetchType.EAGER, cascade = []) |
| 71 | |
@JoinColumn(name="EMP_TYP_CD", insertable = false, updatable = false) |
| 72 | |
EntityEmploymentTypeBo employeeType; |
| 73 | |
|
| 74 | |
@ManyToOne(targetEntity=EntityEmploymentStatusBo.class, fetch = FetchType.EAGER, cascade = []) |
| 75 | |
@JoinColumn(name="EMP_STAT_CD", insertable = false, updatable = false) |
| 76 | |
EntityEmploymentStatusBo employeeStatus; |
| 77 | |
|
| 78 | |
@ManyToOne(targetEntity=EntityAffiliationBo.class, fetch = FetchType.EAGER, cascade = []) |
| 79 | |
@JoinColumn(name="ENTITY_AFLTN_ID", insertable = false, updatable = false) |
| 80 | |
EntityAffiliationBo entityAffiliation; |
| 81 | |
|
| 82 | |
@Override |
| 83 | |
public EntityAffiliationBo getEntityAffiliation() { |
| 84 | 1 | return this.entityAffiliation |
| 85 | |
} |
| 86 | |
|
| 87 | |
@Override |
| 88 | |
public EntityEmploymentStatusBo getEmployeeStatus() { |
| 89 | 1 | return this.employeeStatus |
| 90 | |
} |
| 91 | |
|
| 92 | |
@Override |
| 93 | |
public EntityEmploymentTypeBo getEmployeeType() { |
| 94 | 1 | return this.employeeType |
| 95 | |
} |
| 96 | |
|
| 97 | |
|
| 98 | |
|
| 99 | |
|
| 100 | |
|
| 101 | |
|
| 102 | |
static EntityEmployment to(EntityEmploymentBo bo) { |
| 103 | 0 | if (bo == null) { return null } |
| 104 | 1 | return EntityEmployment.Builder.create(bo).build() |
| 105 | |
} |
| 106 | |
|
| 107 | |
|
| 108 | |
|
| 109 | |
|
| 110 | |
|
| 111 | |
|
| 112 | |
static EntityEmploymentBo from(EntityEmployment immutable) { |
| 113 | 0 | if (immutable == null) {return null} |
| 114 | |
|
| 115 | 1 | EntityEmploymentBo bo = new EntityEmploymentBo() |
| 116 | 1 | bo.id = immutable.id |
| 117 | 1 | bo.active = immutable.active |
| 118 | |
|
| 119 | 1 | bo.entityId = immutable.entityId |
| 120 | 1 | if (immutable.employeeType != null) { |
| 121 | 0 | bo.employeeTypeCode = immutable.employeeType.code |
| 122 | 0 | bo.employeeType = EntityEmploymentTypeBo.from(immutable.employeeType) |
| 123 | |
} |
| 124 | 1 | if (immutable.employeeStatus != null) { |
| 125 | 0 | bo.employeeStatusCode = immutable.employeeStatus.code |
| 126 | 0 | bo.employeeStatus = EntityEmploymentStatusBo.from(immutable.employeeStatus) |
| 127 | |
} |
| 128 | 1 | if (immutable.getEntityAffiliation() != null) { |
| 129 | 0 | bo.entityAffiliationId = immutable.getEntityAffiliation().getId() |
| 130 | 0 | bo.entityAffiliation = EntityAffiliationBo.from(immutable.getEntityAffiliation()) |
| 131 | |
} |
| 132 | |
|
| 133 | 1 | bo.primaryDepartmentCode = immutable.primaryDepartmentCode |
| 134 | 1 | bo.employeeId = immutable.employeeId |
| 135 | 1 | bo.employmentRecordId = immutable.employmentRecordId |
| 136 | 1 | bo.baseSalaryAmount = immutable.getBaseSalaryAmount() |
| 137 | 1 | bo.primary = immutable.primary |
| 138 | |
|
| 139 | 1 | bo.versionNumber = immutable.versionNumber |
| 140 | 1 | bo.objectId = immutable.objectId |
| 141 | |
|
| 142 | 1 | return bo; |
| 143 | |
} |
| 144 | |
} |