001/*
002 * Copyright 2011 The Kuali Foundation.
003 * 
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 * 
008 * http://www.opensource.org/licenses/ecl2.php
009 * 
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.ole.coa.identity;
017
018import java.util.Map;
019
020import org.joda.time.DateTime;
021import org.kuali.rice.core.api.delegation.DelegationType;
022import org.kuali.rice.core.api.membership.MemberType;
023import org.kuali.rice.core.api.mo.common.active.InactivatableFromToUtils;
024import org.kuali.rice.kim.api.common.delegate.DelegateMemberContract;
025import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
026
027public class OleKimDocDelegateMember extends PersistableBusinessObjectBase implements DelegateMemberContract {
028
029    protected String delegationMemberId;
030    protected String delegationId;
031    protected String memberId;
032    protected String roleMemberId;
033    protected Map<String, String> attributes;
034    protected DateTime activeFromDate;
035    protected DateTime activeToDate;
036    protected DelegationType delegationType;
037    protected MemberType type;
038    protected String memberName;
039    protected String memberNamespaceCode;
040    
041    public OleKimDocDelegateMember() {}
042    
043    public OleKimDocDelegateMember( String roleMemberId, MemberType type ) {
044        this.roleMemberId = roleMemberId;
045        this.type = type;
046    }
047    
048    public OleKimDocDelegateMember( DelegateMemberContract delegateMember ) {
049        this.delegationMemberId = delegateMember.getDelegationMemberId();
050        this.delegationId = delegateMember.getDelegationId();
051        this.memberId = delegateMember.getMemberId();
052        this.roleMemberId = delegateMember.getRoleMemberId();
053        this.type = delegateMember.getType();
054        this.activeFromDate = delegateMember.getActiveFromDate();
055        this.activeToDate = delegateMember.getActiveToDate();
056        this.attributes = delegateMember.getAttributes();        
057    }
058    
059    public String getDelegationMemberId() {
060        return delegationMemberId;
061    }
062    public void setDelegationMemberId(String delegationMemberId) {
063        this.delegationMemberId = delegationMemberId;
064    }
065    public String getDelegationId() {
066        return delegationId;
067    }
068    public void setDelegationId(String delegationId) {
069        this.delegationId = delegationId;
070    }
071    public String getMemberId() {
072        return memberId;
073    }
074    public void setMemberId(String memberId) {
075        this.memberId = memberId;
076    }
077    public String getRoleMemberId() {
078        return roleMemberId;
079    }
080    public void setRoleMemberId(String roleMemberId) {
081        this.roleMemberId = roleMemberId;
082    }
083    public Map<String, String> getAttributes() {
084        return attributes;
085    }
086    public void setAttributes(Map<String, String> attributes) {
087        this.attributes = attributes;
088    }
089    public DateTime getActiveFromDate() {
090        return activeFromDate;
091    }
092    public void setActiveFromDate(DateTime activeFromDate) {
093        this.activeFromDate = activeFromDate;
094    }
095    public DateTime getActiveToDate() {
096        return activeToDate;
097    }
098    public void setActiveToDate(DateTime activeToDate) {
099        this.activeToDate = activeToDate;
100    }
101
102    @Override
103    public boolean isActive(DateTime activeAsOfDate) {
104        return InactivatableFromToUtils.isActive(activeFromDate, activeToDate, activeAsOfDate);
105    }
106
107    @Override
108    public boolean isActive() {
109        return InactivatableFromToUtils.isActive(activeFromDate, activeToDate, null);
110    }
111
112    @Override
113    public MemberType getType() {
114        return type;
115    }
116
117    public DelegationType getDelegationType() {
118        return delegationType;
119    }
120
121    public void setDelegationType(DelegationType delegationType) {
122        this.delegationType = delegationType;
123    }
124
125    public void setType(MemberType type) {
126        this.type = type;
127    }
128
129    public String getMemberName() {
130        return memberName;
131    }
132
133    public void setMemberName(String memberName) {
134        this.memberName = memberName;
135    }
136
137    public String getMemberNamespaceCode() {
138        return memberNamespaceCode;
139    }
140
141    public void setMemberNamespaceCode(String memberNamespaceCode) {
142        this.memberNamespaceCode = memberNamespaceCode;
143    }
144    
145    
146
147}