Coverage Report - org.kuali.rice.shareddata.impl.country.CountryBo
 
Classes in this File Line Coverage Branch Coverage Complexity
CountryBo
100%
11/11
75%
3/4
0
 
 1  
 /*
 2  
  * Copyright 2006-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  
 
 17  
 
 18  
 
 19  
 
 20  
 
 21  
 package org.kuali.rice.shareddata.impl.country
 22  
 
 23  
 import javax.persistence.Column
 24  
 import javax.persistence.Id
 25  
 import org.hibernate.annotations.Type
 26  
 import org.kuali.rice.kns.bo.ExternalizableBusinessObject
 27  
 import org.kuali.rice.kns.bo.Inactivateable
 28  
 import org.kuali.rice.kns.bo.PersistableBusinessObjectBase
 29  
 import org.kuali.rice.shareddata.api.country.Country
 30  
 import org.kuali.rice.shareddata.api.country.CountryContract
 31  
 import javax.persistence.Entity
 32  
 import javax.persistence.Table
 33  
 
 34  
 @Entity
 35  
 @Table(name="KRLC_CNTRY_T")
 36  
 class CountryBo extends PersistableBusinessObjectBase implements Inactivateable, CountryContract, ExternalizableBusinessObject {
 37  
 
 38  
   @Id
 39  
   @Column(name = "POSTAL_CNTRY_CD")
 40  
   def String code;
 41  
 
 42  
   @Column(name = "ALT_POSTAL_CNTRY_CD")
 43  
   def String alternateCode;
 44  
 
 45  
   @Column(name = "POSTAL_CNTRY_NM")
 46  
   def String name;
 47  
 
 48  
   @Type(type = "yes_no")
 49  
   @Column(name = "PSTL_CNTRY_RSTRC_IND")
 50  
   def boolean restricted;
 51  
 
 52  
   @Type(type = "yes_no")
 53  
   @Column(name = "ACTV_IND")
 54  
   def boolean active;
 55  
 
 56  
   /**
 57  
    * Converts a mutable CountryBo to an immutable Country representation.
 58  
    * @param bo
 59  
    * @return an immutable Country
 60  
    */
 61  
   static Country to(CountryBo bo) {
 62  11
     if (bo == null) { return null }
 63  7
     return Country.Builder.create(bo).build()
 64  
   }
 65  
 
 66  
   /**
 67  
    * Creates a CountryBo business object from an immutable representation of a Country.
 68  
    * @param an immutable Country
 69  
    * @return a CountryBo
 70  
    */
 71  
   static CountryBo from(Country immutable) {
 72  1
     if (immutable == null) {return null}
 73  
 
 74  1
     CountryBo bo = new CountryBo()
 75  1
     bo.code = immutable.code
 76  1
     bo.alternateCode = immutable.alternateCode
 77  1
     bo.name = immutable.name
 78  1
     bo.restricted = immutable.restricted
 79  1
     bo.active = immutable.active
 80  1
     bo.versionNumber = immutable.versionNumber
 81  
 
 82  1
     return bo;
 83  
   }
 84  
 }