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