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