1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kim.bo.role.impl; |
17 | |
|
18 | |
import org.kuali.rice.core.util.AttributeSet; |
19 | |
import org.kuali.rice.kim.bo.impl.KimAbstractMemberImpl; |
20 | |
import org.kuali.rice.kim.bo.role.KimDelegationMember; |
21 | |
import org.kuali.rice.kim.bo.role.dto.DelegateMemberCompleteInfo; |
22 | |
import org.springframework.util.AutoPopulatingList; |
23 | |
|
24 | |
import javax.persistence.*; |
25 | |
import java.sql.Timestamp; |
26 | |
import java.util.List; |
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
@Entity |
35 | |
@Table(name="KRIM_DLGN_MBR_T") |
36 | 0 | public class KimDelegationMemberImpl extends KimAbstractMemberImpl implements KimDelegationMember { |
37 | |
|
38 | |
private static final long serialVersionUID = 6278392972043721961L; |
39 | |
|
40 | |
@Id |
41 | |
@Column(name="DLGN_MBR_ID") |
42 | |
protected String delegationMemberId; |
43 | |
@Column(name="DLGN_ID") |
44 | |
protected String delegationId; |
45 | |
@Column(name="ROLE_MBR_ID") |
46 | |
protected String roleMemberId; |
47 | |
|
48 | 0 | @OneToMany(targetEntity=KimDelegationMemberAttributeDataImpl.class,cascade={CascadeType.ALL},fetch=FetchType.EAGER) |
49 | |
@JoinColumn(name="DLGN_MBR_ID", referencedColumnName="DLGN_MBR_ID", insertable=false, updatable=false ) |
50 | |
protected List<KimDelegationMemberAttributeDataImpl> attributes = new AutoPopulatingList(KimDelegationMemberAttributeDataImpl.class); |
51 | |
|
52 | |
public boolean isActive() { |
53 | 0 | long now = System.currentTimeMillis(); |
54 | 0 | return (activeFromDate == null || activeFromDate.getTime() < now) && (activeToDate == null || activeToDate.getTime() > now); |
55 | |
} |
56 | |
|
57 | |
public void setActiveFromDate(Timestamp from) { |
58 | 0 | this.activeFromDate = from; |
59 | 0 | } |
60 | |
|
61 | |
public void setActiveToDate(Timestamp to) { |
62 | 0 | this.activeToDate = to; |
63 | 0 | } |
64 | |
|
65 | |
public String getDelegationMemberId() { |
66 | 0 | return this.delegationMemberId; |
67 | |
} |
68 | |
|
69 | |
public void setDelegationMemberId(String delegationMemberId) { |
70 | 0 | this.delegationMemberId = delegationMemberId; |
71 | 0 | } |
72 | |
|
73 | |
public String getDelegationId() { |
74 | 0 | return this.delegationId; |
75 | |
} |
76 | |
|
77 | |
public void setDelegationId(String delegationId) { |
78 | 0 | this.delegationId = delegationId; |
79 | 0 | } |
80 | |
|
81 | |
public List<KimDelegationMemberAttributeDataImpl> getAttributes() { |
82 | 0 | return this.attributes; |
83 | |
} |
84 | |
|
85 | |
public void setAttributes(List<KimDelegationMemberAttributeDataImpl> attributes) { |
86 | 0 | this.attributes = attributes; |
87 | 0 | } |
88 | |
|
89 | |
|
90 | |
|
91 | |
|
92 | |
public AttributeSet getQualifier() { |
93 | 0 | AttributeSet attribs = new AttributeSet(); |
94 | |
|
95 | 0 | if ( attributes == null ) { |
96 | 0 | return attribs; |
97 | |
} |
98 | 0 | for ( KimDelegationMemberAttributeDataImpl attr : attributes ) { |
99 | 0 | attribs.put( attr.getKimAttribute().getAttributeName(), attr.getAttributeValue() ); |
100 | |
} |
101 | 0 | return attribs; |
102 | |
} |
103 | |
|
104 | |
|
105 | |
|
106 | |
|
107 | |
public String getRoleMemberId() { |
108 | 0 | return this.roleMemberId; |
109 | |
} |
110 | |
|
111 | |
|
112 | |
|
113 | |
|
114 | |
public void setRoleMemberId(String roleMemberId) { |
115 | 0 | this.roleMemberId = roleMemberId; |
116 | 0 | } |
117 | |
|
118 | |
public DelegateMemberCompleteInfo toSimpleInfo(){ |
119 | 0 | DelegateMemberCompleteInfo delegateMemberCompleteInfo = new DelegateMemberCompleteInfo(); |
120 | 0 | delegateMemberCompleteInfo.setDelegationMemberId(delegationMemberId); |
121 | 0 | delegateMemberCompleteInfo.setActiveFromDate(activeFromDate); |
122 | 0 | delegateMemberCompleteInfo.setActiveToDate(activeToDate); |
123 | 0 | delegateMemberCompleteInfo.setDelegationId(delegationId); |
124 | 0 | delegateMemberCompleteInfo.setMemberId(memberId); |
125 | 0 | delegateMemberCompleteInfo.setMemberTypeCode(memberTypeCode); |
126 | 0 | delegateMemberCompleteInfo.setQualifier(getQualifier()); |
127 | 0 | delegateMemberCompleteInfo.setRoleMemberId(roleMemberId); |
128 | 0 | return delegateMemberCompleteInfo; |
129 | |
} |
130 | |
} |