Coverage Report - org.kuali.rice.krms.impl.repository.CategoryBo
 
Classes in this File Line Coverage Branch Coverage Complexity
CategoryBo
30%
6/20
5%
1/20
0
 
 1  
 package org.kuali.rice.krms.impl.repository
 2  
 
 3  
 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase
 4  
 import org.kuali.rice.krms.api.repository.category.CategoryDefinitionContract
 5  
 import org.kuali.rice.krms.api.repository.category.CategoryDefinition
 6  
 
 7  
 class CategoryBo extends PersistableBusinessObjectBase implements CategoryDefinitionContract {
 8  
 
 9  
     def String id
 10  
     def String name
 11  
     def String namespace
 12  
 
 13  
         /**
 14  
         * Converts a mutable bo to it's immutable counterpart
 15  
         * @param bo the mutable business object
 16  
         * @return the immutable object
 17  
         */
 18  
     static CategoryDefinition to(CategoryBo bo) {
 19  0
         if (bo == null) { return null }
 20  
 
 21  0
         return org.kuali.rice.krms.api.repository.category.CategoryDefinition.Builder.create(bo).build()
 22  
     }
 23  
 
 24  
         /**
 25  
         * Converts a list of mutable bos to it's immutable counterpart
 26  
         * @param bos the list of mutable business objects
 27  
         * @return and immutable list containing the immutable objects
 28  
         */
 29  
    static List<CategoryDefinition> to(List<CategoryBo> bos) {
 30  0
            if (bos == null) { return null }
 31  
 
 32  0
            List<CategoryDefinition> categories = new ArrayList<CategoryDefinition>();
 33  0
            for (CategoryBo p : bos){
 34  0
                    categories.add(CategoryDefinition.Builder.create(p).build())
 35  
            }
 36  0
            return Collections.unmodifiableList(categories)
 37  
    }
 38  
 
 39  
    /**
 40  
         * Converts a immutable object to it's mutable bo counterpart
 41  
         * @param im immutable object
 42  
         * @return the mutable bo
 43  
         */
 44  
    static CategoryBo from(CategoryDefinition im) {
 45  0
            if (im == null) { return null }
 46  
 
 47  15
            CategoryBo bo = new CategoryBo()
 48  15
            bo.id = im.id
 49  15
            bo.name = im.name
 50  15
            bo.namespace = im.namespace
 51  15
            bo.versionNumber = im.versionNumber
 52  15
            return bo
 53  
    }
 54  
 
 55  
    static List<CategoryBo> from(List<CategoryDefinition> ims){
 56  0
            if (ims == null) {return null }
 57  
 
 58  0
            List<CategoryBo> bos = new ArrayList<CategoryBo>();
 59  0
            for (CategoryBo im : ims){
 60  0
                    CategoryBo bo = from(im)
 61  0
                       bos.add(bo);
 62  
            }
 63  0
            return Collections.unmodifiableList(bos)
 64  
    }
 65  
 }