Coverage Report - org.kuali.rice.core.impl.component.DerivedComponentBo
 
Classes in this File Line Coverage Branch Coverage Complexity
DerivedComponentBo
0%
0/18
0%
0/6
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.Id
 22  
 import javax.persistence.IdClass
 23  
 import javax.persistence.Table
 24  
 import org.kuali.rice.core.api.component.Component
 25  
 import org.kuali.rice.core.api.component.ComponentContract
 26  
 import org.kuali.rice.krad.bo.BusinessObject
 27  
 import org.kuali.rice.krad.bo.PersistableBusinessObject
 28  
 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase
 29  
 
 30  
 @IdClass(ComponentId.class)
 31  
 @Entity
 32  
 @Table(name="KRCR_DRVD_CMPNT_T")
 33  
 public class DerivedComponentBo extends PersistableBusinessObjectBase implements ComponentContract {
 34  
 
 35  
         @Id
 36  
         @Column(name="NMSPC_CD")
 37  
         String namespaceCode
 38  
 
 39  
         @Id
 40  
         @Column(name="CMPNT_CD")
 41  
         String code
 42  
 
 43  
         @Column(name="NM")
 44  
         String name
 45  
 
 46  
     @Column(name="CMPNT_SET_ID")
 47  
     String componentSetId
 48  
 
 49  
     @Override
 50  
     String getObjectId() {
 51  0
         return null
 52  
     }
 53  
 
 54  
     @Override
 55  
     boolean isActive() {
 56  0
         return true
 57  
     }
 58  
 
 59  
     @Override
 60  
     Long getVersionNumber() {
 61  0
         return null
 62  
     }
 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(DerivedComponentBo bo) {
 70  0
         if (bo == null) {
 71  0
             return null
 72  
         }
 73  0
         return Component.Builder.create(bo).build()
 74  
     }
 75  
 
 76  
     /**
 77  
      * Converts a immutable object to its mutable counterpart
 78  
      * @param im immutable object
 79  
      * @return the mutable bo
 80  
      */
 81  
     static DerivedComponentBo from(Component im) {
 82  0
         if (im == null) {
 83  0
             return null
 84  
         }
 85  
 
 86  0
         DerivedComponentBo bo = new DerivedComponentBo()
 87  0
         bo.code = im.code
 88  0
         bo.name = im.name
 89  0
         bo.namespaceCode = im.namespaceCode
 90  0
                 bo.componentSetId = im.componentSetId
 91  
 
 92  0
         return bo
 93  
     }
 94  
 
 95  
     static ComponentBo toComponentBo(DerivedComponentBo derivedComponentBo) {
 96  0
         if (derivedComponentBo == null) {
 97  0
             return null
 98  
         }
 99  0
         Component component = DerivedComponentBo.to(derivedComponentBo);
 100  0
         return ComponentBo.from(component);
 101  
     }
 102  
 }
 103