Coverage Report - org.kuali.rice.krms.impl.repository.CategoryBo
 
Classes in this File Line Coverage Branch Coverage Complexity
CategoryBo
0%
0/20
0%
0/20
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.krms.impl.repository
 17  
 
 18  
 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase
 19  
 import org.kuali.rice.krms.api.repository.category.CategoryDefinitionContract
 20  
 import org.kuali.rice.krms.api.repository.category.CategoryDefinition
 21  
 
 22  
 class CategoryBo extends PersistableBusinessObjectBase implements CategoryDefinitionContract {
 23  
 
 24  
     def String id
 25  
     def String name
 26  
     def String namespace
 27  
 
 28  
         /**
 29  
         * Converts a mutable bo to it's immutable counterpart
 30  
         * @param bo the mutable business object
 31  
         * @return the immutable object
 32  
         */
 33  
     static CategoryDefinition to(CategoryBo bo) {
 34  0
         if (bo == null) { return null }
 35  
 
 36  0
         return org.kuali.rice.krms.api.repository.category.CategoryDefinition.Builder.create(bo).build()
 37  
     }
 38  
 
 39  
         /**
 40  
         * Converts a list of mutable bos to it's immutable counterpart
 41  
         * @param bos the list of mutable business objects
 42  
         * @return and immutable list containing the immutable objects
 43  
         */
 44  
    static List<CategoryDefinition> to(List<CategoryBo> bos) {
 45  0
            if (bos == null) { return null }
 46  
 
 47  0
            List<CategoryDefinition> categories = new ArrayList<CategoryDefinition>();
 48  0
            for (CategoryBo p : bos){
 49  0
                    categories.add(CategoryDefinition.Builder.create(p).build())
 50  
            }
 51  0
            return Collections.unmodifiableList(categories)
 52  
    }
 53  
 
 54  
    /**
 55  
         * Converts a immutable object to it's mutable bo counterpart
 56  
         * @param im immutable object
 57  
         * @return the mutable bo
 58  
         */
 59  
    static CategoryBo from(CategoryDefinition im) {
 60  0
            if (im == null) { return null }
 61  
 
 62  0
            CategoryBo bo = new CategoryBo()
 63  0
            bo.id = im.id
 64  0
            bo.name = im.name
 65  0
            bo.namespace = im.namespace
 66  0
            bo.versionNumber = im.versionNumber
 67  0
            return bo
 68  
    }
 69  
 
 70  
    static List<CategoryBo> from(List<CategoryDefinition> ims){
 71  0
            if (ims == null) {return null }
 72  
 
 73  0
            List<CategoryBo> bos = new ArrayList<CategoryBo>();
 74  0
            for (CategoryBo im : ims){
 75  0
                    CategoryBo bo = from(im)
 76  0
                       bos.add(bo);
 77  
            }
 78  0
            return Collections.unmodifiableList(bos)
 79  
    }
 80  
 }