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