Coverage Report - org.kuali.rice.kim.impl.identity.employment.EntityEmploymentBo
 
Classes in this File Line Coverage Branch Coverage Complexity
EntityEmploymentBo
70%
19/27
42%
11/26
0
 
 1  
 package org.kuali.rice.kim.impl.identity.employment
 2  
 
 3  
 import javax.persistence.Column
 4  
 import javax.persistence.FetchType
 5  
 import javax.persistence.Id
 6  
 import javax.persistence.JoinColumn
 7  
 import javax.persistence.ManyToOne
 8  
 import org.hibernate.annotations.Type
 9  
 import org.kuali.rice.core.api.util.type.KualiDecimal
 10  
 import org.kuali.rice.kim.api.identity.employment.EntityEmployment
 11  
 import org.kuali.rice.kim.api.identity.employment.EntityEmploymentContract
 12  
 import org.kuali.rice.kim.impl.identity.affiliation.EntityAffiliationBo
 13  
 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase
 14  
 
 15  
 class EntityEmploymentBo extends PersistableBusinessObjectBase implements EntityEmploymentContract {
 16  
             private static final long serialVersionUID = 1L;
 17  
 
 18  
         @Id
 19  
         @Column(name = "ENTITY_EMP_ID")
 20  
         String id;
 21  
 
 22  
         @Column(name = "ENTITY_ID")
 23  
         String entityId;
 24  
 
 25  
         @Column(name = "EMP_ID")
 26  
         String employeeId;
 27  
 
 28  
         @Column(name = "EMP_REC_ID")
 29  
         String employmentRecordId;
 30  
 
 31  
         @Column(name = "ENTITY_AFLTN_ID")
 32  
         String entityAffiliationId;
 33  
 
 34  
         @Column(name = "EMP_STAT_CD")
 35  
         String employeeStatusCode;
 36  
 
 37  
         @Column(name = "EMP_TYP_CD")
 38  
         String employeeTypeCode;
 39  
 
 40  
         @Column(name = "PRMRY_DEPT_CD")
 41  
         String primaryDepartmentCode;
 42  
         
 43  
         @Type(type="rice_decimal")
 44  
         @Column(name = "BASE_SLRY_AMT")
 45  
         KualiDecimal baseSalaryAmount;
 46  
 
 47  
         @Type(type="yes_no")
 48  
         @Column(name="PRMRY_IND")
 49  
         boolean primary;
 50  
 
 51  
     @Type(type="yes_no")
 52  
     @Column(name="ACTV_IND")
 53  
     boolean active;
 54  
 
 55  
         @ManyToOne(targetEntity=EntityEmploymentTypeBo.class, fetch=FetchType.EAGER, cascade = [])
 56  
         @JoinColumn(name="EMP_TYP_CD", insertable = false, updatable = false)
 57  
         EntityEmploymentTypeBo employeeType;
 58  
 
 59  
         @ManyToOne(targetEntity=EntityEmploymentStatusBo.class, fetch = FetchType.EAGER, cascade = [])
 60  
         @JoinColumn(name="EMP_STAT_CD", insertable = false, updatable = false)
 61  
         EntityEmploymentStatusBo employeeStatus;
 62  
         
 63  
         @ManyToOne(targetEntity=EntityAffiliationBo.class, fetch = FetchType.EAGER, cascade = [])
 64  
         @JoinColumn(name="ENTITY_AFLTN_ID", insertable = false, updatable = false)
 65  
         EntityAffiliationBo entityAffiliation;
 66  
 
 67  
     @Override
 68  
     public EntityAffiliationBo getEntityAffiliation() {
 69  1
         return this.entityAffiliation
 70  
     }
 71  
 
 72  
     @Override
 73  
     public EntityEmploymentStatusBo getEmployeeStatus() {
 74  1
         return this.employeeStatus
 75  
     }
 76  
 
 77  
     @Override
 78  
     public EntityEmploymentTypeBo getEmployeeType() {
 79  1
         return this.employeeType
 80  
     }
 81  
 
 82  
       /*
 83  
        * Converts a mutable EntityEmploymentBo to an immutable EntityEmployment representation.
 84  
        * @param bo
 85  
        * @return an immutable EntityEmployment
 86  
        */
 87  
       static EntityEmployment to(EntityEmploymentBo bo) {
 88  0
         if (bo == null) { return null }
 89  1
         return EntityEmployment.Builder.create(bo).build()
 90  
       }
 91  
 
 92  
       /**
 93  
        * Creates a EntityEmploymentBo business object from an immutable representation of a EntityEmployment.
 94  
        * @param an immutable EntityEmployment
 95  
        * @return a EntityEmploymentBo
 96  
        */
 97  
       static EntityEmploymentBo from(EntityEmployment immutable) {
 98  0
         if (immutable == null) {return null}
 99  
 
 100  1
         EntityEmploymentBo bo = new EntityEmploymentBo()
 101  1
         bo.id = immutable.id
 102  1
         bo.active = immutable.active
 103  
 
 104  1
         bo.entityId = immutable.entityId
 105  1
         if (immutable.employeeType != null) {
 106  0
             bo.employeeTypeCode = immutable.employeeType.code
 107  0
             bo.employeeType = EntityEmploymentTypeBo.from(immutable.employeeType)
 108  
         }
 109  1
         if (immutable.employeeStatus != null) {
 110  0
             bo.employeeStatusCode = immutable.employeeStatus.code
 111  0
             bo.employeeStatus = EntityEmploymentStatusBo.from(immutable.employeeStatus)
 112  
         }
 113  1
         if (immutable.getEntityAffiliation() != null) {
 114  0
             bo.entityAffiliationId = immutable.getEntityAffiliation().getId()
 115  0
             bo.entityAffiliation = EntityAffiliationBo.from(immutable.getEntityAffiliation())
 116  
         }
 117  
 
 118  1
         bo.primaryDepartmentCode = immutable.primaryDepartmentCode
 119  1
         bo.employeeId = immutable.employeeId
 120  1
         bo.employmentRecordId = immutable.employmentRecordId
 121  1
         bo.baseSalaryAmount = immutable.getBaseSalaryAmount()
 122  1
         bo.primary = immutable.primary
 123  
 
 124  1
         bo.versionNumber = immutable.versionNumber
 125  1
         bo.objectId = immutable.objectId
 126  
 
 127  1
         return bo;
 128  
       }
 129  
 }