1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kim.xml; |
17 | |
|
18 | |
import java.io.Serializable; |
19 | |
import java.sql.Date; |
20 | |
|
21 | |
import javax.xml.bind.annotation.XmlAccessType; |
22 | |
import javax.xml.bind.annotation.XmlAccessorType; |
23 | |
import javax.xml.bind.annotation.XmlElement; |
24 | |
import javax.xml.bind.annotation.XmlRootElement; |
25 | |
import javax.xml.bind.annotation.XmlTransient; |
26 | |
import javax.xml.bind.annotation.XmlType; |
27 | |
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; |
28 | |
|
29 | |
import org.kuali.rice.core.jaxb.SqlDateAdapter; |
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
@XmlRootElement(name = "member", namespace = "http://rice.kuali.org/xsd/kim/group") |
39 | |
@XmlAccessorType(XmlAccessType.FIELD) |
40 | |
@XmlType(name = "Member", namespace = "http://rice.kuali.org/xsd/kim/group", propOrder = { |
41 | |
"memberId", "memberTypeCode", "activeFromDate", "activeToDate" |
42 | |
}) |
43 | |
public class GroupMembershipXmlDto implements Serializable { |
44 | |
@XmlTransient |
45 | |
private static final long serialVersionUID = 8480290118998280178L; |
46 | |
|
47 | |
@XmlTransient |
48 | |
protected String groupId; |
49 | |
|
50 | |
@XmlTransient |
51 | |
protected String groupMemberId; |
52 | |
|
53 | |
@XmlElement(name = "memberId", namespace = "http://rice.kuali.org/xsd/kim/group") |
54 | |
protected String memberId; |
55 | |
|
56 | |
@XmlElement(name = "memberTypeCode", namespace = "http://rice.kuali.org/xsd/kim/group") |
57 | |
String memberTypeCode; |
58 | |
|
59 | |
@XmlTransient |
60 | |
protected Long versionNumber; |
61 | |
|
62 | |
@XmlElement(name = "activeFromDate", namespace = "http://rice.kuali.org/xsd/kim/group") |
63 | |
@XmlJavaTypeAdapter(value = SqlDateAdapter.class) |
64 | |
protected Date activeFromDate; |
65 | |
|
66 | |
@XmlElement(name = "activeToDate", namespace = "http://rice.kuali.org/xsd/kim/group") |
67 | |
@XmlJavaTypeAdapter(value = SqlDateAdapter.class) |
68 | |
protected Date activeToDate; |
69 | |
|
70 | |
public GroupMembershipXmlDto(String groupId, String groupMemberId, String memberId, String memberTypeCode, Date activeFromDate, Date activeToDate) { |
71 | 0 | super(); |
72 | 0 | this.groupId = groupId; |
73 | 0 | this.memberId = memberId; |
74 | 0 | this.memberTypeCode = memberTypeCode; |
75 | 0 | this.groupMemberId = groupMemberId; |
76 | 0 | this.activeFromDate = activeFromDate; |
77 | 0 | this.activeToDate = activeToDate; |
78 | 0 | } |
79 | |
|
80 | |
|
81 | 0 | public GroupMembershipXmlDto() {} |
82 | |
|
83 | |
public String getMemberId() { |
84 | 0 | return this.memberId; |
85 | |
} |
86 | |
|
87 | |
|
88 | |
public void setMemberId(String memberId) { |
89 | 0 | this.memberId = memberId; |
90 | 0 | } |
91 | |
|
92 | |
|
93 | |
public String getMemberTypeCode() { |
94 | 0 | return this.memberTypeCode; |
95 | |
} |
96 | |
|
97 | |
|
98 | |
public void setMemberTypeCode(String memberTypeCode) { |
99 | 0 | this.memberTypeCode = memberTypeCode; |
100 | 0 | } |
101 | |
|
102 | |
|
103 | |
public String getGroupId() { |
104 | 0 | return this.groupId; |
105 | |
} |
106 | |
|
107 | |
|
108 | |
public void setGroupId(String groupId) { |
109 | 0 | this.groupId = groupId; |
110 | 0 | } |
111 | |
|
112 | |
|
113 | |
public String getGroupMemberId() { |
114 | 0 | return this.groupMemberId; |
115 | |
} |
116 | |
|
117 | |
|
118 | |
public void setGroupMemberId(String groupMemberId) { |
119 | 0 | this.groupMemberId = groupMemberId; |
120 | 0 | } |
121 | |
|
122 | |
|
123 | |
public Long getVersionNumber() { |
124 | 0 | return this.versionNumber; |
125 | |
} |
126 | |
|
127 | |
|
128 | |
public void setVersionNumber(Long versionNumber) { |
129 | 0 | this.versionNumber = versionNumber; |
130 | 0 | } |
131 | |
|
132 | |
|
133 | |
|
134 | |
public Date getActiveFromDate() { |
135 | 0 | return this.activeFromDate; |
136 | |
} |
137 | |
|
138 | |
|
139 | |
public void setActiveFromDate(Date activeFromDate) { |
140 | 0 | this.activeFromDate = activeFromDate; |
141 | 0 | } |
142 | |
|
143 | |
|
144 | |
|
145 | |
public Date getActiveToDate() { |
146 | 0 | return this.activeToDate; |
147 | |
} |
148 | |
|
149 | |
public void setActiveToDate(Date activeToDate) { |
150 | 0 | this.activeToDate = activeToDate; |
151 | 0 | } |
152 | |
|
153 | |
public boolean isActive() { |
154 | 0 | long now = System.currentTimeMillis(); |
155 | 0 | return (activeFromDate == null || now > activeFromDate.getTime()) && (activeToDate == null || now < activeToDate.getTime()); |
156 | |
} |
157 | |
|
158 | |
} |