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