1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kew.api.document.attribute; |
17 | |
|
18 | |
import org.apache.commons.lang.StringUtils; |
19 | |
import org.kuali.rice.core.api.CoreConstants; |
20 | |
import org.kuali.rice.core.api.mo.AbstractDataTransferObject; |
21 | |
import org.kuali.rice.core.api.uif.RemotableAttributeField; |
22 | |
import org.kuali.rice.kew.api.action.ActionType; |
23 | |
import org.w3c.dom.Element; |
24 | |
|
25 | |
import javax.xml.bind.annotation.XmlAccessType; |
26 | |
import javax.xml.bind.annotation.XmlAccessorType; |
27 | |
import javax.xml.bind.annotation.XmlAnyElement; |
28 | |
import javax.xml.bind.annotation.XmlElement; |
29 | |
import javax.xml.bind.annotation.XmlElementWrapper; |
30 | |
import javax.xml.bind.annotation.XmlRootElement; |
31 | |
import javax.xml.bind.annotation.XmlType; |
32 | |
import java.util.ArrayList; |
33 | |
import java.util.Collection; |
34 | |
import java.util.Collections; |
35 | |
import java.util.List; |
36 | |
|
37 | |
@XmlRootElement(name = AttributeFields.Constants.ROOT_ELEMENT_NAME) |
38 | |
@XmlAccessorType(XmlAccessType.NONE) |
39 | |
@XmlType(name = AttributeFields.Constants.TYPE_NAME, propOrder = { |
40 | |
AttributeFields.Elements.ATTRIBUTE_NAME, |
41 | |
AttributeFields.Elements.REMOTABLE_ATTRIBUTE_FIELDS, |
42 | |
CoreConstants.CommonElements.FUTURE_ELEMENTS |
43 | |
}) |
44 | |
public final class AttributeFields extends AbstractDataTransferObject { |
45 | |
|
46 | |
@XmlElement(name = Elements.ATTRIBUTE_NAME, required = true) |
47 | |
private final String attributeName; |
48 | |
|
49 | |
@XmlElementWrapper(name = Elements.REMOTABLE_ATTRIBUTE_FIELDS, required = true) |
50 | |
@XmlElement(name = Elements.REMOTABLE_ATTRIBUTE_FIELD, required = false) |
51 | |
private final List<RemotableAttributeField> remotableAttributeFields; |
52 | |
|
53 | 0 | @SuppressWarnings("unused") |
54 | |
@XmlAnyElement |
55 | |
private final Collection<Element> _futureElements = null; |
56 | |
|
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | 0 | private AttributeFields() { |
62 | 0 | this.attributeName = null; |
63 | 0 | this.remotableAttributeFields = null; |
64 | 0 | } |
65 | |
|
66 | 0 | private AttributeFields(String attributeName, List<RemotableAttributeField> remotableAttributeFields) { |
67 | 0 | if (StringUtils.isBlank(attributeName)) { |
68 | 0 | throw new IllegalArgumentException("attributeName was blank or null"); |
69 | |
} |
70 | 0 | if (remotableAttributeFields == null) { |
71 | 0 | throw new IllegalArgumentException("attributeFields was blank or null"); |
72 | |
} |
73 | 0 | this.attributeName = attributeName; |
74 | 0 | this.remotableAttributeFields = Collections.unmodifiableList(new ArrayList<RemotableAttributeField>(remotableAttributeFields)); |
75 | 0 | } |
76 | |
|
77 | |
public static AttributeFields create(String attributeName, List<RemotableAttributeField> attributeFields) { |
78 | 0 | if (attributeFields == null) { |
79 | 0 | attributeFields = Collections.emptyList(); |
80 | |
} |
81 | 0 | return new AttributeFields(attributeName, attributeFields); |
82 | |
} |
83 | |
|
84 | |
public String getAttributeName() { |
85 | 0 | return attributeName; |
86 | |
} |
87 | |
|
88 | |
public List<RemotableAttributeField> getRemotableAttributeFields() { |
89 | 0 | return remotableAttributeFields; |
90 | |
} |
91 | |
|
92 | |
|
93 | |
|
94 | |
|
95 | 0 | static class Constants { |
96 | |
final static String ROOT_ELEMENT_NAME = "attributeFields"; |
97 | |
final static String TYPE_NAME = "AttributeFieldsType"; |
98 | |
} |
99 | |
|
100 | |
|
101 | |
|
102 | |
|
103 | |
|
104 | 0 | static class Elements { |
105 | |
final static String ATTRIBUTE_NAME = "attributeName"; |
106 | |
final static String REMOTABLE_ATTRIBUTE_FIELDS = "remotableAttributeFields"; |
107 | |
final static String REMOTABLE_ATTRIBUTE_FIELD = "remotableAttributeField"; |
108 | |
} |
109 | |
|
110 | |
} |