Coverage Report - org.kuali.rice.kim.impl.permission.PermissionAttributeBo
 
Classes in this File Line Coverage Branch Coverage Complexity
PermissionAttributeBo
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.Table
 22  
 import org.kuali.rice.kim.api.common.attribute.KimAttributeData
 23  
 import org.kuali.rice.kim.api.common.attribute.KimAttributeDataContract
 24  
 import org.kuali.rice.kim.impl.common.attribute.KimAttributeBo
 25  
 import org.kuali.rice.kim.impl.common.attribute.KimAttributeDataBo
 26  
 
 27  
 /**
 28  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 29  
  */
 30  
 @Entity
 31  
 @Table(name="KRIM_PERM_ATTR_DATA_T")
 32  
 public class PermissionAttributeBo extends KimAttributeDataBo implements KimAttributeDataContract {
 33  
    
 34  
     @Column(name="PERM_ID")
 35  
     String assignedToId;
 36  
 
 37  
     /**
 38  
      * Converts a mutable bo to its immutable counterpart
 39  
      * @param bo the mutable business object
 40  
      * @return the immutable object
 41  
      */
 42  
     static KimAttributeData to(PermissionAttributeBo bo) {
 43  1
         if (bo == null) {
 44  0
             return null
 45  
         }
 46  
 
 47  1
         return KimAttributeData.Builder.create(bo).build();
 48  
     }
 49  
 
 50  
     /**
 51  
      * Converts a immutable object to its mutable counterpart
 52  
      * @param im immutable object
 53  
      * @return the mutable bo
 54  
      */
 55  
     static PermissionAttributeBo from(KimAttributeData im) {
 56  1
         if (im == null) {
 57  0
             return null
 58  
         }
 59  
 
 60  1
         PermissionAttributeBo bo = new PermissionAttributeBo()
 61  1
         bo.id = im.id
 62  1
         bo.assignedToId = im.assignedToId
 63  1
         bo.kimAttribute = KimAttributeBo.from(im.kimAttribute)
 64  1
         bo.kimAttributeId = im.kimAttribute?.id
 65  1
         bo.attributeValue = bo.attributeValue
 66  1
         bo.kimTypeId = im.kimTypeId
 67  1
         bo.versionNumber = im.versionNumber
 68  1
                 bo.objectId = im.objectId;
 69  
 
 70  1
         return bo
 71  
     }
 72  
 }