Coverage Report - org.kuali.rice.kim.impl.identity.principal.PrincipalBo
 
Classes in this File Line Coverage Branch Coverage Complexity
PrincipalBo
100%
13/13
50%
2/4
0
 
 1  
 package org.kuali.rice.kim.impl.identity.principal
 2  
 
 3  
 import javax.persistence.Entity
 4  
 import javax.persistence.Table
 5  
 import javax.persistence.Id
 6  
 import javax.persistence.Column
 7  
 import org.hibernate.annotations.Type
 8  
 import org.kuali.rice.kim.api.identity.principal.PrincipalContract
 9  
 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase
 10  
 import org.kuali.rice.kim.api.identity.principal.Principal
 11  
 
 12  
 /**
 13  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 14  
  */
 15  
 @Entity
 16  
 @Table(name="KRIM_PRNCPL_T")
 17  
 class PrincipalBo extends PersistableBusinessObjectBase implements PrincipalContract {
 18  
     private static final long serialVersionUID = 4480581610252159267L;
 19  
 
 20  
         @Id
 21  
         @Column(name="PRNCPL_ID", columnDefinition="VARCHAR(40)")
 22  
         String principalId;
 23  
 
 24  
         @Column(name="PRNCPL_NM")
 25  
         String principalName;
 26  
 
 27  
         @Column(name="ENTITY_ID")
 28  
         String entityId;
 29  
 
 30  
         @Column(name="PRNCPL_PSWD")
 31  
         String password;
 32  
 
 33  
         @Column(name="ACTV_IND")
 34  
         @Type(type="yes_no")
 35  
         boolean active;
 36  
     
 37  
      /*
 38  
    * Converts a mutable PrincipalBo to an immutable Principal representation.
 39  
    * @param bo
 40  
    * @return an immutable Principal
 41  
    */
 42  
   static Principal to(PrincipalBo bo) {
 43  1
     if (bo == null) { return null }
 44  1
     return Principal.Builder.create(bo).build()
 45  
   }
 46  
 
 47  
   /**
 48  
    * Creates a PrincipalBo business object from an immutable representation of a Principal.
 49  
    * @param an immutable Principal
 50  
    * @return a PrincipalBo
 51  
    */
 52  
   static PrincipalBo from(Principal immutable) {
 53  1
     if (immutable == null) {return null}
 54  
 
 55  1
     PrincipalBo bo = new PrincipalBo()
 56  1
     bo.active = immutable.active
 57  1
     bo.principalId = immutable.principalId
 58  1
     bo.entityId = immutable.entityId
 59  1
     bo.principalName = immutable.principalName
 60  1
     bo.password = immutable.password
 61  1
     bo.active = immutable.active
 62  1
     bo.versionNumber = immutable.versionNumber
 63  1
     bo.objectId = immutable.objectId
 64  
 
 65  1
     return bo;
 66  
   }
 67  
 }