1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
package org.kuali.rice.kim.api.role; |
16 | |
|
17 | |
import org.apache.commons.lang.StringUtils; |
18 | |
import org.apache.commons.lang.builder.EqualsBuilder; |
19 | |
import org.apache.commons.lang.builder.HashCodeBuilder; |
20 | |
import org.apache.commons.lang.builder.ToStringBuilder; |
21 | |
import org.kuali.rice.core.api.CoreConstants; |
22 | |
import org.kuali.rice.core.api.mo.AbstractDataTransferObject; |
23 | |
import org.kuali.rice.core.api.mo.ModelBuilder; |
24 | |
import org.kuali.rice.core.api.mo.ModelObjectComplete; |
25 | |
import org.w3c.dom.Element; |
26 | |
|
27 | |
import javax.xml.bind.annotation.XmlAccessType; |
28 | |
import javax.xml.bind.annotation.XmlAccessorType; |
29 | |
import javax.xml.bind.annotation.XmlAnyElement; |
30 | |
import javax.xml.bind.annotation.XmlElement; |
31 | |
import javax.xml.bind.annotation.XmlRootElement; |
32 | |
import javax.xml.bind.annotation.XmlType; |
33 | |
import java.util.Collection; |
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | 1 | @XmlRootElement(name = RoleResponsibilityAction.Constants.ROOT_ELEMENT_NAME) |
39 | |
@XmlAccessorType(XmlAccessType.NONE) |
40 | |
@XmlType(name = RoleResponsibilityAction.Constants.TYPE_NAME, propOrder = { |
41 | |
RoleResponsibilityAction.Elements.ID, |
42 | |
RoleResponsibilityAction.Elements.ROLE_RESPONSIBILITY_ID, |
43 | |
RoleResponsibilityAction.Elements.ROLE_MEMBER_ID, |
44 | |
RoleResponsibilityAction.Elements.ACTION_TYPE_CODE, |
45 | |
RoleResponsibilityAction.Elements.ACTION_POLICY_CODE, |
46 | |
RoleResponsibilityAction.Elements.FORCE_ACTION, |
47 | |
RoleResponsibilityAction.Elements.PRIORITY_NUMBER, |
48 | |
RoleResponsibilityAction.Elements.ROLE_RESPONSIBILITY, |
49 | |
CoreConstants.CommonElements.VERSION_NUMBER, |
50 | |
CoreConstants.CommonElements.FUTURE_ELEMENTS |
51 | |
}) |
52 | 3 | public class RoleResponsibilityAction extends AbstractDataTransferObject implements RoleResponsibilityActionContract { |
53 | |
|
54 | |
@XmlElement(name = RoleResponsibilityAction.Elements.ID, required = true) |
55 | |
private final String id; |
56 | |
|
57 | |
@XmlElement(name = RoleResponsibilityAction.Elements.ROLE_RESPONSIBILITY_ID) |
58 | |
private final String roleResponsibilityId; |
59 | |
|
60 | |
@XmlElement(name = RoleResponsibilityAction.Elements.ROLE_MEMBER_ID) |
61 | |
private final String roleMemberId; |
62 | |
|
63 | |
@XmlElement(name = RoleResponsibilityAction.Elements.ACTION_TYPE_CODE) |
64 | |
private final String actionTypeCode; |
65 | |
|
66 | |
@XmlElement(name = RoleResponsibilityAction.Elements.ACTION_POLICY_CODE) |
67 | |
private final String actionPolicyCode; |
68 | |
|
69 | |
@XmlElement(name = RoleResponsibilityAction.Elements.FORCE_ACTION) |
70 | |
private final boolean forceAction; |
71 | |
|
72 | |
@XmlElement(name = RoleResponsibilityAction.Elements.PRIORITY_NUMBER) |
73 | |
private final Integer priorityNumber; |
74 | |
|
75 | |
@XmlElement(name = RoleResponsibilityAction.Elements.ROLE_RESPONSIBILITY) |
76 | |
private final RoleResponsibility roleResponsibility; |
77 | |
|
78 | |
@XmlElement(name = CoreConstants.CommonElements.VERSION_NUMBER) |
79 | |
private final Long versionNumber; |
80 | |
|
81 | 5 | @SuppressWarnings("unused") |
82 | |
@XmlAnyElement |
83 | |
private final Collection<Element> _futureElements = null; |
84 | |
|
85 | |
|
86 | |
|
87 | |
|
88 | |
@SuppressWarnings("unused") |
89 | 2 | private RoleResponsibilityAction() { |
90 | 2 | id = null; |
91 | 2 | roleResponsibilityId = null; |
92 | 2 | roleMemberId = null; |
93 | 2 | actionTypeCode = null; |
94 | 2 | actionPolicyCode = null; |
95 | 2 | forceAction = false; |
96 | 2 | priorityNumber = null; |
97 | 2 | roleResponsibility = null; |
98 | 2 | versionNumber = null; |
99 | 2 | } |
100 | |
|
101 | 3 | private RoleResponsibilityAction(Builder b) { |
102 | 3 | id = b.getId(); |
103 | 3 | roleResponsibilityId = b.getRoleResponsibilityId(); |
104 | 3 | roleMemberId = b.getRoleMemberId(); |
105 | 3 | actionTypeCode = b.getActionTypeCode(); |
106 | 3 | actionPolicyCode = b.getActionPolicyCode(); |
107 | 3 | forceAction = b.isForceAction(); |
108 | 3 | priorityNumber = b.getPriorityNumber(); |
109 | 3 | roleResponsibility = b.getRoleResponsibility(); |
110 | 3 | versionNumber = b.getVersionNumber(); |
111 | 3 | } |
112 | |
|
113 | |
@Override |
114 | |
public String getId() { |
115 | 1 | return this.id; |
116 | |
} |
117 | |
|
118 | |
@Override |
119 | |
public String getRoleResponsibilityId() { |
120 | 1 | return this.roleResponsibilityId; |
121 | |
} |
122 | |
|
123 | |
@Override |
124 | |
public String getActionTypeCode() { |
125 | 1 | return this.actionTypeCode; |
126 | |
} |
127 | |
|
128 | |
@Override |
129 | |
public Integer getPriorityNumber() { |
130 | 1 | return this.priorityNumber; |
131 | |
} |
132 | |
|
133 | |
@Override |
134 | |
public String getActionPolicyCode() { |
135 | 1 | return this.actionPolicyCode; |
136 | |
} |
137 | |
|
138 | |
@Override |
139 | |
public String getRoleMemberId() { |
140 | 1 | return this.roleMemberId; |
141 | |
} |
142 | |
|
143 | |
@Override |
144 | |
public RoleResponsibility getRoleResponsibility() { |
145 | 1 | return this.roleResponsibility; |
146 | |
} |
147 | |
|
148 | |
@Override |
149 | |
public boolean isForceAction() { |
150 | 1 | return this.forceAction; |
151 | |
} |
152 | |
|
153 | |
@Override |
154 | |
public Long getVersionNumber() { |
155 | 1 | return this.versionNumber; |
156 | |
} |
157 | |
|
158 | 6 | public static class Builder implements RoleResponsibilityActionContract, ModelBuilder, ModelObjectComplete { |
159 | |
|
160 | |
private String Id; |
161 | |
private String roleResponsibilityId; |
162 | |
private String roleMemberId; |
163 | |
private String actionTypeCode; |
164 | |
private String actionPolicyCode; |
165 | |
private boolean forceAction; |
166 | |
private Integer priorityNumber; |
167 | |
private RoleResponsibility roleResponsibility; |
168 | |
private Long versionNumber; |
169 | |
|
170 | 9 | private Builder() { |
171 | 9 | } |
172 | |
|
173 | |
public static Builder create() { |
174 | 9 | return new Builder(); |
175 | |
} |
176 | |
|
177 | |
public static Builder create(RoleResponsibilityActionContract rra) { |
178 | 0 | Builder b = new Builder(); |
179 | 0 | b.setForceAction(rra.isForceAction()); |
180 | 0 | b.setActionPolicyCode(rra.getActionPolicyCode()); |
181 | 0 | b.setActionTypeCode(rra.getActionTypeCode()); |
182 | 0 | b.setPriorityNumber(rra.getPriorityNumber()); |
183 | 0 | b.setRoleMemberId(rra.getRoleMemberId()); |
184 | 0 | if (rra.getRoleResponsibility() != null) { |
185 | 0 | b.setRoleResponsibility(RoleResponsibility.Builder.create(rra.getRoleResponsibility()).build()); |
186 | |
} |
187 | 0 | b.setId(rra.getId()); |
188 | 0 | b.setRoleResponsibilityId(rra.getRoleResponsibilityId()); |
189 | 0 | b.setVersionNumber(rra.getVersionNumber()); |
190 | 0 | return b; |
191 | |
} |
192 | |
|
193 | |
@Override |
194 | |
public RoleResponsibilityAction build() { |
195 | 6 | if (versionNumber == null || Id == null) { |
196 | 3 | throw new IllegalStateException("versionNumber and id must be non-null and " + |
197 | |
"not empty for RoleResponsibilityAction"); |
198 | |
} |
199 | 3 | return new RoleResponsibilityAction(this); |
200 | |
} |
201 | |
|
202 | |
@Override |
203 | |
public String getId() { |
204 | 3 | return Id; |
205 | |
} |
206 | |
|
207 | |
public void setId(String id) { |
208 | 6 | if (StringUtils.isBlank(id)) { |
209 | 2 | throw new IllegalArgumentException("id must be non-null and not empty"); |
210 | |
} |
211 | 4 | this.Id = id; |
212 | 4 | } |
213 | |
|
214 | |
@Override |
215 | |
public String getRoleResponsibilityId() { |
216 | 3 | return roleResponsibilityId; |
217 | |
} |
218 | |
|
219 | |
public void setRoleResponsibilityId(String roleResponsibilityId) { |
220 | 2 | this.roleResponsibilityId = roleResponsibilityId; |
221 | 2 | } |
222 | |
|
223 | |
@Override |
224 | |
public String getActionTypeCode() { |
225 | 3 | return actionTypeCode; |
226 | |
} |
227 | |
|
228 | |
public void setActionTypeCode(String actionTypeCode) { |
229 | 2 | this.actionTypeCode = actionTypeCode; |
230 | 2 | } |
231 | |
|
232 | |
@Override |
233 | |
public Integer getPriorityNumber() { |
234 | 3 | return priorityNumber; |
235 | |
} |
236 | |
|
237 | |
public void setPriorityNumber(Integer priorityNumber) { |
238 | 2 | this.priorityNumber = priorityNumber; |
239 | 2 | } |
240 | |
|
241 | |
@Override |
242 | |
public String getActionPolicyCode() { |
243 | 3 | return actionPolicyCode; |
244 | |
} |
245 | |
|
246 | |
public void setActionPolicyCode(String actionPolicyCode) { |
247 | 2 | this.actionPolicyCode = actionPolicyCode; |
248 | 2 | } |
249 | |
|
250 | |
@Override |
251 | |
public String getRoleMemberId() { |
252 | 3 | return roleMemberId; |
253 | |
} |
254 | |
|
255 | |
public void setRoleMemberId(String roleMemberId) { |
256 | 2 | this.roleMemberId = roleMemberId; |
257 | 2 | } |
258 | |
|
259 | |
@Override |
260 | |
public RoleResponsibility getRoleResponsibility() { |
261 | 3 | return roleResponsibility; |
262 | |
} |
263 | |
|
264 | |
public void setRoleResponsibility(RoleResponsibility roleResponsibility) { |
265 | 2 | this.roleResponsibility = roleResponsibility; |
266 | 2 | } |
267 | |
|
268 | |
@Override |
269 | |
public boolean isForceAction() { |
270 | 3 | return forceAction; |
271 | |
} |
272 | |
|
273 | |
public void setForceAction(boolean forceAction) { |
274 | 2 | this.forceAction = forceAction; |
275 | 2 | } |
276 | |
|
277 | |
@Override |
278 | |
public Long getVersionNumber() { |
279 | 3 | return versionNumber; |
280 | |
} |
281 | |
|
282 | |
public void setVersionNumber(Long versionNumber) { |
283 | 5 | if (versionNumber == null) { |
284 | 1 | throw new IllegalArgumentException("versionNumber must be non-null"); |
285 | |
} |
286 | 4 | this.versionNumber = versionNumber; |
287 | 4 | } |
288 | |
|
289 | |
@Override |
290 | |
public int hashCode() { |
291 | 0 | return HashCodeBuilder.reflectionHashCode(this); |
292 | |
} |
293 | |
|
294 | |
@Override |
295 | |
public boolean equals(Object obj) { |
296 | 0 | return EqualsBuilder.reflectionEquals(obj, this); |
297 | |
} |
298 | |
|
299 | |
@Override |
300 | |
public String toString() { |
301 | 0 | return ToStringBuilder.reflectionToString(this); |
302 | |
} |
303 | |
} |
304 | |
|
305 | |
|
306 | |
|
307 | |
|
308 | |
|
309 | |
|
310 | 0 | static class Elements { |
311 | |
final static String ID = "id"; |
312 | |
final static String ROLE_RESPONSIBILITY_ID = "roleResponsibilityId"; |
313 | |
final static String ROLE_MEMBER_ID = "roleMemberId"; |
314 | |
final static String ACTION_TYPE_CODE = "actionTypeCode"; |
315 | |
final static String ACTION_POLICY_CODE = "actionPolicyCode"; |
316 | |
final static String FORCE_ACTION = "forceAction"; |
317 | |
final static String PRIORITY_NUMBER = "priorityNumber"; |
318 | |
final static String ROLE_RESPONSIBILITY = "roleResponsibility"; |
319 | |
} |
320 | |
|
321 | |
|
322 | |
|
323 | |
|
324 | 0 | static class Constants { |
325 | |
final static String ROOT_ELEMENT_NAME = "roleResponsibilityAction"; |
326 | |
final static String TYPE_NAME = "RoleResponsibilityActionType"; |
327 | |
} |
328 | |
} |