Coverage Report - org.kuali.rice.shareddata.impl.campus.CampusBo
 
Classes in this File Line Coverage Branch Coverage Complexity
CampusBo
93%
14/15
66%
4/6
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  
 package org.kuali.rice.shareddata.impl.campus
 18  
 
 19  
 import javax.persistence.Column
 20  
 import javax.persistence.Entity
 21  
 import javax.persistence.FetchType
 22  
 import javax.persistence.Id
 23  
 import javax.persistence.JoinColumn
 24  
 import javax.persistence.OneToOne
 25  
 import javax.persistence.Table
 26  
 import org.hibernate.annotations.Type
 27  
 import org.kuali.rice.kns.bo.Inactivateable
 28  
 import org.kuali.rice.kns.bo.PersistableBusinessObjectBase
 29  
 import org.kuali.rice.shareddata.api.campus.CampusContract
 30  
 
 31  
 @Entity
 32  
 @Table(name="KRLC_CMP_T")
 33  
 public class CampusBo extends PersistableBusinessObjectBase implements Inactivateable, CampusContract {
 34  
         private static final long serialVersionUID = 787567094298971223L;
 35  
         @Id
 36  
         @Column(name="CAMPUS_CD")
 37  
         def String code;
 38  
         
 39  
         @Column(name="CAMPUS_NM")
 40  
         def String name;
 41  
         
 42  
         @Column(name="CAMPUS_SHRT_NM")
 43  
         def String shortName;
 44  
         
 45  
         @Column(name="CAMPUS_TYP_CD")
 46  
         def String campusTypeCode;
 47  
         
 48  
         @Type(type="yes_no")
 49  
         @Column(name="ACTV_IND")
 50  
         def boolean active; 
 51  
 
 52  
         @OneToOne(fetch=FetchType.EAGER)
 53  
         @JoinColumn(name="CAMPUS_TYP_CD", insertable=false, updatable=false)
 54  
         def CampusTypeBo campusType;
 55  
         
 56  
         /**
 57  
         * Converts a mutable bo to its immutable counterpart
 58  
         * @param bo the mutable business object
 59  
         * @return the immutable object
 60  
         */
 61  
    static org.kuali.rice.shareddata.api.campus.Campus to(CampusBo bo) {
 62  9
            if (bo == null) { return null }
 63  8
            return org.kuali.rice.shareddata.api.campus.Campus.Builder.create(bo).build();
 64  
    }
 65  
 
 66  
    /**
 67  
         * Converts a immutable object to its mutable counterpart
 68  
         * @param im immutable object
 69  
         * @return the mutable bo
 70  
         */
 71  
    static CampusBo from(org.kuali.rice.shareddata.api.campus.Campus im) {
 72  1
            if (im == null) { return null }
 73  
 
 74  1
            CampusBo bo = new CampusBo()
 75  1
            bo.code = im.code
 76  1
            bo.name = im.name
 77  1
            bo.shortName = im.shortName
 78  1
            bo.active = im.active
 79  1
            if (im.campusType != null) {
 80  0
                    bo.campusTypeCode = im.campusType.code
 81  
            }
 82  1
            bo.campusType = CampusTypeBo.from(im.campusType)
 83  1
        bo.versionNumber = im.versionNumber
 84  1
            bo.objectId = im.objectId
 85  
 
 86  1
            return bo
 87  
    }
 88  
    
 89  
    @Override
 90  
    CampusTypeBo getCampusType() {
 91  8
            return campusType
 92  
    }
 93  
 }