Coverage Report - org.kuali.rice.core.impl.component.ComponentBo
 
Classes in this File Line Coverage Branch Coverage Complexity
ComponentBo
0%
0/14
0%
0/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  
 package org.kuali.rice.core.impl.component;
 17  
 
 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.IdClass
 24  
 import javax.persistence.JoinColumn
 25  
 import javax.persistence.ManyToOne
 26  
 import javax.persistence.Table
 27  
 import javax.persistence.Transient
 28  
 import org.hibernate.annotations.Type
 29  
 import org.kuali.rice.core.api.component.Component
 30  
 import org.kuali.rice.core.api.component.ComponentContract
 31  
 import org.kuali.rice.core.impl.namespace.NamespaceBo
 32  
 import org.kuali.rice.kns.bo.Inactivateable
 33  
 import org.kuali.rice.kns.bo.PersistableBusinessObjectBase
 34  
 
 35  
 @IdClass(ComponentId.class)
 36  
 @Entity
 37  
 @Table(name="KRNS_PARM_DTL_TYP_T")
 38  
 public class ComponentBo extends PersistableBusinessObjectBase implements ComponentContract, Inactivateable {
 39  
 
 40  
     private static final long serialVersionUID = 1L;
 41  
 
 42  
         @Id
 43  
         @Column(name="NMSPC_CD")
 44  
         def String namespaceCode;
 45  
 
 46  
         @Id
 47  
         @Column(name="PARM_DTL_TYP_CD")
 48  
         def String code;
 49  
 
 50  
         @Column(name="NM")
 51  
         def String name;
 52  
 
 53  
         @Type(type="yes_no")
 54  
         @Column(name="ACTV_IND")
 55  
         def boolean active = true;
 56  
 
 57  
     @Transient
 58  
         def boolean virtual;
 59  
         
 60  
         @ManyToOne(fetch=FetchType.LAZY)
 61  
         @JoinColumn(name="NMSPC_CD", insertable=false, updatable=false)
 62  
         def NamespaceBo namespace;
 63  
 
 64  
    /**
 65  
      * Converts a mutable bo to its immutable counterpart
 66  
      * @param bo the mutable business object
 67  
      * @return the immutable object
 68  
      */
 69  
     static Component to(ComponentBo bo) {
 70  0
         if (bo == null) {
 71  0
             return null
 72  
         }
 73  
 
 74  0
         return Component.Builder.create(bo).build();
 75  
     }
 76  
 
 77  
     /**
 78  
      * Converts a immutable object to its mutable counterpart
 79  
      * @param im immutable object
 80  
      * @return the mutable bo
 81  
      */
 82  
     static ComponentBo from(Component im) {
 83  0
         if (im == null) {
 84  0
             return null
 85  
         }
 86  
 
 87  0
         ComponentBo bo = new ComponentBo()
 88  0
         bo.code = im.code
 89  0
         bo.name = im.name
 90  0
         bo.active = im.active
 91  0
         bo.namespaceCode = im.namespaceCode
 92  0
         bo.virtual = im.virtual
 93  0
                 bo.versionNumber = im.versionNumber
 94  0
                 bo.objectId = im.objectId
 95  
 
 96  0
         return bo;
 97  
     }
 98  
 }
 99