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