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