Coverage Report - org.kuali.rice.kim.impl.identity.principal.PrincipalBo
 
Classes in this File Line Coverage Branch Coverage Complexity
PrincipalBo
0%
0/13
0%
0/8
0
 
 1  
 /**
 2  
  * Copyright 2005-2011 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  * http://www.opensource.org/licenses/ecl2.php
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.kuali.rice.kim.impl.identity.principal
 17  
 
 18  
 import javax.persistence.Entity
 19  
 import javax.persistence.Table
 20  
 import javax.persistence.Id
 21  
 import javax.persistence.Column
 22  
 import org.hibernate.annotations.Type
 23  
 import org.kuali.rice.kim.api.identity.principal.PrincipalContract
 24  
 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase
 25  
 import org.kuali.rice.kim.api.identity.principal.Principal
 26  
 
 27  
 /**
 28  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 29  
  */
 30  
 @Entity
 31  
 @Table(name="KRIM_PRNCPL_T")
 32  
 class PrincipalBo extends PersistableBusinessObjectBase implements PrincipalContract {
 33  
     private static final long serialVersionUID = 4480581610252159267L;
 34  
 
 35  
         @Id
 36  
         @Column(name="PRNCPL_ID", columnDefinition="VARCHAR(40)")
 37  
         String principalId;
 38  
 
 39  
         @Column(name="PRNCPL_NM")
 40  
         String principalName;
 41  
 
 42  
         @Column(name="ENTITY_ID")
 43  
         String entityId;
 44  
 
 45  
         @Column(name="PRNCPL_PSWD")
 46  
         String password;
 47  
 
 48  
         @Column(name="ACTV_IND")
 49  
         @Type(type="yes_no")
 50  
         boolean active;
 51  
     
 52  
      /*
 53  
    * Converts a mutable PrincipalBo to an immutable Principal representation.
 54  
    * @param bo
 55  
    * @return an immutable Principal
 56  
    */
 57  
   static Principal to(PrincipalBo bo) {
 58  0
     if (bo == null) { return null }
 59  0
     return Principal.Builder.create(bo).build()
 60  
   }
 61  
 
 62  
   /**
 63  
    * Creates a PrincipalBo business object from an immutable representation of a Principal.
 64  
    * @param an immutable Principal
 65  
    * @return a PrincipalBo
 66  
    */
 67  
   static PrincipalBo from(Principal immutable) {
 68  0
     if (immutable == null) {return null}
 69  
 
 70  0
     PrincipalBo bo = new PrincipalBo()
 71  0
     bo.active = immutable.active
 72  0
     bo.principalId = immutable.principalId
 73  0
     bo.entityId = immutable.entityId
 74  0
     bo.principalName = immutable.principalName
 75  0
     bo.password = immutable.password
 76  0
     bo.active = immutable.active
 77  0
     bo.versionNumber = immutable.versionNumber
 78  0
     bo.objectId = immutable.objectId
 79  
 
 80  0
     return bo;
 81  
   }
 82  
 }