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 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.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  
 
 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.core.api.mo.common.active.MutableInactivatable
 33  
 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase
 34  
 
 35  
 @IdClass(ComponentId.class)
 36  
 @Entity
 37  
 @Table(name="KRCR_CMPNT_T")
 38  
 public class ComponentBo extends PersistableBusinessObjectBase implements ComponentContract, MutableInactivatable {
 39  
 
 40  
     private static final long serialVersionUID = 1L;
 41  
 
 42  
         @Id
 43  
         @Column(name="NMSPC_CD")
 44  
         String namespaceCode;
 45  
 
 46  
         @Id
 47  
         @Column(name="CMPNT_CD")
 48  
         String code;
 49  
 
 50  
         @Column(name="NM")
 51  
         String name;
 52  
 
 53  
         @Type(type="yes_no")
 54  
         @Column(name="ACTV_IND")
 55  
         boolean active = true;
 56  
 
 57  
         @ManyToOne(fetch=FetchType.LAZY)
 58  
         @JoinColumn(name="NMSPC_CD", insertable=false, updatable=false)
 59  
         NamespaceBo namespace;
 60  
 
 61  
     @Override
 62  
     String getComponentSetId() {
 63  0
         return null;
 64  
     }
 65  
 
 66  
     /**
 67  
      * Converts a mutable bo to its immutable counterpart
 68  
      * @param bo the mutable business object
 69  
      * @return the immutable object
 70  
      */
 71  
     static Component to(ComponentBo bo) {
 72  0
         if (bo == null) {
 73  0
             return null
 74  
         }
 75  
 
 76  0
         return Component.Builder.create(bo).build();
 77  
     }
 78  
 
 79  
     /**
 80  
      * Converts a immutable object to its mutable counterpart
 81  
      * @param im immutable object
 82  
      * @return the mutable bo
 83  
      */
 84  
     static ComponentBo from(Component im) {
 85  0
         if (im == null) {
 86  0
             return null
 87  
         }
 88  
 
 89  0
         ComponentBo bo = new ComponentBo()
 90  0
         bo.code = im.code
 91  0
         bo.name = im.name
 92  0
         bo.active = im.active
 93  0
         bo.namespaceCode = im.namespaceCode
 94  0
                 bo.versionNumber = im.versionNumber
 95  0
                 bo.objectId = im.objectId
 96  
 
 97  0
         return bo;
 98  
     }
 99  
 }
 100