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