1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.core.api.mo;
17
18 import java.io.Serializable;
19 import java.util.Collection;
20 import javax.xml.bind.annotation.XmlAccessType;
21 import javax.xml.bind.annotation.XmlAccessorType;
22 import javax.xml.bind.annotation.XmlAnyElement;
23 import javax.xml.bind.annotation.XmlElement;
24 import javax.xml.bind.annotation.XmlRootElement;
25 import javax.xml.bind.annotation.XmlType;
26 import org.joda.time.LocalDate;
27 import org.kuali.kpme.core.api.groupkey.HrGroupKey;
28 import org.kuali.rice.core.api.CoreConstants;
29 import org.kuali.rice.core.api.mo.AbstractDataTransferObject;
30 import org.kuali.rice.core.api.mo.ModelBuilder;
31 import org.w3c.dom.Element;
32
33 @XmlRootElement(name = EffectiveKey.Constants.ROOT_ELEMENT_NAME)
34 @XmlAccessorType(XmlAccessType.NONE)
35 @XmlType(name = EffectiveKey.Constants.TYPE_NAME, propOrder = {
36 EffectiveKey.Elements.ID,
37 EffectiveKey.Elements.OWNER_ID,
38 EffectiveKey.Elements.EFFECTIVE_LOCAL_DATE_OF_OWNER,
39 CoreConstants.CommonElements.VERSION_NUMBER,
40 CoreConstants.CommonElements.OBJECT_ID,
41 EffectiveKey.Elements.GROUP_KEY_CODE,
42 EffectiveKey.Elements.GROUP_KEY,
43 CoreConstants.CommonElements.FUTURE_ELEMENTS
44 })
45 public final class EffectiveKey extends AbstractDataTransferObject implements EffectiveKeyContract {
46
47 private static final long serialVersionUID = -1424727410760335085L;
48
49 @XmlElement(name = Elements.ID, required = false)
50 private final String id;
51 @XmlElement(name = Elements.OWNER_ID, required = false)
52 private final String ownerId;
53 @XmlElement(name = Elements.EFFECTIVE_LOCAL_DATE_OF_OWNER, required = false)
54 private final LocalDate effectiveLocalDateOfOwner;
55 @XmlElement(name = CoreConstants.CommonElements.VERSION_NUMBER, required = false)
56 private final Long versionNumber;
57 @XmlElement(name = CoreConstants.CommonElements.OBJECT_ID, required = false)
58 private final String objectId;
59 @XmlElement(name = Elements.GROUP_KEY_CODE, required = false)
60 private final String groupKeyCode;
61 @XmlElement(name = Elements.GROUP_KEY, required = false)
62 private final HrGroupKey groupKey;
63 @XmlAnyElement
64 private final Collection<Element> _futureElements = null;
65
66
67
68
69
70 private EffectiveKey() {
71 this.id = null;
72 this.ownerId = null;
73 this.effectiveLocalDateOfOwner = null;
74 this.versionNumber = null;
75 this.objectId = null;
76 this.groupKeyCode = null;
77 this.groupKey = null;
78 }
79
80 private EffectiveKey(Builder builder) {
81 this.id = builder.getId();
82 this.ownerId = builder.getOwnerId();
83 this.effectiveLocalDateOfOwner = builder.getEffectiveLocalDateOfOwner();
84 this.versionNumber = builder.getVersionNumber();
85 this.objectId = builder.getObjectId();
86 this.groupKeyCode = builder.getGroupKeyCode();
87 this.groupKey = builder.getGroupKey() == null ? null : builder.getGroupKey().build();
88 }
89
90 @Override
91 public String getId() {
92 return this.id;
93 }
94
95 @Override
96 public String getOwnerId() {
97 return this.ownerId;
98 }
99
100 @Override
101 public LocalDate getEffectiveLocalDateOfOwner() {
102 return this.effectiveLocalDateOfOwner;
103 }
104
105 @Override
106 public Long getVersionNumber() {
107 return this.versionNumber;
108 }
109
110 @Override
111 public String getObjectId() {
112 return this.objectId;
113 }
114
115 @Override
116 public String getGroupKeyCode() {
117 return this.groupKeyCode;
118 }
119
120 @Override
121 public HrGroupKey getGroupKey() {
122 return this.groupKey;
123 }
124
125
126
127
128
129
130 public final static class Builder implements Serializable, EffectiveKeyContract, ModelBuilder {
131
132 private static final long serialVersionUID = -5315864638775959006L;
133
134 private String id;
135 private String ownerId;
136 private LocalDate effectiveLocalDateOfOwner;
137 private Long versionNumber;
138 private String objectId;
139 private String groupKeyCode;
140 private HrGroupKey.Builder groupKey;
141
142 private Builder() {
143
144 }
145
146 public static Builder create() {
147
148 return new Builder();
149 }
150
151 public static Builder create(EffectiveKeyContract contract) {
152 if (contract == null) {
153 throw new IllegalArgumentException("contract was null");
154 }
155
156 Builder builder = create();
157 builder.setId(contract.getId());
158 builder.setOwnerId(contract.getOwnerId());
159 builder.setEffectiveLocalDateOfOwner(contract.getEffectiveLocalDateOfOwner());
160 builder.setVersionNumber(contract.getVersionNumber());
161 builder.setObjectId(contract.getObjectId());
162 builder.setGroupKeyCode(contract.getGroupKeyCode());
163 builder.setGroupKey(contract.getGroupKey() == null ? null : HrGroupKey.Builder.create(contract.getGroupKey()));
164 return builder;
165 }
166
167 public EffectiveKey build() {
168 return new EffectiveKey(this);
169 }
170
171 @Override
172 public String getId() {
173 return this.id;
174 }
175
176 @Override
177 public String getOwnerId() {
178 return this.ownerId;
179 }
180
181 @Override
182 public LocalDate getEffectiveLocalDateOfOwner() {
183 return this.effectiveLocalDateOfOwner;
184 }
185
186 @Override
187 public Long getVersionNumber() {
188 return this.versionNumber;
189 }
190
191 @Override
192 public String getObjectId() {
193 return this.objectId;
194 }
195
196 @Override
197 public String getGroupKeyCode() {
198 return this.groupKeyCode;
199 }
200
201 @Override
202 public HrGroupKey.Builder getGroupKey() {
203 return this.groupKey;
204 }
205
206 public void setId(String id) {
207
208 this.id = id;
209 }
210
211 public void setOwnerId(String ownerId) {
212
213 this.ownerId = ownerId;
214 }
215
216 public void setEffectiveLocalDateOfOwner(LocalDate effectiveLocalDateOfOwner) {
217
218 this.effectiveLocalDateOfOwner = effectiveLocalDateOfOwner;
219 }
220
221 public void setVersionNumber(Long versionNumber) {
222
223 this.versionNumber = versionNumber;
224 }
225
226 public void setObjectId(String objectId) {
227
228 this.objectId = objectId;
229 }
230
231 public void setGroupKeyCode(String groupKeyCode) {
232
233 this.groupKeyCode = groupKeyCode;
234 }
235
236 public void setGroupKey(HrGroupKey.Builder groupKey) {
237
238 this.groupKey = groupKey;
239 }
240
241 }
242
243
244
245
246
247
248 static class Constants {
249
250 final static String ROOT_ELEMENT_NAME = "effectiveKey";
251 final static String TYPE_NAME = "EffectiveKeyType";
252
253 }
254
255
256
257
258
259
260 static class Elements {
261
262 final static String ID = "id";
263 final static String OWNER_ID = "ownerId";
264 final static String EFFECTIVE_LOCAL_DATE_OF_OWNER = "effectiveLocalDateOfOwner";
265 final static String GROUP_KEY_CODE = "groupKeyCode";
266 final static String GROUP_KEY = "groupKey";
267
268 }
269
270 }
271