Coverage Report - org.kuali.rice.kim.impl.type.KimTypeBo
 
Classes in this File Line Coverage Branch Coverage Complexity
KimTypeBo
86%
13/15
50%
3/6
0
KimTypeBo$_from_closure1
0%
0/1
N/A
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.kim.impl.type
 18  
 
 19  
 import org.kuali.rice.kim.api.type.KimType
 20  
 import org.kuali.rice.kim.api.type.KimTypeContract
 21  
 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase
 22  
 
 23  
 class KimTypeBo extends PersistableBusinessObjectBase implements KimTypeContract {
 24  
     String id
 25  
     String serviceName
 26  
     String namespaceCode
 27  
     String name
 28  
     List<KimTypeAttributeBo> attributeDefinitions
 29  
     boolean active
 30  
 
 31  
     /**
 32  
      * Converts a mutable bo to its immutable counterpart
 33  
      * @param bo the mutable business object
 34  
      * @return the immutable object
 35  
      */
 36  
     static KimType to(KimTypeBo bo) {
 37  14
         if (bo == null) {
 38  0
             return null
 39  
         }
 40  
 
 41  14
         return KimType.Builder.create(bo).build();
 42  
     }
 43  
 
 44  
     /**
 45  
      * Converts a immutable object to its mutable counterpart
 46  
      * @param im immutable object
 47  
      * @return the mutable bo
 48  
      */
 49  
     static KimTypeBo from(KimType im) {
 50  8
         if (im == null) {
 51  0
             return null
 52  
         }
 53  
 
 54  8
         KimTypeBo bo = new KimTypeBo()
 55  8
         bo.id = im.id
 56  8
         bo.serviceName = im.serviceName
 57  8
         bo.namespaceCode = im.namespaceCode
 58  8
         bo.name = im.name
 59  8
         bo.attributeDefinitions = im.attributeDefinitions != null ? im.attributeDefinitions.collect { KimTypeAttributeBo.from(it) } : new ArrayList()
 60  8
         bo.active = im.active
 61  8
         bo.versionNumber = im.versionNumber
 62  8
         bo.objectId = im.objectId
 63  
 
 64  8
         return bo
 65  
     }
 66  
 }