Coverage Report - org.kuali.rice.kim.impl.identity.affiliation.EntityAffiliationBo
 
Classes in this File Line Coverage Branch Coverage Complexity
EntityAffiliationBo
87%
14/16
50%
3/6
0
 
 1  
 package org.kuali.rice.kim.impl.identity.affiliation
 2  
 
 3  
 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase
 4  
 import org.kuali.rice.kim.api.identity.affiliation.EntityAffiliationContract
 5  
 import javax.persistence.Id
 6  
 import javax.persistence.Column
 7  
 import javax.persistence.ManyToOne
 8  
 import javax.persistence.JoinColumn
 9  
 import javax.persistence.FetchType
 10  
 import org.hibernate.annotations.Type
 11  
 import org.kuali.rice.kim.api.identity.affiliation.EntityAffiliation
 12  
 
 13  
 
 14  
 public class EntityAffiliationBo extends PersistableBusinessObjectBase implements EntityAffiliationContract {
 15  
     private static final long serialVersionUID = 1L;
 16  
 
 17  
         @Id
 18  
         @Column(name = "ENTITY_AFLTN_ID")
 19  
         String id;
 20  
 
 21  
         @Column(name = "ENTITY_ID")
 22  
         String entityId;
 23  
 
 24  
         @Column(name = "AFLTN_TYP_CD")
 25  
         String affiliationTypeCode;
 26  
 
 27  
         @Column(name = "CAMPUS_CD")
 28  
         String campusCode;
 29  
 
 30  
         @ManyToOne(targetEntity=EntityAffiliationTypeBo.class, fetch=FetchType.EAGER, cascade = [])
 31  
         @JoinColumn(name = "AFLTN_TYP_CD", insertable = false, updatable = false)
 32  
         EntityAffiliationTypeBo affiliationType;
 33  
 
 34  
     @Type(type="yes_no")
 35  
         @Column(name="DFLT_IND")
 36  
         boolean defaultValue;
 37  
 
 38  
     @Type(type="yes_no")
 39  
         @Column(name="ACTV_IND")
 40  
     boolean active;
 41  
 
 42  
   /*
 43  
    * Converts a mutable EntityAffiliationBo to an immutable EntityAffiliation representation.
 44  
    * @param bo
 45  
    * @return an immutable EntityAffiliation
 46  
    */
 47  
   static EntityAffiliation to(EntityAffiliationBo bo) {
 48  1
     if (bo == null) { return null }
 49  1
     return EntityAffiliation.Builder.create(bo).build()
 50  
   }
 51  
 
 52  
   /**
 53  
    * Creates a EntityAffiliationBo business object from an immutable representation of a EntityAffiliation.
 54  
    * @param an immutable EntityAffiliation
 55  
    * @return a EntityAffiliationBo
 56  
    */
 57  
   static EntityAffiliationBo from(EntityAffiliation immutable) {
 58  1
     if (immutable == null) {return null}
 59  
 
 60  1
     EntityAffiliationBo bo = new EntityAffiliationBo()
 61  1
     bo.active = immutable.active
 62  1
     if (immutable.affiliationType != null) {
 63  0
             bo.affiliationTypeCode = immutable.affiliationType.code
 64  0
         bo.affiliationType = EntityAffiliationTypeBo.from(immutable.affiliationType)
 65  
           }
 66  
 
 67  1
     bo.id = immutable.id
 68  1
     bo.campusCode = immutable.campusCode
 69  1
     bo.entityId = immutable.entityId
 70  1
     bo.active = immutable.active
 71  1
     bo.defaultValue = immutable.defaultValue
 72  1
     bo.versionNumber = immutable.versionNumber
 73  
 
 74  1
     return bo;
 75  
   }
 76  
 
 77  
 
 78  
     @Override
 79  
     EntityAffiliationTypeBo getAffiliationType() {
 80  1
         return this.affiliationType
 81  
     }
 82  
 
 83  
 }