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