Coverage Report - org.kuali.rice.kew.impl.type.KewTypeBo
 
Classes in this File Line Coverage Branch Coverage Complexity
KewTypeBo
0%
0/19
0%
0/28
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.kew.impl.type
 17  
 
 18  
 import org.kuali.rice.kew.api.repository.type.KewTypeDefinitionContract
 19  
 import org.kuali.rice.core.api.mo.common.active.MutableInactivatable
 20  
 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase
 21  
 
 22  
 public class KewTypeBo extends PersistableBusinessObjectBase implements MutableInactivatable, KewTypeDefinitionContract {
 23  
 
 24  
         def String id
 25  
         def String name
 26  
         def String namespace
 27  
         def String serviceName
 28  
         def boolean active = true
 29  
         def List<KewTypeAttributeBo> attributes
 30  
 
 31  
     public List<KewTypeAttributeBo> getAttributes() {
 32  0
         if (attributes == null) attributes = new ArrayList<KewTypeAttributeBo>();
 33  0
         return attributes;
 34  
     }
 35  
 
 36  
     public String getQualifiedName() {
 37  0
         if ((name != null) && (namespace != null)) {
 38  0
             return name + " - " + namespace;
 39  
         }
 40  
 
 41  0
         return "";
 42  
     }
 43  
 
 44  
     /**
 45  
     * Converts a mutable bo to it's immutable counterpart
 46  
     * @param bo the mutable business object
 47  
     * @return the immutable object
 48  
     */
 49  
     static org.kuali.rice.kew.api.repository.type.KewTypeDefinition to(KewTypeBo bo) {
 50  0
         if (bo == null) { return null }
 51  0
         return org.kuali.rice.kew.api.repository.type.KewTypeDefinition.Builder.create(bo).build();
 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 KewTypeBo from(org.kuali.rice.kew.api.repository.type.KewTypeDefinition im) {
 60  0
         if (im == null) { return null }
 61  
 
 62  0
         KewTypeBo bo = new KewTypeBo()
 63  0
         bo.id = im.id
 64  0
         bo.name = im.name
 65  0
         bo.namespace = im.namespace
 66  0
         bo.serviceName = im.serviceName
 67  0
         bo.active = (im.active == null) ? true : im.active;
 68  0
         bo.attributes = new ArrayList<KewTypeAttributeBo>()
 69  0
         for( attr in im.attributes ){
 70  0
             bo.attributes.add(KewTypeAttributeBo.from(attr))
 71  
         }
 72  0
         bo.versionNumber = im.versionNumber
 73  0
         return bo
 74  
     }
 75  
 
 76  
 }