View Javadoc
1   
2   package org.kuali.kpme.edo.api.vote;
3   
4   import java.io.Serializable;
5   import java.sql.Timestamp;
6   import java.util.Collection;
7   
8   import javax.xml.bind.annotation.XmlAccessType;
9   import javax.xml.bind.annotation.XmlAccessorType;
10  import javax.xml.bind.annotation.XmlAnyElement;
11  import javax.xml.bind.annotation.XmlElement;
12  import javax.xml.bind.annotation.XmlRootElement;
13  import javax.xml.bind.annotation.XmlType;
14  import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
15  
16  import org.joda.time.DateTime;
17  import org.joda.time.LocalDate;
18  import org.kuali.kpme.edo.api.dossier.EdoDossier.Builder;
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.kuali.rice.core.api.util.jaxb.DateTimeAdapter;
23  import org.kuali.rice.core.api.util.jaxb.LocalDateAdapter;
24  import org.w3c.dom.Element;
25  
26  @XmlRootElement(name = EdoVoteRecord.Constants.ROOT_ELEMENT_NAME)
27  @XmlAccessorType(XmlAccessType.NONE)
28  @XmlType(name = EdoVoteRecord.Constants.TYPE_NAME, propOrder = {
29      EdoVoteRecord.Elements.VOTE_SUB_ROUND,
30      EdoVoteRecord.Elements.ABSTAIN_COUNT,
31      EdoVoteRecord.Elements.EDO_VOTE_RECORD_ID,
32      EdoVoteRecord.Elements.EDO_DOSSIER_ID,
33      EdoVoteRecord.Elements.ABSENT_COUNT,
34      EdoVoteRecord.Elements.EDO_REVIEW_LAYER_DEFINITION_ID,
35      EdoVoteRecord.Elements.NO_COUNT,
36      EdoVoteRecord.Elements.VOTE_ROUND,
37      EdoVoteRecord.Elements.YES_COUNT,
38      EdoVoteRecord.Elements.AOE_CODE,
39      EdoVoteRecord.Elements.VOTE_TYPE,
40      EdoVoteRecord.Elements.CREATED_AT,
41      EdoVoteRecord.Elements.UPDATED_AT,
42      EdoVoteRecord.Elements.CREATED_BY,
43      
44      CoreConstants.CommonElements.VERSION_NUMBER,
45      CoreConstants.CommonElements.OBJECT_ID,
46      CoreConstants.CommonElements.FUTURE_ELEMENTS
47  })
48  public final class EdoVoteRecord
49      extends AbstractDataTransferObject
50      implements EdoVoteRecordContract
51  {
52  
53      @XmlElement(name = Elements.VOTE_SUB_ROUND, required = false)
54      private final Integer voteSubRound;
55      @XmlElement(name = Elements.ABSTAIN_COUNT, required = false)
56      private final Integer abstainCount;
57      @XmlElement(name = Elements.EDO_VOTE_RECORD_ID, required = false)
58      private final String edoVoteRecordId;
59      @XmlElement(name = Elements.EDO_DOSSIER_ID, required = false)
60      private final String edoDossierId;
61      @XmlElement(name = Elements.ABSENT_COUNT, required = false)
62      private final Integer absentCount;
63      @XmlElement(name = Elements.EDO_REVIEW_LAYER_DEFINITION_ID, required = false)
64      private final String edoReviewLayerDefinitionId;
65      @XmlElement(name = Elements.NO_COUNT, required = false)
66      private final Integer noCount;
67      @XmlElement(name = Elements.VOTE_ROUND, required = false)
68      private final Integer voteRound;
69      @XmlElement(name = Elements.YES_COUNT, required = false)
70      private final Integer yesCount;
71      @XmlElement(name = Elements.AOE_CODE, required = false)
72      private final String aoeCode;
73      @XmlElement(name = Elements.VOTE_TYPE, required = false)
74      private final String voteType;
75      @XmlElement(name = CoreConstants.CommonElements.VERSION_NUMBER, required = false)
76      private final Long versionNumber;
77      @XmlElement(name = CoreConstants.CommonElements.OBJECT_ID, required = false)
78      private final String objectId;
79  
80      @XmlJavaTypeAdapter(DateTimeAdapter.class)
81      @XmlElement(name = Elements.CREATED_AT, required = false)
82      private final DateTime createdAt;
83      @XmlJavaTypeAdapter(DateTimeAdapter.class)
84      @XmlElement(name = Elements.UPDATED_AT, required = false)
85      private final DateTime updatedAt;
86      @XmlElement(name = Elements.CREATED_BY, required = false)
87      private final String createdBy;
88      @SuppressWarnings("unused")
89      @XmlAnyElement
90      private final Collection<Element> _futureElements = null;
91  
92      /**
93       * Private constructor used only by JAXB.
94       * 
95       */
96      private EdoVoteRecord() {
97          this.voteSubRound = null;
98          this.abstainCount = null;
99          this.edoVoteRecordId = null;
100         this.edoDossierId = null;
101         this.absentCount = null;
102         this.edoReviewLayerDefinitionId = null;
103         this.noCount = null;
104         this.voteRound = null;
105         this.yesCount = null;
106         this.aoeCode = null;
107         this.voteType = null;
108         this.versionNumber = null;
109         this.objectId = null;
110         this.createdAt = null;
111         this.updatedAt = null;
112         this.createdBy = null;
113     }
114 
115     private EdoVoteRecord(Builder builder) {
116         this.voteSubRound = builder.getVoteSubRound();
117         this.abstainCount = builder.getAbstainCount();
118         this.edoVoteRecordId = builder.getEdoVoteRecordId();
119         this.edoDossierId = builder.getEdoDossierId();
120         this.absentCount = builder.getAbsentCount();
121         this.edoReviewLayerDefinitionId = builder.getEdoReviewLayerDefinitionId();
122         this.noCount = builder.getNoCount();
123         this.voteRound = builder.getVoteRound();
124         this.yesCount = builder.getYesCount();
125         this.aoeCode = builder.getAoeCode();
126         this.voteType = builder.getVoteType();
127         this.versionNumber = builder.getVersionNumber();
128         this.objectId = builder.getObjectId();
129         this.createdAt = builder.getCreatedAt();
130         this.updatedAt = builder.getUpdatedAt();
131         this.createdBy = builder.getCreatedBy();
132     }
133 
134     @Override
135     public Integer getVoteSubRound() {
136         return this.voteSubRound;
137     }
138 
139     @Override
140     public Integer getAbstainCount() {
141         return this.abstainCount;
142     }
143 
144     @Override
145     public String getEdoVoteRecordId() {
146         return this.edoVoteRecordId;
147     }
148 
149     @Override
150     public String getEdoDossierId() {
151         return this.edoDossierId;
152     }
153 
154     @Override
155     public Integer getAbsentCount() {
156         return this.absentCount;
157     }
158 
159     @Override
160     public String getEdoReviewLayerDefinitionId() {
161         return this.edoReviewLayerDefinitionId;
162     }
163 
164     @Override
165     public Integer getNoCount() {
166         return this.noCount;
167     }
168 
169     @Override
170     public Integer getVoteRound() {
171         return this.voteRound;
172     }
173 
174     @Override
175     public Integer getYesCount() {
176         return this.yesCount;
177     }
178 
179     @Override
180     public String getAoeCode() {
181         return this.aoeCode;
182     }
183 
184     @Override
185     public String getVoteType() {
186         return this.voteType;
187     }
188 
189     @Override
190     public Long getVersionNumber() {
191         return this.versionNumber;
192     }
193 
194     @Override
195     public String getObjectId() {
196         return this.objectId;
197     }
198 
199     @Override
200     public DateTime getCreatedAt() {
201         return this.createdAt;
202     }
203 
204     @Override
205     public DateTime getUpdatedAt() {
206         return this.updatedAt;
207     }
208 
209     @Override
210     public String getCreatedBy() {
211         return this.createdBy;
212     }
213 
214 
215     /**
216      * A builder which can be used to construct {@link EdoVoteRecord} instances.  Enforces the constraints of the {@link EdoVoteRecordContract}.
217      * 
218      */
219     public final static class Builder
220         implements Serializable, EdoVoteRecordContract, ModelBuilder
221     {
222 
223         private Integer voteSubRound;
224         private Integer abstainCount;
225         private String edoVoteRecordId;
226         private String edoDossierId;
227         private Integer absentCount;
228         private String edoReviewLayerDefinitionId;
229         private Integer noCount;
230         private Integer voteRound;
231         private Integer yesCount;
232         private String aoeCode;
233         private String voteType;
234         private Long versionNumber;
235         private String objectId;
236         
237         private DateTime updatedAt;
238         private DateTime createdAt;
239         private String createdBy;
240 
241         private Builder() {
242             // TODO modify this constructor as needed to pass any required values and invoke the appropriate 'setter' methods
243         }
244 
245         public static Builder create() {
246             // TODO modify as needed to pass any required values and add them to the signature of the 'create' method
247             return new Builder();
248         }
249 
250         private Builder(String edoDossierId, String edoReviewLayerDefinitionId, String voteType, Integer voteRound, Integer voteSubRound) {
251             // TODO modify this constructor as needed to pass any required values and invoke the appropriate 'setter' methods
252         	setEdoDossierId(edoDossierId);
253         	setEdoReviewLayerDefinitionId(edoReviewLayerDefinitionId);
254         	setVoteType(voteType);
255         	setVoteRound(voteRound);
256         	setVoteSubRound(voteSubRound);
257         }
258 
259         public static Builder create(String edoDossierId, String edoReviewLayerDefinitionId, String voteType, Integer voteRound, Integer voteSubRound) {
260             // TODO modify as needed to pass any required values and add them to the signature of the 'create' method
261             return new Builder(edoDossierId, edoReviewLayerDefinitionId, voteType, voteRound, voteSubRound);
262         }
263         
264         
265         public static Builder create(EdoVoteRecordContract contract) {
266             if (contract == null) {
267                 throw new IllegalArgumentException("contract was null");
268             }
269             // TODO if create() is modified to accept required parameters, this will need to be modified
270             Builder builder = create();
271             builder.setVoteSubRound(contract.getVoteSubRound());
272             builder.setAbstainCount(contract.getAbstainCount());
273             builder.setEdoVoteRecordId(contract.getEdoVoteRecordId());
274             builder.setEdoDossierId(contract.getEdoDossierId());
275             builder.setAbsentCount(contract.getAbsentCount());
276             builder.setEdoReviewLayerDefinitionId(contract.getEdoReviewLayerDefinitionId());
277             builder.setNoCount(contract.getNoCount());
278             builder.setVoteRound(contract.getVoteRound());
279             builder.setYesCount(contract.getYesCount());
280             builder.setAoeCode(contract.getAoeCode());
281             builder.setVoteType(contract.getVoteType());
282             builder.setVersionNumber(contract.getVersionNumber());
283             builder.setObjectId(contract.getObjectId());
284            
285             builder.setCreatedAt(contract.getCreatedAt());
286             builder.setUpdatedAt(contract.getUpdatedAt());
287             builder.setCreatedBy(contract.getCreatedBy());
288             return builder;
289         }
290 
291         public EdoVoteRecord build() {
292             return new EdoVoteRecord(this);
293         }
294 
295         @Override
296         public Integer getVoteSubRound() {
297             return this.voteSubRound;
298         }
299 
300         @Override
301         public Integer getAbstainCount() {
302             return this.abstainCount;
303         }
304 
305         @Override
306         public String getEdoVoteRecordId() {
307             return this.edoVoteRecordId;
308         }
309 
310         @Override
311         public String getEdoDossierId() {
312             return this.edoDossierId;
313         }
314 
315         @Override
316         public Integer getAbsentCount() {
317             return this.absentCount;
318         }
319 
320         @Override
321         public String getEdoReviewLayerDefinitionId() {
322             return this.edoReviewLayerDefinitionId;
323         }
324 
325         @Override
326         public Integer getNoCount() {
327             return this.noCount;
328         }
329 
330         @Override
331         public Integer getVoteRound() {
332             return this.voteRound;
333         }
334 
335         @Override
336         public Integer getYesCount() {
337             return this.yesCount;
338         }
339 
340         @Override
341         public String getAoeCode() {
342             return this.aoeCode;
343         }
344 
345         @Override
346         public String getVoteType() {
347             return this.voteType;
348         }
349 
350         @Override
351         public Long getVersionNumber() {
352             return this.versionNumber;
353         }
354 
355         @Override
356         public String getObjectId() {
357             return this.objectId;
358         }
359 
360         @Override
361         public DateTime getCreatedAt() {
362             return this.createdAt;
363         }
364 
365         @Override
366         public DateTime getUpdatedAt() {
367             return this.updatedAt;
368         }
369 
370         @Override
371         public String getCreatedBy() {
372             return this.createdBy;
373         }
374 
375 
376         public void setVoteSubRound(Integer voteSubRound) {
377             // TODO add validation of input value if required and throw IllegalArgumentException if needed
378             this.voteSubRound = voteSubRound;
379         }
380 
381         public void setAbstainCount(Integer abstainCount) {
382             // TODO add validation of input value if required and throw IllegalArgumentException if needed
383             this.abstainCount = abstainCount;
384         }
385 
386         public void setEdoVoteRecordId(String edoVoteRecordId) {
387             // TODO add validation of input value if required and throw IllegalArgumentException if needed
388             this.edoVoteRecordId = edoVoteRecordId;
389         }
390 
391         public void setEdoDossierId(String edoDossierId) {
392             // TODO add validation of input value if required and throw IllegalArgumentException if needed
393             this.edoDossierId = edoDossierId;
394         }
395 
396         public void setAbsentCount(Integer absentCount) {
397             // TODO add validation of input value if required and throw IllegalArgumentException if needed
398             this.absentCount = absentCount;
399         }
400 
401         public void setEdoReviewLayerDefinitionId(String edoReviewLayerDefinitionId) {
402             // TODO add validation of input value if required and throw IllegalArgumentException if needed
403             this.edoReviewLayerDefinitionId = edoReviewLayerDefinitionId;
404         }
405 
406         public void setNoCount(Integer noCount) {
407             // TODO add validation of input value if required and throw IllegalArgumentException if needed
408             this.noCount = noCount;
409         }
410 
411         public void setVoteRound(Integer voteRound) {
412             // TODO add validation of input value if required and throw IllegalArgumentException if needed
413             this.voteRound = voteRound;
414         }
415 
416         public void setYesCount(Integer yesCount) {
417             // TODO add validation of input value if required and throw IllegalArgumentException if needed
418             this.yesCount = yesCount;
419         }
420 
421         public void setAoeCode(String aoeCode) {
422             // TODO add validation of input value if required and throw IllegalArgumentException if needed
423             this.aoeCode = aoeCode;
424         }
425 
426         public void setVoteType(String voteType) {
427             // TODO add validation of input value if required and throw IllegalArgumentException if needed
428             this.voteType = voteType;
429         }
430 
431         public void setVersionNumber(Long versionNumber) {
432             // TODO add validation of input value if required and throw IllegalArgumentException if needed
433             this.versionNumber = versionNumber;
434         }
435 
436         public void setObjectId(String objectId) {
437             // TODO add validation of input value if required and throw IllegalArgumentException if needed
438             this.objectId = objectId;
439         }
440 
441         public void setCreatedAt(DateTime createdAt) {
442             // TODO add validation of input value if required and throw IllegalArgumentException if needed
443             this.createdAt = createdAt;
444         }
445 
446         public void setUpdatedAt(DateTime updatedAt) {
447             // TODO add validation of input value if required and throw IllegalArgumentException if needed
448             this.updatedAt = updatedAt;
449         }
450 
451         public void setCreatedBy(String createdBy) {
452             // TODO add validation of input value if required and throw IllegalArgumentException if needed
453             this.createdBy = createdBy;
454         }
455 
456     }
457 
458 
459     /**
460      * Defines some internal constants used on this class.
461      * 
462      */
463     static class Constants {
464 
465         final static String ROOT_ELEMENT_NAME = "edoVoteRecord";
466         final static String TYPE_NAME = "EdoVoteRecordType";
467 
468     }
469 
470 
471     /**
472      * A private class which exposes constants which define the XML element names to use when this object is marshalled to XML.
473      * 
474      */
475     static class Elements {
476 
477         final static String VOTE_SUB_ROUND = "voteSubRound";
478         final static String ABSTAIN_COUNT = "abstainCount";
479         final static String EDO_VOTE_RECORD_ID = "edoVoteRecordId";
480         final static String EDO_DOSSIER_ID = "edoDossierId";
481         final static String ABSENT_COUNT = "absentCount";
482         final static String EDO_REVIEW_LAYER_DEFINITION_ID = "edoReviewLayerDefinitionId";
483         final static String NO_COUNT = "noCount";
484         final static String VOTE_ROUND = "voteRound";
485         final static String YES_COUNT = "yesCount";
486         final static String AOE_CODE = "aoeCode";
487         final static String VOTE_TYPE = "voteType";
488         final static String CREATED_AT = "createdAt";
489         final static String UPDATED_AT = "updatedAt";
490         final static String CREATED_BY = "createdBy";
491 
492     }
493 
494 }
495