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