1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kew.api.rule; |
17 | |
|
18 | |
import org.kuali.rice.core.api.CoreConstants; |
19 | |
import org.kuali.rice.core.api.mo.AbstractDataTransferObject; |
20 | |
import org.kuali.rice.core.api.mo.ModelBuilder; |
21 | |
import org.kuali.rice.core.api.util.jaxb.MapStringStringAdapter; |
22 | |
import org.w3c.dom.Element; |
23 | |
|
24 | |
import javax.xml.bind.annotation.XmlAccessType; |
25 | |
import javax.xml.bind.annotation.XmlAccessorType; |
26 | |
import javax.xml.bind.annotation.XmlAnyElement; |
27 | |
import javax.xml.bind.annotation.XmlElement; |
28 | |
import javax.xml.bind.annotation.XmlElementWrapper; |
29 | |
import javax.xml.bind.annotation.XmlRootElement; |
30 | |
import javax.xml.bind.annotation.XmlType; |
31 | |
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; |
32 | |
import java.io.Serializable; |
33 | |
import java.util.Collection; |
34 | |
import java.util.Collections; |
35 | |
import java.util.List; |
36 | |
import java.util.Map; |
37 | |
|
38 | |
@XmlRootElement(name = RuleReportCriteria.Constants.ROOT_ELEMENT_NAME) |
39 | |
@XmlAccessorType(XmlAccessType.NONE) |
40 | |
@XmlType(name = RuleReportCriteria.Constants.TYPE_NAME, propOrder = { |
41 | |
RuleReportCriteria.Elements.RULE_DESCRIPTION, |
42 | |
RuleReportCriteria.Elements.DOCUMENT_TYPE_NAME, |
43 | |
RuleReportCriteria.Elements.RULE_TEMPLATE_NAME, |
44 | |
RuleReportCriteria.Elements.ACTION_REQUEST_CODES, |
45 | |
RuleReportCriteria.Elements.RESPONSIBLE_PRINCIPAL_ID, |
46 | |
RuleReportCriteria.Elements.RESPONSIBLE_GROUP_ID, |
47 | |
RuleReportCriteria.Elements.RESPONSIBLE_ROLE_NAME, |
48 | |
RuleReportCriteria.Elements.RULE_EXTENSIONS, |
49 | |
RuleReportCriteria.Elements.ACTIVE, |
50 | |
RuleReportCriteria.Elements.CONSIDER_GROUP_MEMBERSHIP, |
51 | |
RuleReportCriteria.Elements.INCLUDE_DELEGATIONS, |
52 | |
CoreConstants.CommonElements.FUTURE_ELEMENTS |
53 | |
}) |
54 | 0 | public final class RuleReportCriteria |
55 | |
extends AbstractDataTransferObject |
56 | |
implements RuleReportCriteriaContract |
57 | |
{ |
58 | |
|
59 | |
@XmlElement(name = Elements.RULE_DESCRIPTION, required = false) |
60 | |
private final String ruleDescription; |
61 | |
@XmlElement(name = Elements.DOCUMENT_TYPE_NAME, required = false) |
62 | |
private final String documentTypeName; |
63 | |
@XmlElement(name = Elements.RULE_TEMPLATE_NAME, required = false) |
64 | |
private final String ruleTemplateName; |
65 | |
@XmlElementWrapper(name = Elements.ACTION_REQUEST_CODES, required = false) |
66 | |
@XmlElement(name = Elements.ACTION_REQUEST_CODE, required = false) |
67 | |
private final List<String> actionRequestCodes; |
68 | |
@XmlElement(name = Elements.RESPONSIBLE_PRINCIPAL_ID, required = false) |
69 | |
private final String responsiblePrincipalId; |
70 | |
@XmlElement(name = Elements.RESPONSIBLE_GROUP_ID, required = false) |
71 | |
private final String responsibleGroupId; |
72 | |
@XmlElement(name = Elements.RESPONSIBLE_ROLE_NAME, required = false) |
73 | |
private final String responsibleRoleName; |
74 | |
@XmlElement(name = Elements.RULE_EXTENSIONS, required = false) |
75 | |
@XmlJavaTypeAdapter(value = MapStringStringAdapter.class) |
76 | |
private final Map<String, String> ruleExtensions; |
77 | |
@XmlElement(name = Elements.ACTIVE, required = false) |
78 | |
private final boolean active; |
79 | |
@XmlElement(name = Elements.CONSIDER_GROUP_MEMBERSHIP, required = false) |
80 | |
private final boolean considerGroupMembership; |
81 | |
@XmlElement(name = Elements.INCLUDE_DELEGATIONS, required = false) |
82 | |
private final boolean includeDelegations; |
83 | 0 | @SuppressWarnings("unused") |
84 | |
@XmlAnyElement |
85 | |
private final Collection<Element> _futureElements = null; |
86 | |
|
87 | |
|
88 | |
|
89 | |
|
90 | |
|
91 | 0 | private RuleReportCriteria() { |
92 | 0 | this.ruleDescription = null; |
93 | 0 | this.documentTypeName = null; |
94 | 0 | this.ruleTemplateName = null; |
95 | 0 | this.actionRequestCodes = null; |
96 | 0 | this.responsiblePrincipalId = null; |
97 | 0 | this.responsibleGroupId = null; |
98 | 0 | this.responsibleRoleName = null; |
99 | 0 | this.ruleExtensions = null; |
100 | 0 | this.active = false; |
101 | 0 | this.considerGroupMembership = false; |
102 | 0 | this.includeDelegations = false; |
103 | 0 | } |
104 | |
|
105 | 0 | private RuleReportCriteria(Builder builder) { |
106 | 0 | this.ruleDescription = builder.getRuleDescription(); |
107 | 0 | this.documentTypeName = builder.getDocumentTypeName(); |
108 | 0 | this.ruleTemplateName = builder.getRuleTemplateName(); |
109 | 0 | this.actionRequestCodes = builder.getActionRequestCodes(); |
110 | 0 | this.responsiblePrincipalId = builder.getResponsiblePrincipalId(); |
111 | 0 | this.responsibleGroupId = builder.getResponsibleGroupId(); |
112 | 0 | this.responsibleRoleName = builder.getResponsibleRoleName(); |
113 | 0 | this.ruleExtensions = builder.getRuleExtensions(); |
114 | 0 | this.active = builder.isActive(); |
115 | 0 | this.considerGroupMembership = builder.isConsiderGroupMembership(); |
116 | 0 | this.includeDelegations = builder.isIncludeDelegations(); |
117 | 0 | } |
118 | |
|
119 | |
@Override |
120 | |
public String getRuleDescription() { |
121 | 0 | return this.ruleDescription; |
122 | |
} |
123 | |
|
124 | |
@Override |
125 | |
public String getDocumentTypeName() { |
126 | 0 | return this.documentTypeName; |
127 | |
} |
128 | |
|
129 | |
@Override |
130 | |
public String getRuleTemplateName() { |
131 | 0 | return this.ruleTemplateName; |
132 | |
} |
133 | |
|
134 | |
@Override |
135 | |
public List<String> getActionRequestCodes() { |
136 | 0 | return this.actionRequestCodes; |
137 | |
} |
138 | |
|
139 | |
@Override |
140 | |
public String getResponsiblePrincipalId() { |
141 | 0 | return this.responsiblePrincipalId; |
142 | |
} |
143 | |
|
144 | |
@Override |
145 | |
public String getResponsibleGroupId() { |
146 | 0 | return this.responsibleGroupId; |
147 | |
} |
148 | |
|
149 | |
@Override |
150 | |
public String getResponsibleRoleName() { |
151 | 0 | return this.responsibleRoleName; |
152 | |
} |
153 | |
|
154 | |
@Override |
155 | |
public Map<String, String> getRuleExtensions() { |
156 | 0 | return this.ruleExtensions; |
157 | |
} |
158 | |
|
159 | |
@Override |
160 | |
public boolean isActive() { |
161 | 0 | return this.active; |
162 | |
} |
163 | |
|
164 | |
@Override |
165 | |
public boolean isConsiderGroupMembership() { |
166 | 0 | return this.considerGroupMembership; |
167 | |
} |
168 | |
|
169 | |
@Override |
170 | |
public boolean isIncludeDelegations() { |
171 | 0 | return this.includeDelegations; |
172 | |
} |
173 | |
|
174 | |
|
175 | |
|
176 | |
|
177 | |
|
178 | |
|
179 | 0 | public final static class Builder |
180 | |
implements Serializable, ModelBuilder, RuleReportCriteriaContract |
181 | |
{ |
182 | |
|
183 | |
private String ruleDescription; |
184 | |
private String documentTypeName; |
185 | |
private String ruleTemplateName; |
186 | |
private List<String> actionRequestCodes; |
187 | |
private String responsiblePrincipalId; |
188 | |
private String responsibleGroupId; |
189 | |
private String responsibleRoleName; |
190 | |
private Map<String, String> ruleExtensions; |
191 | |
private boolean active; |
192 | |
private boolean considerGroupMembership; |
193 | |
private boolean includeDelegations; |
194 | |
|
195 | 0 | private Builder() { |
196 | 0 | setActive(true); |
197 | 0 | setConsiderGroupMembership(true); |
198 | 0 | } |
199 | |
|
200 | |
public static Builder create() { |
201 | 0 | return new Builder(); |
202 | |
} |
203 | |
|
204 | |
public static Builder create(RuleReportCriteriaContract contract) { |
205 | 0 | if (contract == null) { |
206 | 0 | throw new IllegalArgumentException("contract was null"); |
207 | |
} |
208 | 0 | Builder builder = create(); |
209 | 0 | builder.setRuleDescription(contract.getRuleDescription()); |
210 | 0 | builder.setDocumentTypeName(contract.getDocumentTypeName()); |
211 | 0 | builder.setRuleTemplateName(contract.getRuleTemplateName()); |
212 | 0 | builder.setActionRequestCodes(contract.getActionRequestCodes()); |
213 | 0 | builder.setResponsiblePrincipalId(contract.getResponsiblePrincipalId()); |
214 | 0 | builder.setResponsibleGroupId(contract.getResponsibleGroupId()); |
215 | 0 | builder.setResponsibleRoleName(contract.getResponsibleRoleName()); |
216 | 0 | builder.setRuleExtensions(contract.getRuleExtensions()); |
217 | 0 | builder.setActive(contract.isActive()); |
218 | 0 | builder.setConsiderGroupMembership(contract.isConsiderGroupMembership()); |
219 | 0 | builder.setIncludeDelegations(contract.isIncludeDelegations()); |
220 | 0 | return builder; |
221 | |
} |
222 | |
|
223 | |
public RuleReportCriteria build() { |
224 | 0 | return new RuleReportCriteria(this); |
225 | |
} |
226 | |
|
227 | |
@Override |
228 | |
public String getRuleDescription() { |
229 | 0 | return this.ruleDescription; |
230 | |
} |
231 | |
|
232 | |
@Override |
233 | |
public String getDocumentTypeName() { |
234 | 0 | return this.documentTypeName; |
235 | |
} |
236 | |
|
237 | |
@Override |
238 | |
public String getRuleTemplateName() { |
239 | 0 | return this.ruleTemplateName; |
240 | |
} |
241 | |
|
242 | |
@Override |
243 | |
public List<String> getActionRequestCodes() { |
244 | 0 | return this.actionRequestCodes; |
245 | |
} |
246 | |
|
247 | |
@Override |
248 | |
public String getResponsiblePrincipalId() { |
249 | 0 | return this.responsiblePrincipalId; |
250 | |
} |
251 | |
|
252 | |
@Override |
253 | |
public String getResponsibleGroupId() { |
254 | 0 | return this.responsibleGroupId; |
255 | |
} |
256 | |
|
257 | |
@Override |
258 | |
public String getResponsibleRoleName() { |
259 | 0 | return this.responsibleRoleName; |
260 | |
} |
261 | |
|
262 | |
@Override |
263 | |
public Map<String, String> getRuleExtensions() { |
264 | 0 | return this.ruleExtensions; |
265 | |
} |
266 | |
|
267 | |
@Override |
268 | |
public boolean isActive() { |
269 | 0 | return this.active; |
270 | |
} |
271 | |
|
272 | |
@Override |
273 | |
public boolean isConsiderGroupMembership() { |
274 | 0 | return this.considerGroupMembership; |
275 | |
} |
276 | |
|
277 | |
@Override |
278 | |
public boolean isIncludeDelegations() { |
279 | 0 | return this.includeDelegations; |
280 | |
} |
281 | |
|
282 | |
public void setRuleDescription(String ruleDescription) { |
283 | |
|
284 | 0 | this.ruleDescription = ruleDescription; |
285 | 0 | } |
286 | |
|
287 | |
public void setDocumentTypeName(String documentTypeName) { |
288 | |
|
289 | 0 | this.documentTypeName = documentTypeName; |
290 | 0 | } |
291 | |
|
292 | |
public void setRuleTemplateName(String ruleTemplateName) { |
293 | |
|
294 | 0 | this.ruleTemplateName = ruleTemplateName; |
295 | 0 | } |
296 | |
|
297 | |
public void setActionRequestCodes(List<String> actionRequestCodes) { |
298 | |
|
299 | 0 | this.actionRequestCodes = actionRequestCodes; |
300 | 0 | } |
301 | |
|
302 | |
public void setResponsiblePrincipalId(String responsiblePrincipalId) { |
303 | |
|
304 | 0 | this.responsiblePrincipalId = responsiblePrincipalId; |
305 | 0 | } |
306 | |
|
307 | |
public void setResponsibleGroupId(String responsibleGroupId) { |
308 | |
|
309 | 0 | this.responsibleGroupId = responsibleGroupId; |
310 | 0 | } |
311 | |
|
312 | |
public void setResponsibleRoleName(String responsibleRoleName) { |
313 | |
|
314 | 0 | this.responsibleRoleName = responsibleRoleName; |
315 | 0 | } |
316 | |
|
317 | |
public void setRuleExtensions(Map<String, String> ruleExtensions) { |
318 | |
|
319 | 0 | this.ruleExtensions = Collections.unmodifiableMap(ruleExtensions); |
320 | 0 | } |
321 | |
|
322 | |
public void setActive(boolean active) { |
323 | |
|
324 | 0 | this.active = active; |
325 | 0 | } |
326 | |
|
327 | |
public void setConsiderGroupMembership(boolean considerGroupMembership) { |
328 | |
|
329 | 0 | this.considerGroupMembership = considerGroupMembership; |
330 | 0 | } |
331 | |
|
332 | |
public void setIncludeDelegations(boolean includeDelegations) { |
333 | |
|
334 | 0 | this.includeDelegations = includeDelegations; |
335 | 0 | } |
336 | |
|
337 | |
} |
338 | |
|
339 | |
|
340 | |
|
341 | |
|
342 | |
|
343 | |
|
344 | 0 | static class Constants { |
345 | |
|
346 | |
final static String ROOT_ELEMENT_NAME = "ruleReportCriteria"; |
347 | |
final static String TYPE_NAME = "RuleReportCriteriaType"; |
348 | |
|
349 | |
} |
350 | |
|
351 | |
|
352 | |
|
353 | |
|
354 | |
|
355 | |
|
356 | 0 | static class Elements { |
357 | |
|
358 | |
final static String RULE_DESCRIPTION = "ruleDescription"; |
359 | |
final static String DOCUMENT_TYPE_NAME = "documentTypeName"; |
360 | |
final static String RULE_TEMPLATE_NAME = "ruleTemplateName"; |
361 | |
final static String ACTION_REQUEST_CODES = "actionRequestCodes"; |
362 | |
final static String ACTION_REQUEST_CODE = "actionRequestCode"; |
363 | |
final static String RESPONSIBLE_PRINCIPAL_ID = "responsiblePrincipalId"; |
364 | |
final static String RESPONSIBLE_GROUP_ID = "responsibleGroupId"; |
365 | |
final static String RESPONSIBLE_ROLE_NAME = "responsibleRoleName"; |
366 | |
final static String RULE_EXTENSIONS = "ruleExtensions"; |
367 | |
final static String ACTIVE = "active"; |
368 | |
final static String CONSIDER_GROUP_MEMBERSHIP = "considerGroupMembership"; |
369 | |
final static String INCLUDE_DELEGATIONS = "includeDelegations"; |
370 | |
|
371 | |
} |
372 | |
|
373 | |
} |