Coverage Report - org.kuali.rice.kim.impl.group.GroupMemberBo
 
Classes in this File Line Coverage Branch Coverage Complexity
GroupMemberBo
73%
11/15
40%
8/20
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.group
 17  
 
 18  
 import javax.persistence.Column
 19  
 import javax.persistence.Entity
 20  
 import javax.persistence.GeneratedValue
 21  
 import javax.persistence.Id
 22  
 import javax.persistence.Table
 23  
 
 24  
 import org.hibernate.annotations.GenericGenerator
 25  
 import org.hibernate.annotations.Parameter
 26  
 import org.kuali.rice.kim.api.group.GroupMember
 27  
 import org.kuali.rice.kim.api.group.GroupMemberContract
 28  
 import org.kuali.rice.kim.impl.membership.AbstractMemberBo
 29  
 import java.sql.Timestamp
 30  
 import org.joda.time.DateTime
 31  
 
 32  
 @Entity
 33  
 @Table(name="KRIM_GRP_MBR_T")
 34  
 public class GroupMemberBo extends AbstractMemberBo implements GroupMemberContract {
 35  
     private static final long serialVersionUID = 1L;
 36  
 
 37  
     @Id
 38  
     @GeneratedValue(generator="KRIM_GRP_MBR_ID_S")
 39  
     @GenericGenerator(name="KRIM_GRP_MBR_ID_S",strategy="org.kuali.rice.core.framework.persistence.jpa.RiceNumericStringSequenceStyleGenerator",parameters=[
 40  
                         @Parameter(name="sequence_name",value="KRIM_GRP_MBR_ID_S"),
 41  
                         @Parameter(name="value_column",value="id")
 42  
                 ])
 43  
     @Column(name="GRP_MBR_ID")
 44  
         String id;
 45  
 
 46  
     @Column(name="GRP_ID")
 47  
         String groupId
 48  
 
 49  
     /**
 50  
      * Converts a mutable bo to its immutable counterpart
 51  
      * @param bo the mutable business object
 52  
      * @return the immutable object
 53  
      */
 54  
     static GroupMember to(GroupMemberBo bo) {
 55  1
         if (bo == null) {
 56  0
             return null
 57  
         }
 58  
 
 59  1
         return GroupMember.Builder.create(bo).build();
 60  
     }
 61  
 
 62  
     /**
 63  
      * Converts a immutable object to its mutable counterpart
 64  
      * @param im immutable object
 65  
      * @return the mutable bo
 66  
      */
 67  
     static GroupMemberBo from(GroupMember im) {
 68  1
         if (im == null) {
 69  0
             return null
 70  
         }
 71  
 
 72  1
         GroupMemberBo bo = new GroupMemberBo()
 73  1
         bo.id = im.id
 74  1
         bo.groupId = im.groupId
 75  1
         bo.memberId = im.memberId
 76  1
         bo.typeCode = im.type.code
 77  0
         bo.activeFromDateValue = im.activeFromDate == null ? null : new Timestamp(im.activeFromDate.getMillis());
 78  0
         bo.activeToDateValue = im.activeToDate == null ? null : new Timestamp(im.activeToDate.getMillis());
 79  1
         bo.versionNumber = im.versionNumber
 80  1
                 bo.objectId = im.objectId;
 81  
 
 82  1
         return bo
 83  
     }
 84  
 
 85  
 }