Coverage Report - org.kuali.rice.kim.impl.permission.PermissionTemplateBo
 
Classes in this File Line Coverage Branch Coverage Complexity
PermissionTemplateBo
86%
13/15
50%
2/4
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.permission
 18  
 
 19  
 import javax.persistence.Column
 20  
 import javax.persistence.Entity
 21  
 import javax.persistence.Id
 22  
 import javax.persistence.Table
 23  
 import org.kuali.rice.kim.api.common.template.Template
 24  
 import org.kuali.rice.kim.api.common.template.TemplateContract
 25  
 import org.kuali.rice.kim.impl.common.template.TemplateBo
 26  
 
 27  
 @Entity
 28  
 @Table(name="KRIM_PERM_TMPL_T")
 29  
 public class PermissionTemplateBo extends TemplateBo implements TemplateContract {
 30  
     private static final long serialVersionUID = 1L;
 31  
 
 32  
     @Id
 33  
         @Column(name="PERM_TMPL_ID")
 34  
         String id
 35  
 
 36  
     /**
 37  
      * Converts a mutable bo to its immutable counterpart
 38  
      * @param bo the mutable business object
 39  
      * @return the immutable object
 40  
      */
 41  
     static Template to(PermissionTemplateBo bo) {
 42  1
         if (bo == null) {
 43  0
             return null
 44  
         }
 45  
 
 46  1
         return Template.Builder.create(bo).build();
 47  
     }
 48  
 
 49  
     /**
 50  
      * Converts a immutable object to its mutable counterpart
 51  
      * @param im immutable object
 52  
      * @return the mutable bo
 53  
      */
 54  
     static PermissionTemplateBo from(Template im) {
 55  2
         if (im == null) {
 56  0
             return null
 57  
         }
 58  
 
 59  2
         PermissionTemplateBo bo = new PermissionTemplateBo()
 60  2
         bo.id = im.id
 61  2
         bo.namespaceCode = im.namespaceCode
 62  2
         bo.name = im.name
 63  2
         bo.description = im.description
 64  2
         bo.active = im.active
 65  2
         bo.kimTypeId = im.kimTypeId
 66  2
         bo.versionNumber = im.versionNumber
 67  2
                 bo.objectId = im.objectId;
 68  
 
 69  2
         return bo
 70  
     }
 71  
 
 72  
 }