Coverage Report - org.kuali.rice.kim.impl.role.RolePermissionBo
 
Classes in this File Line Coverage Branch Coverage Complexity
RolePermissionBo
0%
0/13
0%
0/4
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.kim.impl.role
 17  
 
 18  
 import javax.persistence.Column
 19  
 import javax.persistence.Entity
 20  
 import javax.persistence.FetchType
 21  
 import javax.persistence.Id
 22  
 import javax.persistence.JoinColumn;
 23  
 
 24  
 
 25  
 import javax.persistence.OneToOne;
 26  
 import javax.persistence.Table
 27  
 
 28  
 import org.hibernate.annotations.Type
 29  
 import org.kuali.rice.kim.api.role.RolePermission
 30  
 import org.kuali.rice.kim.api.role.RolePermissionContract
 31  
 import org.kuali.rice.kim.impl.permission.PermissionBo
 32  
 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase
 33  
 
 34  
 @Entity
 35  
 @Table(name="KRIM_ROLE_PERM_T")
 36  
 public class RolePermissionBo extends PersistableBusinessObjectBase implements RolePermissionContract {
 37  
     private static final long serialVersionUID = 1L;
 38  
 
 39  
     @Id
 40  
         @Column(name="ROLE_PERM_ID")
 41  
         String id
 42  
 
 43  
         @Column(name="ROLE_ID")
 44  
         String roleId;
 45  
         
 46  
         @Column(name="PERM_ID")
 47  
         String permissionId
 48  
         
 49  
         @Column(name="ACTV_IND")
 50  
         @Type(type="yes_no")
 51  
         boolean active
 52  
 
 53  
         @OneToOne(targetEntity=PermissionBo.class,cascade=[],fetch=FetchType.EAGER)
 54  
         @JoinColumn(name = "PERM_ID", insertable = false, updatable = false)
 55  
         PermissionBo permission;
 56  
                 
 57  
     /**
 58  
      * Converts a mutable bo to its immutable counterpart
 59  
      * @param bo the mutable business object
 60  
      * @return the immutable object
 61  
      */
 62  
     static RolePermission to(RolePermissionBo bo) {
 63  0
         if (bo == null) {
 64  0
             return null
 65  
         }
 66  
 
 67  0
         return RolePermission.Builder.create(bo).build();
 68  
     }
 69  
 
 70  
     /**
 71  
      * Converts a immutable object to its mutable counterpart
 72  
      * @param im immutable object
 73  
      * @return the mutable bo
 74  
      */
 75  
     static RolePermissionBo from(RolePermission im) {
 76  0
         if (im == null) {
 77  0
             return null
 78  
         }
 79  
 
 80  0
         RolePermissionBo bo = new RolePermissionBo()
 81  0
         bo.id = im.id
 82  0
                 bo.roleId = im.roleId
 83  0
                 bo.permissionId = im.permissionId
 84  0
                 bo.active = im.active
 85  0
         bo.versionNumber = im.versionNumber
 86  0
                 bo.objectId = im.objectId;
 87  
 
 88  0
         return bo
 89  
     }
 90  
 
 91  
 }