1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kew.framework.rule.attribute;
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.ModelObjectUtils;
21 import org.kuali.rice.core.api.uif.RemotableAttributeError;
22 import org.kuali.rice.core.api.uif.RemotableAttributeField;
23 import org.kuali.rice.core.api.util.jaxb.MapStringStringAdapter;
24 import org.w3c.dom.Element;
25
26 import javax.xml.bind.annotation.XmlAccessType;
27 import javax.xml.bind.annotation.XmlAccessorType;
28 import javax.xml.bind.annotation.XmlAnyElement;
29 import javax.xml.bind.annotation.XmlElement;
30 import javax.xml.bind.annotation.XmlElementWrapper;
31 import javax.xml.bind.annotation.XmlRootElement;
32 import javax.xml.bind.annotation.XmlType;
33 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
34 import java.util.Collection;
35 import java.util.Collections;
36 import java.util.List;
37 import java.util.Map;
38
39
40
41
42
43
44
45 @XmlRootElement(name = WorkflowRuleAttributeFields.Constants.ROOT_ELEMENT_NAME)
46 @XmlAccessorType(XmlAccessType.NONE)
47 @XmlType(name = WorkflowRuleAttributeFields.Constants.TYPE_NAME, propOrder = {
48 WorkflowRuleAttributeFields.Elements.VALIDATION_ERRORS,
49 WorkflowRuleAttributeFields.Elements.ATTRIBUTE_FIELDS,
50 WorkflowRuleAttributeFields.Elements.RULE_EXTENSION_VALUES,
51 CoreConstants.CommonElements.FUTURE_ELEMENTS
52 })
53
54 public class WorkflowRuleAttributeFields extends AbstractDataTransferObject {
55
56 @XmlElementWrapper(name = Elements.VALIDATION_ERRORS, required = true)
57 @XmlElement(name = Elements.VALIDATION_ERROR, required = false)
58 private final List<RemotableAttributeError> validationErrors;
59
60 @XmlElementWrapper(name = Elements.ATTRIBUTE_FIELDS, required = true)
61 @XmlElement(name = Elements.ATTRIBUTE_FIELD, required = false)
62 private final List<RemotableAttributeField> attributeFields;
63
64 @XmlElement(name = Elements.RULE_EXTENSION_VALUES, required = false)
65 @XmlJavaTypeAdapter(MapStringStringAdapter.class)
66 private final Map<String, String> ruleExtensionValues;
67
68 @SuppressWarnings("unused")
69 @XmlAnyElement
70 private final Collection<Element> _futureElements = null;
71
72
73
74
75 @SuppressWarnings("unused")
76 private WorkflowRuleAttributeFields() {
77 this.validationErrors = null;
78 this.attributeFields = null;
79 this.ruleExtensionValues = null;
80 }
81
82 private WorkflowRuleAttributeFields(List<RemotableAttributeError> validationErrors,
83 List<RemotableAttributeField> attributeFields,
84 Map<String, String> ruleExtensionValues) {
85 this.validationErrors = ModelObjectUtils.createImmutableCopy(validationErrors);
86 this.attributeFields = ModelObjectUtils.createImmutableCopy(attributeFields);
87 this.ruleExtensionValues = ModelObjectUtils.createImmutableCopy(ruleExtensionValues);
88 }
89
90
91
92
93
94
95
96
97
98
99 public static WorkflowRuleAttributeFields create(List<RemotableAttributeError> validationErrors,
100 List<RemotableAttributeField> attributeFields,
101 Map<String, String> ruleExtensionValues) {
102 if (validationErrors == null) {
103 validationErrors = Collections.emptyList();
104 }
105 if (attributeFields == null) {
106 attributeFields = Collections.emptyList();
107 }
108 if (ruleExtensionValues == null) {
109 ruleExtensionValues = Collections.emptyMap();
110 }
111 return new WorkflowRuleAttributeFields(validationErrors, attributeFields, ruleExtensionValues);
112 }
113
114 public List<RemotableAttributeError> getValidationErrors() {
115 return validationErrors;
116 }
117
118 public List<RemotableAttributeField> getAttributeFields() {
119 return attributeFields;
120 }
121
122 public Map<String, String> getRuleExtensionValues() {
123 return ruleExtensionValues;
124 }
125
126
127
128
129 static class Constants {
130 final static String ROOT_ELEMENT_NAME = "workflowRuleAttributeFields";
131 final static String TYPE_NAME = "WorkflowRuleAttributeFieldsType";
132 }
133
134
135
136
137 static class Elements {
138 final static String VALIDATION_ERRORS = "validationErrors";
139 final static String VALIDATION_ERROR = "validationError";
140 final static String ATTRIBUTE_FIELDS = "attributeFields";
141 final static String ATTRIBUTE_FIELD = "attributeField";
142 final static String RULE_EXTENSION_VALUES = "ruleExtensionValues";
143
144 }
145
146 }