Coverage Report - org.kuali.rice.kim.bo.role.impl.KimDelegationMemberImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
KimDelegationMemberImpl
0%
0/42
0%
0/12
1.429
 
 1  
 /*
 2  
  * Copyright 2008 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.bo.role.impl;
 17  
 
 18  
 import java.sql.Timestamp;
 19  
 import java.util.LinkedHashMap;
 20  
 import java.util.List;
 21  
 
 22  
 import javax.persistence.CascadeType;
 23  
 import javax.persistence.Column;
 24  
 import javax.persistence.Entity;
 25  
 import javax.persistence.FetchType;
 26  
 import javax.persistence.Id;
 27  
 import javax.persistence.JoinColumn;
 28  
 import javax.persistence.OneToMany;
 29  
 import javax.persistence.Table;
 30  
 
 31  
 import org.kuali.rice.kim.bo.impl.KimAbstractMemberImpl;
 32  
 import org.kuali.rice.kim.bo.role.KimDelegationMember;
 33  
 import org.kuali.rice.kim.bo.role.dto.DelegateMemberCompleteInfo;
 34  
 import org.kuali.rice.kim.bo.types.dto.AttributeSet;
 35  
 import org.kuali.rice.kns.util.TypedArrayList;
 36  
 
 37  
 /**
 38  
  * This is a description of what this class does - kellerj don't forget to fill this in.
 39  
  *
 40  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 41  
  *
 42  
  */
 43  
 @Entity
 44  
 @Table(name="KRIM_DLGN_MBR_T")
 45  0
 public class KimDelegationMemberImpl extends KimAbstractMemberImpl implements KimDelegationMember {
 46  
 
 47  
         private static final long serialVersionUID = 6278392972043721961L;
 48  
 
 49  
         @Id
 50  
         @Column(name="DLGN_MBR_ID")
 51  
         protected String delegationMemberId;
 52  
         @Column(name="DLGN_ID")
 53  
         protected String delegationId;
 54  
         @Column(name="ROLE_MBR_ID")
 55  
         protected String roleMemberId;
 56  
 
 57  0
         @OneToMany(targetEntity=KimDelegationMemberAttributeDataImpl.class,cascade={CascadeType.ALL},fetch=FetchType.LAZY)
 58  
         @JoinColumn(name="DLGN_MBR_ID", referencedColumnName="DLGN_MBR_ID", insertable=false, updatable=false )
 59  
         protected List<KimDelegationMemberAttributeDataImpl> attributes = new TypedArrayList(KimDelegationMemberAttributeDataImpl.class);
 60  
 
 61  
 
 62  
 
 63  
         /**
 64  
          * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper()
 65  
          */
 66  
         @SuppressWarnings("unchecked")
 67  
         @Override
 68  
         protected LinkedHashMap toStringMapper() {
 69  0
                 LinkedHashMap lhm = new LinkedHashMap();
 70  0
                 lhm.put( "delegationMemberId", delegationMemberId );
 71  0
                 lhm.put( "delegationId", delegationId );
 72  0
                 lhm.put( "memberId", getMemberId() );
 73  0
                 lhm.put( "memberTypeCode", getMemberTypeCode() );
 74  0
                 return lhm;
 75  
         }
 76  
 
 77  
         public boolean isActive() {
 78  0
                 long now = System.currentTimeMillis();
 79  0
                 return (activeFromDate == null || activeFromDate.getTime() < now) && (activeToDate == null || activeToDate.getTime() > now);
 80  
         }
 81  
 
 82  
         public void setActiveFromDate(Timestamp from) {
 83  0
                 this.activeFromDate = from;
 84  0
         }
 85  
 
 86  
         public void setActiveToDate(Timestamp to) {
 87  0
                 this.activeToDate = to;
 88  0
         }
 89  
 
 90  
         public String getDelegationMemberId() {
 91  0
                 return this.delegationMemberId;
 92  
         }
 93  
 
 94  
         public void setDelegationMemberId(String delegationMemberId) {
 95  0
                 this.delegationMemberId = delegationMemberId;
 96  0
         }
 97  
 
 98  
         public String getDelegationId() {
 99  0
                 return this.delegationId;
 100  
         }
 101  
 
 102  
         public void setDelegationId(String delegationId) {
 103  0
                 this.delegationId = delegationId;
 104  0
         }
 105  
 
 106  
         public List<KimDelegationMemberAttributeDataImpl> getAttributes() {
 107  0
                 return this.attributes;
 108  
         }
 109  
 
 110  
         public void setAttributes(List<KimDelegationMemberAttributeDataImpl> attributes) {
 111  0
                 this.attributes = attributes;
 112  0
         }
 113  
 
 114  
         /**
 115  
          * @see org.kuali.rice.kim.bo.role.KimDelegationGroup#getQualifier()
 116  
          */
 117  
         public AttributeSet getQualifier() {
 118  0
                 AttributeSet attribs = new AttributeSet();
 119  
 
 120  0
                 if ( attributes == null ) {
 121  0
                         return attribs;
 122  
                 }
 123  0
                 for ( KimDelegationMemberAttributeDataImpl attr : attributes ) {
 124  0
                         attribs.put( attr.getKimAttribute().getAttributeName(), attr.getAttributeValue() );
 125  
                 }
 126  0
                 return attribs;
 127  
         }
 128  
 
 129  
         /**
 130  
          * @return the roleMemberId
 131  
          */
 132  
         public String getRoleMemberId() {
 133  0
                 return this.roleMemberId;
 134  
         }
 135  
 
 136  
         /**
 137  
          * @param roleMemberId the roleMemberId to set
 138  
          */
 139  
         public void setRoleMemberId(String roleMemberId) {
 140  0
                 this.roleMemberId = roleMemberId;
 141  0
         }
 142  
 
 143  
         public DelegateMemberCompleteInfo toSimpleInfo(){
 144  0
                 DelegateMemberCompleteInfo delegateMemberCompleteInfo = new DelegateMemberCompleteInfo();
 145  0
                 delegateMemberCompleteInfo.setDelegationMemberId(delegationMemberId);
 146  0
                 delegateMemberCompleteInfo.setActiveFromDate(activeFromDate);
 147  0
                 delegateMemberCompleteInfo.setActiveToDate(activeToDate);
 148  0
                 delegateMemberCompleteInfo.setDelegationId(delegationId);
 149  0
                 delegateMemberCompleteInfo.setMemberId(memberId);
 150  0
                 delegateMemberCompleteInfo.setMemberTypeCode(memberTypeCode);
 151  0
                 delegateMemberCompleteInfo.setQualifier(getQualifier());
 152  0
                 delegateMemberCompleteInfo.setRoleMemberId(roleMemberId);
 153  0
                 return delegateMemberCompleteInfo;
 154  
         }
 155  
 }