1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kim.api.identity.residency; |
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.mo.ModelBuilder; |
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.io.Serializable; |
31 | |
import java.util.Collection; |
32 | |
|
33 | |
@XmlRootElement(name = EntityResidency.Constants.ROOT_ELEMENT_NAME) |
34 | |
@XmlAccessorType(XmlAccessType.NONE) |
35 | |
@XmlType(name = EntityResidency.Constants.TYPE_NAME, propOrder = { |
36 | |
EntityResidency.Elements.ID, |
37 | |
EntityResidency.Elements.ENTITY_ID, |
38 | |
EntityResidency.Elements.DETERMINATION_METHOD, |
39 | |
EntityResidency.Elements.IN_STATE, |
40 | |
CoreConstants.CommonElements.VERSION_NUMBER, |
41 | |
CoreConstants.CommonElements.OBJECT_ID, |
42 | |
CoreConstants.CommonElements.FUTURE_ELEMENTS |
43 | |
}) |
44 | 0 | public final class EntityResidency extends AbstractDataTransferObject |
45 | |
implements EntityResidencyContract |
46 | |
{ |
47 | |
|
48 | |
@XmlElement(name = Elements.ENTITY_ID, required = false) |
49 | |
private final String entityId; |
50 | |
@XmlElement(name = Elements.DETERMINATION_METHOD, required = false) |
51 | |
private final String determinationMethod; |
52 | |
@XmlElement(name = Elements.IN_STATE, required = false) |
53 | |
private final String inState; |
54 | |
@XmlElement(name = CoreConstants.CommonElements.VERSION_NUMBER, required = false) |
55 | |
private final Long versionNumber; |
56 | |
@XmlElement(name = CoreConstants.CommonElements.OBJECT_ID, required = false) |
57 | |
private final String objectId; |
58 | |
@XmlElement(name = Elements.ID, required = false) |
59 | |
private final String id; |
60 | 0 | @SuppressWarnings("unused") |
61 | |
@XmlAnyElement |
62 | |
private final Collection<Element> _futureElements = null; |
63 | |
|
64 | |
|
65 | |
|
66 | |
|
67 | |
|
68 | 0 | private EntityResidency() { |
69 | 0 | this.entityId = null; |
70 | 0 | this.determinationMethod = null; |
71 | 0 | this.inState = null; |
72 | 0 | this.versionNumber = null; |
73 | 0 | this.objectId = null; |
74 | 0 | this.id = null; |
75 | 0 | } |
76 | |
|
77 | 0 | private EntityResidency(Builder builder) { |
78 | 0 | this.entityId = builder.getEntityId(); |
79 | 0 | this.determinationMethod = builder.getDeterminationMethod(); |
80 | 0 | this.inState = builder.getInState(); |
81 | 0 | this.versionNumber = builder.getVersionNumber(); |
82 | 0 | this.objectId = builder.getObjectId(); |
83 | 0 | this.id = builder.getId(); |
84 | 0 | } |
85 | |
|
86 | |
@Override |
87 | |
public String getEntityId() { |
88 | 0 | return this.entityId; |
89 | |
} |
90 | |
|
91 | |
@Override |
92 | |
public String getDeterminationMethod() { |
93 | 0 | return this.determinationMethod; |
94 | |
} |
95 | |
|
96 | |
@Override |
97 | |
public String getInState() { |
98 | 0 | return this.inState; |
99 | |
} |
100 | |
|
101 | |
@Override |
102 | |
public Long getVersionNumber() { |
103 | 0 | return this.versionNumber; |
104 | |
} |
105 | |
|
106 | |
@Override |
107 | |
public String getObjectId() { |
108 | 0 | return this.objectId; |
109 | |
} |
110 | |
|
111 | |
@Override |
112 | |
public String getId() { |
113 | 0 | return this.id; |
114 | |
} |
115 | |
|
116 | |
|
117 | |
|
118 | |
|
119 | |
|
120 | |
|
121 | 0 | public final static class Builder |
122 | |
implements Serializable, ModelBuilder, EntityResidencyContract |
123 | |
{ |
124 | |
|
125 | |
private String entityId; |
126 | |
private String determinationMethod; |
127 | |
private String inState; |
128 | |
private Long versionNumber; |
129 | |
private String objectId; |
130 | |
private String id; |
131 | |
|
132 | 0 | private Builder() { } |
133 | |
|
134 | |
public static Builder create() { |
135 | 0 | return new Builder(); |
136 | |
} |
137 | |
|
138 | |
public static Builder create(EntityResidencyContract contract) { |
139 | 0 | if (contract == null) { |
140 | 0 | throw new IllegalArgumentException("contract was null"); |
141 | |
} |
142 | 0 | Builder builder = create(); |
143 | 0 | builder.setEntityId(contract.getEntityId()); |
144 | 0 | builder.setDeterminationMethod(contract.getDeterminationMethod()); |
145 | 0 | builder.setInState(contract.getInState()); |
146 | 0 | builder.setVersionNumber(contract.getVersionNumber()); |
147 | 0 | builder.setObjectId(contract.getObjectId()); |
148 | 0 | builder.setId(contract.getId()); |
149 | 0 | return builder; |
150 | |
} |
151 | |
|
152 | |
public EntityResidency build() { |
153 | 0 | return new EntityResidency(this); |
154 | |
} |
155 | |
|
156 | |
@Override |
157 | |
public String getEntityId() { |
158 | 0 | return this.entityId; |
159 | |
} |
160 | |
|
161 | |
@Override |
162 | |
public String getDeterminationMethod() { |
163 | 0 | return this.determinationMethod; |
164 | |
} |
165 | |
|
166 | |
@Override |
167 | |
public String getInState() { |
168 | 0 | return this.inState; |
169 | |
} |
170 | |
|
171 | |
@Override |
172 | |
public Long getVersionNumber() { |
173 | 0 | return this.versionNumber; |
174 | |
} |
175 | |
|
176 | |
@Override |
177 | |
public String getObjectId() { |
178 | 0 | return this.objectId; |
179 | |
} |
180 | |
|
181 | |
@Override |
182 | |
public String getId() { |
183 | 0 | return this.id; |
184 | |
} |
185 | |
|
186 | |
public void setEntityId(String entityId) { |
187 | 0 | this.entityId = entityId; |
188 | 0 | } |
189 | |
|
190 | |
public void setDeterminationMethod(String determinationMethod) { |
191 | 0 | this.determinationMethod = determinationMethod; |
192 | 0 | } |
193 | |
|
194 | |
public void setInState(String inState) { |
195 | 0 | this.inState = inState; |
196 | 0 | } |
197 | |
|
198 | |
public void setVersionNumber(Long versionNumber) { |
199 | 0 | this.versionNumber = versionNumber; |
200 | 0 | } |
201 | |
|
202 | |
public void setObjectId(String objectId) { |
203 | 0 | this.objectId = objectId; |
204 | 0 | } |
205 | |
|
206 | |
public void setId(String id) { |
207 | 0 | if (StringUtils.isWhitespace(id)) { |
208 | 0 | throw new IllegalArgumentException("id is blank"); |
209 | |
} |
210 | 0 | this.id = id; |
211 | 0 | } |
212 | |
|
213 | |
} |
214 | |
|
215 | |
|
216 | |
|
217 | |
|
218 | |
|
219 | |
|
220 | 0 | static class Constants { |
221 | |
|
222 | |
final static String ROOT_ELEMENT_NAME = "entityResidency"; |
223 | |
final static String TYPE_NAME = "entityResidencyType"; |
224 | |
} |
225 | |
|
226 | |
|
227 | |
|
228 | |
|
229 | |
|
230 | |
|
231 | 0 | static class Elements { |
232 | |
|
233 | |
final static String ENTITY_ID = "entityId"; |
234 | |
final static String DETERMINATION_METHOD = "determinationMethod"; |
235 | |
final static String IN_STATE = "inState"; |
236 | |
final static String ID = "id"; |
237 | |
|
238 | |
} |
239 | |
|
240 | |
} |