Coverage Report - org.kuali.rice.kim.impl.identity.visa.EntityVisaBo
 
Classes in this File Line Coverage Branch Coverage Complexity
EntityVisaBo
83%
10/12
25%
2/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.visa
 17  
 
 18  
 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase
 19  
 import org.kuali.rice.kim.api.identity.visa.EntityVisaContract
 20  
 import javax.persistence.Id
 21  
 import javax.persistence.GeneratedValue
 22  
 import org.hibernate.annotations.GenericGenerator
 23  
 import org.hibernate.annotations.Parameter
 24  
 import javax.persistence.Column
 25  
 import org.kuali.rice.kim.api.identity.visa.EntityVisa
 26  
 import javax.persistence.Entity
 27  
 import javax.persistence.Table
 28  
 
 29  
 @Entity
 30  
 @Table(name = "KRIM_ENTITY_VISA_T")
 31  
 class EntityVisaBo extends PersistableBusinessObjectBase implements EntityVisaContract {
 32  
     @Id
 33  
     @GeneratedValue(generator="KRIM_ENTITY_VISA_ID_S")
 34  
     @GenericGenerator(name="KRIM_ENTITY_VISA_ID_S",strategy="org.kuali.rice.core.jpa.spring.RiceNumericStringSequenceStyleGenerator",parameters=[
 35  
             @Parameter(name="sequence_name",value="KRIM_ENTITY_VISA_ID_S"),
 36  
             @Parameter(name="value_column",value="id")
 37  
         ])
 38  
     @Column(name = "ID")
 39  
     String id;
 40  
 
 41  
     @Column(name = "ENTITY_ID")
 42  
     String entityId;
 43  
         
 44  
     @Column(name = "VISA_TYPE_KEY")
 45  
     String visaTypeKey;
 46  
         
 47  
     @Column(name = "VISA_ENTRY")
 48  
     String visaEntry;
 49  
         
 50  
     @Column(name = "VISA_ID")
 51  
     String visaId;
 52  
     
 53  
     /*
 54  
        * Converts a mutable EntityVisaBo to an immutable EntityVisa representation.
 55  
        * @param bo
 56  
        * @return an immutable EntityVisa
 57  
        */
 58  
       static EntityVisa to(EntityVisaBo bo) {
 59  0
         if (bo == null) { return null }
 60  1
         return EntityVisa.Builder.create(bo).build()
 61  
       }
 62  
 
 63  
       /**
 64  
        * Creates a EntityVisaBo business object from an immutable representation of a EntityVisa.
 65  
        * @param an immutable EntityVisa
 66  
        * @return a EntityVisaBo
 67  
        */
 68  
       static EntityVisaBo from(EntityVisa immutable) {
 69  0
         if (immutable == null) {return null}
 70  
 
 71  1
         EntityVisaBo bo = new EntityVisaBo()
 72  1
         bo.id = immutable.id
 73  1
         bo.entityId = immutable.entityId
 74  1
         bo.visaTypeKey = immutable.visaTypeKey
 75  1
         bo.visaEntry = immutable.visaEntry
 76  1
         bo.visaId = immutable.visaId
 77  1
         bo.versionNumber = immutable.versionNumber
 78  1
         bo.objectId = immutable.objectId
 79  
 
 80  1
         return bo;
 81  
       }
 82  
 }