1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.core.api.parameter; |
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.w3c.dom.Element; |
22 | |
|
23 | |
import javax.xml.bind.annotation.XmlAccessType; |
24 | |
import javax.xml.bind.annotation.XmlAccessorType; |
25 | |
import javax.xml.bind.annotation.XmlAnyElement; |
26 | |
import javax.xml.bind.annotation.XmlElement; |
27 | |
import javax.xml.bind.annotation.XmlRootElement; |
28 | |
import javax.xml.bind.annotation.XmlType; |
29 | |
import java.util.Collection; |
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
@XmlRootElement(name = ParameterKey.Constants.ROOT_ELEMENT_NAME) |
38 | |
@XmlAccessorType(XmlAccessType.NONE) |
39 | |
@XmlType(name = ParameterKey.Constants.TYPE_NAME, propOrder = { |
40 | |
ParameterKey.Elements.APPLICATION_ID, |
41 | |
ParameterKey.Elements.NAMESPACE_CODE, |
42 | |
ParameterKey.Elements.COMPONENT_CODE, |
43 | |
ParameterKey.Elements.NAME, |
44 | |
CoreConstants.CommonElements.FUTURE_ELEMENTS |
45 | |
}) |
46 | |
public final class ParameterKey extends AbstractDataTransferObject { |
47 | |
|
48 | |
private static final long serialVersionUID = -4405355319548951283L; |
49 | |
|
50 | |
@XmlElement(name = Elements.APPLICATION_ID, required=true) |
51 | |
private final String applicationId; |
52 | |
|
53 | |
@XmlElement(name = Elements.NAMESPACE_CODE, required=true) |
54 | |
private final String namespaceCode; |
55 | |
|
56 | |
@XmlElement(name = Elements.COMPONENT_CODE, required=true) |
57 | |
private final String componentCode; |
58 | |
|
59 | |
@XmlElement(name = Elements.NAME, required=true) |
60 | |
private final String name; |
61 | |
|
62 | 0 | @SuppressWarnings("unused") |
63 | |
@XmlAnyElement |
64 | |
private final Collection<Element> _futureElements = null; |
65 | |
|
66 | |
|
67 | |
|
68 | |
|
69 | 0 | private ParameterKey() { |
70 | 0 | this.applicationId = null; |
71 | 0 | this.namespaceCode = null; |
72 | 0 | this.componentCode = null; |
73 | 0 | this.name = null; |
74 | 0 | } |
75 | |
|
76 | |
|
77 | |
|
78 | |
|
79 | 0 | private ParameterKey(String applicationId, String namespaceCode, String componentCode, String name) { |
80 | 0 | if (StringUtils.isBlank(applicationId)) { |
81 | 0 | throw new IllegalArgumentException("applicationId is blank"); |
82 | |
} |
83 | 0 | if (StringUtils.isBlank(namespaceCode)) { |
84 | 0 | throw new IllegalArgumentException("namespaceCode is blank"); |
85 | |
} |
86 | 0 | if (StringUtils.isBlank(componentCode)) { |
87 | 0 | throw new IllegalArgumentException("componentCode is blank"); |
88 | |
} |
89 | 0 | if (StringUtils.isBlank(name)) { |
90 | 0 | throw new IllegalArgumentException("name is blank"); |
91 | |
} |
92 | 0 | this.applicationId = applicationId; |
93 | 0 | this.namespaceCode = namespaceCode; |
94 | 0 | this.componentCode = componentCode; |
95 | 0 | this.name = name; |
96 | 0 | } |
97 | |
|
98 | |
|
99 | |
|
100 | |
|
101 | |
|
102 | |
|
103 | |
|
104 | |
|
105 | |
|
106 | |
|
107 | |
|
108 | |
public static ParameterKey create(String applicationId, String namespaceCode, String componentCode, String name) { |
109 | 0 | return new ParameterKey(applicationId, namespaceCode, componentCode, name); |
110 | |
} |
111 | |
|
112 | |
public String getApplicationId() { |
113 | 0 | return applicationId; |
114 | |
} |
115 | |
|
116 | |
public String getNamespaceCode() { |
117 | 0 | return namespaceCode; |
118 | |
} |
119 | |
|
120 | |
public String getComponentCode() { |
121 | 0 | return componentCode; |
122 | |
} |
123 | |
|
124 | |
public String getName() { |
125 | 0 | return name; |
126 | |
} |
127 | |
|
128 | |
|
129 | |
|
130 | |
|
131 | 0 | static class Constants { |
132 | |
final static String ROOT_ELEMENT_NAME = "parameterKey"; |
133 | |
final static String TYPE_NAME = "ParameterKeyType"; |
134 | |
} |
135 | |
|
136 | |
|
137 | |
|
138 | |
|
139 | |
|
140 | 0 | static class Elements { |
141 | |
final static String APPLICATION_ID = "applicationId"; |
142 | |
final static String NAMESPACE_CODE = "namespaceCode"; |
143 | |
final static String COMPONENT_CODE = "componentCode"; |
144 | |
final static String NAME = "name"; |
145 | |
} |
146 | |
|
147 | |
} |