View Javadoc
1   /**
2    * Copyright 2004-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.kpme.pm.api.position.funding;
17  
18  import java.io.Serializable;
19  import java.math.BigDecimal;
20  import java.util.Collection;
21  import javax.xml.bind.annotation.XmlAccessType;
22  import javax.xml.bind.annotation.XmlAccessorType;
23  import javax.xml.bind.annotation.XmlAnyElement;
24  import javax.xml.bind.annotation.XmlElement;
25  import javax.xml.bind.annotation.XmlRootElement;
26  import javax.xml.bind.annotation.XmlType;
27  import org.joda.time.LocalDate;
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 = PositionFunding.Constants.ROOT_ELEMENT_NAME)
34  @XmlAccessorType(XmlAccessType.NONE)
35  @XmlType(name = PositionFunding.Constants.TYPE_NAME, propOrder = {
36      PositionFunding.Elements.SUB_OBJECT_CODE,
37      PositionFunding.Elements.PM_POSITION_FUNCTION_ID,
38      PositionFunding.Elements.PRIORITY_FLAG,
39      PositionFunding.Elements.OBJECT_CODE,
40      PositionFunding.Elements.ORG_REF_CODE,
41      PositionFunding.Elements.ACCOUNT,
42      PositionFunding.Elements.SUB_ACCOUNT,
43      PositionFunding.Elements.ORG,
44      PositionFunding.Elements.AMOUNT,
45      PositionFunding.Elements.CHART,
46      PositionFunding.Elements.SOURCE,
47      PositionFunding.Elements.PERCENT,
48      PositionFunding.Elements.HR_POSITION_ID,
49      PositionFunding.Elements.EFFECTIVE_LOCAL_DATE_OF_OWNER,
50      CoreConstants.CommonElements.VERSION_NUMBER,
51      CoreConstants.CommonElements.OBJECT_ID,
52      CoreConstants.CommonElements.FUTURE_ELEMENTS
53  })
54  public final class PositionFunding extends AbstractDataTransferObject implements PositionFundingContract {
55  
56  	private static final long serialVersionUID = 4405475619470263919L;
57  	
58  	@XmlElement(name = Elements.SUB_OBJECT_CODE, required = false)
59      private final String subObjectCode;
60      @XmlElement(name = Elements.PM_POSITION_FUNCTION_ID, required = false)
61      private final String pmPositionFunctionId;
62      @XmlElement(name = Elements.PRIORITY_FLAG, required = false)
63      private final boolean priorityFlag;
64      @XmlElement(name = Elements.OBJECT_CODE, required = false)
65      private final String objectCode;
66      @XmlElement(name = Elements.ORG_REF_CODE, required = false)
67      private final String orgRefCode;
68      @XmlElement(name = Elements.ACCOUNT, required = false)
69      private final String account;
70      @XmlElement(name = Elements.SUB_ACCOUNT, required = false)
71      private final String subAccount;
72      @XmlElement(name = Elements.ORG, required = false)
73      private final String org;
74      @XmlElement(name = Elements.AMOUNT, required = false)
75      private final BigDecimal amount;
76      @XmlElement(name = Elements.CHART, required = false)
77      private final String chart;
78      @XmlElement(name = Elements.SOURCE, required = false)
79      private final String source;
80      @XmlElement(name = Elements.PERCENT, required = false)
81      private final BigDecimal percent;
82      @XmlElement(name = Elements.HR_POSITION_ID, required = false)
83      private final String hrPositionId;
84      @XmlElement(name = Elements.EFFECTIVE_LOCAL_DATE_OF_OWNER, required = false)
85      private final LocalDate effectiveLocalDateOfOwner;
86      @XmlElement(name = CoreConstants.CommonElements.VERSION_NUMBER, required = false)
87      private final Long versionNumber;
88      @XmlElement(name = CoreConstants.CommonElements.OBJECT_ID, required = false)
89      private final String objectId;
90      @XmlAnyElement
91      private final Collection<Element> _futureElements = null;
92  
93      /**
94       * Private constructor used only by JAXB.
95       * 
96       */
97      private PositionFunding() {
98          this.subObjectCode = null;
99          this.pmPositionFunctionId = null;
100         this.priorityFlag = false;
101         this.objectCode = null;
102         this.orgRefCode = null;
103         this.account = null;
104         this.subAccount = null;
105         this.org = null;
106         this.amount = null;
107         this.chart = null;
108         this.source = null;
109         this.percent = null;
110         this.hrPositionId = null;
111         this.effectiveLocalDateOfOwner = null;
112         this.versionNumber = null;
113         this.objectId = null;
114     }
115 
116     private PositionFunding(Builder builder) {
117         this.subObjectCode = builder.getSubObjectCode();
118         this.pmPositionFunctionId = builder.getPmPositionFunctionId();
119         this.priorityFlag = builder.isPriorityFlag();
120         this.objectCode = builder.getObjectCode();
121         this.orgRefCode = builder.getOrgRefCode();
122         this.account = builder.getAccount();
123         this.subAccount = builder.getSubAccount();
124         this.org = builder.getOrg();
125         this.amount = builder.getAmount();
126         this.chart = builder.getChart();
127         this.source = builder.getSource();
128         this.percent = builder.getPercent();
129         this.hrPositionId = builder.getHrPositionId();
130         this.effectiveLocalDateOfOwner = builder.getEffectiveLocalDateOfOwner();
131         this.versionNumber = builder.getVersionNumber();
132         this.objectId = builder.getObjectId();
133     }
134 
135     @Override
136     public String getSubObjectCode() {
137         return this.subObjectCode;
138     }
139 
140     @Override
141     public String getPmPositionFunctionId() {
142         return this.pmPositionFunctionId;
143     }
144 
145     @Override
146     public boolean isPriorityFlag() {
147         return this.priorityFlag;
148     }
149 
150     @Override
151     public String getObjectCode() {
152         return this.objectCode;
153     }
154 
155     @Override
156     public String getOrgRefCode() {
157         return this.orgRefCode;
158     }
159 
160     @Override
161     public String getAccount() {
162         return this.account;
163     }
164 
165     @Override
166     public String getSubAccount() {
167         return this.subAccount;
168     }
169 
170     @Override
171     public String getOrg() {
172         return this.org;
173     }
174 
175     @Override
176     public BigDecimal getAmount() {
177         return this.amount;
178     }
179 
180     @Override
181     public String getChart() {
182         return this.chart;
183     }
184 
185     @Override
186     public String getSource() {
187         return this.source;
188     }
189 
190     @Override
191     public BigDecimal getPercent() {
192         return this.percent;
193     }
194     
195     @Override
196     public String getHrPositionId() {
197         return this.hrPositionId;
198     }
199 
200     @Override
201     public LocalDate getEffectiveLocalDateOfOwner() {
202         return this.effectiveLocalDateOfOwner;
203     }
204 
205     @Override
206     public Long getVersionNumber() {
207         return this.versionNumber;
208     }
209 
210     @Override
211     public String getObjectId() {
212         return this.objectId;
213     }
214 
215 
216     /**
217      * A builder which can be used to construct {@link PositionFunding} instances.  Enforces the constraints of the {@link PositionFundingContract}.
218      * 
219      */
220     public final static class Builder implements Serializable, PositionFundingContract, ModelBuilder {
221 
222 		private static final long serialVersionUID = -6059757160893115256L;
223 		
224 		private String subObjectCode;
225         private String pmPositionFunctionId;
226         private boolean priorityFlag;
227         private String objectCode;
228         private String orgRefCode;
229         private String account;
230         private String subAccount;
231         private String org;
232         private BigDecimal amount;
233         private String chart;
234         private String source;
235         private BigDecimal percent;
236         private String hrPositionId;
237         private LocalDate effectiveLocalDateOfOwner;
238         private Long versionNumber;
239         private String objectId;
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 
247             return new Builder();
248         }
249 
250         public static Builder create(PositionFundingContract contract) {
251             if (contract == null) {
252                 throw new IllegalArgumentException("contract was null");
253             }
254 
255             Builder builder = create();
256             builder.setSubObjectCode(contract.getSubObjectCode());
257             builder.setPmPositionFunctionId(contract.getPmPositionFunctionId());
258             builder.setPriorityFlag(contract.isPriorityFlag());
259             builder.setObjectCode(contract.getObjectCode());
260             builder.setOrgRefCode(contract.getOrgRefCode());
261             builder.setAccount(contract.getAccount());
262             builder.setSubAccount(contract.getSubAccount());
263             builder.setOrg(contract.getOrg());
264             builder.setAmount(contract.getAmount());
265             builder.setChart(contract.getChart());
266             builder.setSource(contract.getSource());
267             builder.setPercent(contract.getPercent());
268             builder.setHrPositionId(contract.getHrPositionId());
269             builder.setEffectiveLocalDateOfOwner(contract.getEffectiveLocalDateOfOwner());
270             builder.setVersionNumber(contract.getVersionNumber());
271             builder.setObjectId(contract.getObjectId());
272             return builder;
273         }
274 
275         public PositionFunding build() {
276             return new PositionFunding(this);
277         }
278 
279         @Override
280         public String getSubObjectCode() {
281             return this.subObjectCode;
282         }
283 
284         @Override
285         public String getPmPositionFunctionId() {
286             return this.pmPositionFunctionId;
287         }
288 
289         @Override
290         public boolean isPriorityFlag() {
291             return this.priorityFlag;
292         }
293 
294         @Override
295         public String getObjectCode() {
296             return this.objectCode;
297         }
298 
299         @Override
300         public String getOrgRefCode() {
301             return this.orgRefCode;
302         }
303 
304         @Override
305         public String getAccount() {
306             return this.account;
307         }
308 
309         @Override
310         public String getSubAccount() {
311             return this.subAccount;
312         }
313 
314         @Override
315         public String getOrg() {
316             return this.org;
317         }
318 
319         @Override
320         public BigDecimal getAmount() {
321             return this.amount;
322         }
323 
324         @Override
325         public String getChart() {
326             return this.chart;
327         }
328 
329         @Override
330         public String getSource() {
331             return this.source;
332         }
333 
334         @Override
335         public BigDecimal getPercent() {
336             return this.percent;
337         }
338         
339         @Override
340         public String getHrPositionId() {
341             return this.hrPositionId;
342         }
343 
344         @Override
345         public LocalDate getEffectiveLocalDateOfOwner() {
346             return this.effectiveLocalDateOfOwner;
347         }
348 
349         @Override
350         public Long getVersionNumber() {
351             return this.versionNumber;
352         }
353 
354         @Override
355         public String getObjectId() {
356             return this.objectId;
357         }
358 
359         public void setSubObjectCode(String subObjectCode) {
360 
361             this.subObjectCode = subObjectCode;
362         }
363 
364         public void setPmPositionFunctionId(String pmPositionFunctionId) {
365 
366             this.pmPositionFunctionId = pmPositionFunctionId;
367         }
368 
369         public void setPriorityFlag(boolean priorityFlag) {
370 
371             this.priorityFlag = priorityFlag;
372         }
373 
374         public void setObjectCode(String objectCode) {
375 
376             this.objectCode = objectCode;
377         }
378 
379         public void setOrgRefCode(String orgRefCode) {
380 
381             this.orgRefCode = orgRefCode;
382         }
383 
384         public void setAccount(String account) {
385 
386             this.account = account;
387         }
388 
389         public void setSubAccount(String subAccount) {
390 
391             this.subAccount = subAccount;
392         }
393 
394         public void setOrg(String org) {
395 
396             this.org = org;
397         }
398 
399         public void setAmount(BigDecimal amount) {
400 
401             this.amount = amount;
402         }
403 
404         public void setChart(String chart) {
405 
406             this.chart = chart;
407         }
408 
409         public void setSource(String source) {
410 
411             this.source = source;
412         }
413 
414         public void setPercent(BigDecimal percent) {
415 
416             this.percent = percent;
417         }
418         
419         public void setHrPositionId(String hrPositionId) {
420 
421             this.hrPositionId = hrPositionId;
422         }
423 
424         public void setEffectiveLocalDateOfOwner(LocalDate effectiveLocalDateOfOwner) {
425 
426             this.effectiveLocalDateOfOwner = effectiveLocalDateOfOwner;
427         }
428 
429         public void setVersionNumber(Long versionNumber) {
430 
431             this.versionNumber = versionNumber;
432         }
433 
434         public void setObjectId(String objectId) {
435 
436             this.objectId = objectId;
437         }
438 
439     }
440 
441 
442     /**
443      * Defines some internal constants used on this class.
444      * 
445      */
446     static class Constants {
447 
448         final static String ROOT_ELEMENT_NAME = "positionFunding";
449         final static String TYPE_NAME = "PositionFundingType";
450 
451     }
452 
453 
454     /**
455      * A private class which exposes constants which define the XML element names to use when this object is marshalled to XML.
456      * 
457      */
458     static class Elements {
459 
460         final static String SUB_OBJECT_CODE = "subObjectCode";
461         final static String PM_POSITION_FUNCTION_ID = "pmPositionFunctionId";
462         final static String PRIORITY_FLAG = "priorityFlag";
463         final static String OBJECT_CODE = "objectCode";
464         final static String ORG_REF_CODE = "orgRefCode";
465         final static String ACCOUNT = "account";
466         final static String SUB_ACCOUNT = "subAccount";
467         final static String ORG = "org";
468         final static String AMOUNT = "amount";
469         final static String CHART = "chart";
470         final static String SOURCE = "source";
471         final static String PERCENT = "percent";
472         final static String HR_POSITION_ID = "hrPositionId";
473         final static String OWNER = "owner";
474         final static String EFFECTIVE_LOCAL_DATE_OF_OWNER = "effectiveLocalDateOfOwner";
475 
476     }
477 
478 }
479