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.tklm.api.leave.block;
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 javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
28  
29  import org.apache.commons.lang.builder.EqualsBuilder;
30  import org.joda.time.DateTime;
31  import org.joda.time.LocalDate;
32  import org.kuali.kpme.core.api.KPMEConstants;
33  import org.kuali.kpme.core.api.accrualcategory.AccrualCategory;
34  import org.kuali.kpme.core.api.accrualcategory.rule.AccrualCategoryRule;
35  import org.kuali.kpme.core.api.groupkey.HrGroupKey;
36  import org.kuali.kpme.core.api.util.KpmeUtils;
37  import org.kuali.kpme.tklm.api.common.TkConstants;
38  import org.kuali.rice.core.api.CoreConstants;
39  import org.kuali.rice.core.api.mo.AbstractDataTransferObject;
40  import org.kuali.rice.core.api.mo.ModelBuilder;
41  import org.kuali.rice.core.api.util.jaxb.DateTimeAdapter;
42  import org.kuali.rice.core.api.util.jaxb.LocalDateAdapter;
43  import org.w3c.dom.Element;
44  
45  @XmlRootElement(name = LeaveBlock.Constants.ROOT_ELEMENT_NAME)
46  @XmlAccessorType(XmlAccessType.NONE)
47  @XmlType(name = LeaveBlock.Constants.TYPE_NAME, propOrder = {
48          LeaveBlock.Elements.TASK,
49          LeaveBlock.Elements.EARN_CODE,
50          LeaveBlock.Elements.ACCRUAL_CATEGORY_RULE,
51          LeaveBlock.Elements.ACCRUAL_CATEGORY_OBJ,
52          LeaveBlock.Elements.ACCRUAL_CATEGORY_RULE_ID,
53          LeaveBlock.Elements.ACCRUAL_CATEGORY,
54          LeaveBlock.Elements.SUBMIT,
55          LeaveBlock.Elements.BLOCK_ID,
56          LeaveBlock.Elements.DESCRIPTION,
57          LeaveBlock.Elements.ASSIGNMENT_TITLE,
58          LeaveBlock.Elements.CALENDAR_ID,
59          LeaveBlock.Elements.EARN_CODE_DESCRIPTION,
60          LeaveBlock.Elements.LEAVE_BLOCK_TYPE,
61          KPMEConstants.CommonElements.GROUP_KEY_CODE,
62          KPMEConstants.CommonElements.GROUP_KEY,
63          LeaveBlock.Elements.ASSIGNMENT_KEY,
64          LeaveBlock.Elements.DOCUMENT_STATUS,
65          LeaveBlock.Elements.LEAVE_REQUEST_DOCUMENT_ID,
66          LeaveBlock.Elements.PLANNING_DESCRIPTION,
67          LeaveBlock.Elements.TRANSACTIONAL_DOC_ID,
68          LeaveBlock.Elements.BEGIN_DATE_TIME,
69          LeaveBlock.Elements.END_DATE_TIME,
70          LeaveBlock.Elements.LM_LEAVE_BLOCK_ID,
71          LeaveBlock.Elements.LEAVE_AMOUNT,
72          LeaveBlock.Elements.WORK_AREA,
73          LeaveBlock.Elements.JOB_NUMBER,
74          LeaveBlock.Elements.ACCRUAL_GENERATED,
75          LeaveBlock.Elements.LEAVE_LOCAL_DATE,
76          LeaveBlock.Elements.LEAVE_DATE_TIME,
77          LeaveBlock.Elements.SCHEDULE_TIME_OFF_ID,
78          LeaveBlock.Elements.REQUEST_STATUS,
79          LeaveBlock.Elements.REQUEST_STATUS_STRING,
80          LeaveBlock.Elements.REASON,
81          LeaveBlock.Elements.HOURS,
82          LeaveBlock.Elements.CREATE_TIME,
83          LeaveBlock.Elements.HR_CALENDAR_BLOCK_ID,
84          LeaveBlock.Elements.CONCRETE_BLOCK_TYPE,
85          LeaveBlock.Elements.CONCRETE_BLOCK_ID,
86          LeaveBlock.Elements.DOCUMENT_ID,
87          LeaveBlock.Elements.PRINCIPAL_ID,
88          LeaveBlock.Elements.AMOUNT,
89          LeaveBlock.Elements.OVERTIME_PREF,
90          LeaveBlock.Elements.LUNCH_DELETED,
91          LeaveBlock.Elements.USER_PRINCIPAL_ID,
92          LeaveBlock.Elements.AFFECTS_PAY,
93          CoreConstants.CommonElements.OBJECT_ID,
94          CoreConstants.CommonElements.VERSION_NUMBER,
95          CoreConstants.CommonElements.FUTURE_ELEMENTS
96  })
97  public final class LeaveBlock
98          extends AbstractDataTransferObject
99          implements LeaveBlockContract
100 {
101 
102     private static final long serialVersionUID = -871236487733142844L;
103     @XmlElement(name = Elements.TASK, required = false)
104     private final Long task;
105     @XmlElement(name = Elements.EARN_CODE, required = false)
106     private final String earnCode;
107     @XmlElement(name = KPMEConstants.CommonElements.GROUP_KEY_CODE, required = true)
108     private final String groupKeyCode;
109     @XmlElement(name = KPMEConstants.CommonElements.GROUP_KEY, required = false)
110     private final HrGroupKey groupKey;
111     @XmlElement(name = Elements.ACCRUAL_CATEGORY_RULE, required = false)
112     private final AccrualCategoryRule accrualCategoryRule;
113     @XmlElement(name = Elements.ACCRUAL_CATEGORY_OBJ, required = false)
114     private final AccrualCategory accrualCategoryObj;
115     @XmlElement(name = Elements.ACCRUAL_CATEGORY_RULE_ID, required = false)
116     private final String accrualCategoryRuleId;
117     @XmlElement(name = Elements.ACCRUAL_CATEGORY, required = false)
118     private final String accrualCategory;
119     @XmlElement(name = Elements.SUBMIT, required = false)
120     private final boolean submit;
121     @XmlElement(name = Elements.BLOCK_ID, required = false)
122     private final Long blockId;
123     @XmlElement(name = Elements.DESCRIPTION, required = false)
124     private final String description;
125     @XmlElement(name = Elements.ASSIGNMENT_TITLE, required = false)
126     private final String assignmentTitle;
127     @XmlElement(name = Elements.CALENDAR_ID, required = false)
128     private final String calendarId;
129     @XmlElement(name = Elements.EARN_CODE_DESCRIPTION, required = false)
130     private final String earnCodeDescription;
131     @XmlElement(name = Elements.LEAVE_BLOCK_TYPE, required = false)
132     private final String leaveBlockType;
133     @XmlElement(name = Elements.ASSIGNMENT_KEY, required = false)
134     private final String assignmentKey;
135     @XmlElement(name = Elements.DOCUMENT_STATUS, required = false)
136     private final String documentStatus;
137     @XmlElement(name = Elements.LEAVE_REQUEST_DOCUMENT_ID, required = false)
138     private final String leaveRequestDocumentId;
139     @XmlElement(name = Elements.PLANNING_DESCRIPTION, required = false)
140     private final String planningDescription;
141     @XmlElement(name = Elements.TRANSACTIONAL_DOC_ID, required = false)
142     private final String transactionalDocId;
143     @XmlElement(name = Elements.BEGIN_DATE_TIME, required = false)
144     @XmlJavaTypeAdapter(DateTimeAdapter.class)
145     private final DateTime beginDateTime;
146     @XmlElement(name = Elements.END_DATE_TIME, required = false)
147     @XmlJavaTypeAdapter(DateTimeAdapter.class)
148     private final DateTime endDateTime;
149     @XmlElement(name = Elements.LM_LEAVE_BLOCK_ID, required = false)
150     private final String lmLeaveBlockId;
151     @XmlElement(name = Elements.LEAVE_AMOUNT, required = false)
152     private final BigDecimal leaveAmount;
153     @XmlElement(name = Elements.WORK_AREA, required = false)
154     private final Long workArea;
155     @XmlElement(name = Elements.JOB_NUMBER, required = false)
156     private final Long jobNumber;
157     @XmlElement(name = Elements.ACCRUAL_GENERATED, required = false)
158     private final Boolean accrualGenerated;
159     @XmlElement(name = Elements.LEAVE_LOCAL_DATE, required = false)
160     @XmlJavaTypeAdapter(LocalDateAdapter.class)
161     private final LocalDate leaveLocalDate;
162     @XmlElement(name = Elements.LEAVE_DATE_TIME, required = false)
163     @XmlJavaTypeAdapter(DateTimeAdapter.class)
164     private final DateTime leaveDateTime;
165     @XmlElement(name = Elements.SCHEDULE_TIME_OFF_ID, required = false)
166     private final String scheduleTimeOffId;
167     @XmlElement(name = Elements.REQUEST_STATUS, required = false)
168     private final String requestStatus;
169     @XmlElement(name = Elements.REQUEST_STATUS_STRING, required = false)
170     private final String requestStatusString;
171     @XmlElement(name = Elements.REASON, required = false)
172     private final String reason;
173     @XmlElement(name = Elements.HOURS, required = false)
174     private final BigDecimal hours;
175     @XmlElement(name = Elements.CREATE_TIME, required = false)
176     @XmlJavaTypeAdapter(DateTimeAdapter.class)
177     private final DateTime createTime;
178     @XmlElement(name = Elements.HR_CALENDAR_BLOCK_ID, required = false)
179     private final String hrCalendarBlockId;
180     @XmlElement(name = Elements.CONCRETE_BLOCK_TYPE, required = false)
181     private final String concreteBlockType;
182     @XmlElement(name = Elements.CONCRETE_BLOCK_ID, required = false)
183     private final String concreteBlockId;
184     @XmlElement(name = Elements.DOCUMENT_ID, required = false)
185     private final String documentId;
186     @XmlElement(name = Elements.PRINCIPAL_ID, required = false)
187     private final String principalId;
188     @XmlElement(name = Elements.AMOUNT, required = false)
189     private final BigDecimal amount;
190     @XmlElement(name = Elements.OVERTIME_PREF, required = false)
191     private final String overtimePref;
192     @XmlElement(name = Elements.LUNCH_DELETED, required = false)
193     private final boolean lunchDeleted;
194     @XmlElement(name = Elements.USER_PRINCIPAL_ID, required = false)
195     private final String userPrincipalId;
196     @XmlElement(name = Elements.AFFECTS_PAY, required = false)
197     private final String affectsPay;
198     @XmlElement(name = CoreConstants.CommonElements.OBJECT_ID, required = false)
199     private final String objectId;
200     @XmlElement(name = CoreConstants.CommonElements.VERSION_NUMBER, required = false)
201     private final Long versionNumber;
202     @SuppressWarnings("unused")
203     @XmlAnyElement
204     private final Collection<Element> _futureElements = null;
205 
206     /**
207      * Private constructor used only by JAXB.
208      *
209      */
210     private LeaveBlock() {
211         this.task = null;
212         this.earnCode = null;
213         this.accrualCategoryRule = null;
214         this.accrualCategoryObj = null;
215         this.accrualCategoryRuleId = null;
216         this.accrualCategory = null;
217         this.submit = false;
218         this.blockId = null;
219         this.description = null;
220         this.leaveDateTime = null;
221         this.assignmentTitle = null;
222         this.calendarId = null;
223         this.earnCodeDescription = null;
224         this.leaveBlockType = null;
225         this.groupKeyCode = null;
226         this.groupKey = null;
227         this.assignmentKey = null;
228         this.documentStatus = null;
229         this.leaveRequestDocumentId = null;
230         this.planningDescription = null;
231         this.transactionalDocId = null;
232         this.beginDateTime = null;
233         this.endDateTime = null;
234         this.lmLeaveBlockId = null;
235         this.leaveAmount = null;
236         this.workArea = null;
237         this.jobNumber = null;
238         this.accrualGenerated = null;
239         this.leaveLocalDate = null;
240         this.scheduleTimeOffId = null;
241         this.requestStatus = null;
242         this.requestStatusString = null;
243         this.reason = null;
244         this.hours = null;
245         this.createTime = null;
246         this.hrCalendarBlockId = null;
247         this.concreteBlockType = null;
248         this.concreteBlockId = null;
249         this.documentId = null;
250         this.principalId = null;
251         this.amount = null;
252         this.overtimePref = null;
253         this.lunchDeleted = false;
254         this.userPrincipalId = null;
255         this.affectsPay = null;
256         this.objectId = null;
257         this.versionNumber = null;
258     }
259 
260     private LeaveBlock(Builder builder) {
261         this.task = builder.getTask();
262         this.earnCode = builder.getEarnCode();
263         this.accrualCategoryRule = builder.getAccrualCategoryRule() == null ? null : builder.getAccrualCategoryRule().build();
264         this.accrualCategoryObj = builder.getAccrualCategoryObj() == null ? null : builder.getAccrualCategoryObj().build();
265         this.accrualCategoryRuleId = builder.getAccrualCategoryRuleId();
266         this.accrualCategory = builder.getAccrualCategory();
267         this.submit = builder.isSubmit();
268         this.blockId = builder.getBlockId();
269         this.description = builder.getDescription();
270         this.leaveDateTime = builder.getLeaveDateTime() == null ? null : builder.getLeaveDateTime();
271         this.assignmentTitle = builder.getAssignmentTitle();
272         this.calendarId = builder.getCalendarId();
273         this.earnCodeDescription = builder.getEarnCodeDescription();
274         this.leaveBlockType = builder.getLeaveBlockType();
275         this.groupKeyCode = builder.getGroupKeyCode();
276         this.groupKey = builder.getGroupKey() == null ? null : builder.getGroupKey().build();
277         this.assignmentKey = builder.getAssignmentKey();
278         this.documentStatus = builder.getDocumentStatus();
279         this.leaveRequestDocumentId = builder.getLeaveRequestDocumentId();
280         this.planningDescription = builder.getPlanningDescription();
281         this.transactionalDocId = builder.getTransactionalDocId();
282         this.beginDateTime = builder.getBeginDateTime();
283         this.endDateTime = builder.getEndDateTime();
284         this.lmLeaveBlockId = builder.getLmLeaveBlockId();
285         this.leaveAmount = builder.getLeaveAmount();
286         this.workArea = builder.getWorkArea();
287         this.jobNumber = builder.getJobNumber();
288         this.accrualGenerated = builder.isAccrualGenerated();
289         this.leaveLocalDate = builder.getLeaveLocalDate();
290         this.scheduleTimeOffId = builder.getScheduleTimeOffId();
291         this.requestStatus = builder.getRequestStatus();
292         this.requestStatusString = builder.getRequestStatusString();
293         this.reason = builder.getReason();
294         this.hours = builder.getHours();
295         this.createTime = builder.getCreateTime();
296         this.hrCalendarBlockId = builder.getHrCalendarBlockId();
297         this.concreteBlockType = builder.getConcreteBlockType();
298         this.concreteBlockId = builder.getConcreteBlockId();
299         this.documentId = builder.getDocumentId();
300         this.principalId = builder.getPrincipalId();
301         this.amount = builder.getAmount();
302         this.overtimePref = builder.getOvertimePref();
303         this.lunchDeleted = builder.isLunchDeleted();
304         this.userPrincipalId = builder.getUserPrincipalId();
305         this.affectsPay = builder.getAffectPay();
306         this.objectId = builder.getObjectId();
307         this.versionNumber = builder.getVersionNumber();
308     }
309 
310     @Override
311     public Long getTask() {
312         return this.task;
313     }
314 
315     @Override
316     public String getEarnCode() {
317         return this.earnCode;
318     }
319 
320     @Override
321     public AccrualCategoryRule getAccrualCategoryRule() {
322         return this.accrualCategoryRule;
323     }
324 
325     @Override
326     public AccrualCategory getAccrualCategoryObj() {
327         return this.accrualCategoryObj;
328     }
329 
330     @Override
331     public String getAccrualCategoryRuleId() {
332         return this.accrualCategoryRuleId;
333     }
334 
335     @Override
336     public String getAccrualCategory() {
337         return this.accrualCategory;
338     }
339 
340     @Override
341     public HrGroupKey getGroupKey() {
342         return groupKey;
343     }
344 
345     @Override
346     public String getGroupKeyCode() {
347         return groupKeyCode;
348     }
349 
350     @Override
351     public boolean isSubmit() {
352         return this.submit;
353     }
354 
355     @Override
356     public Long getBlockId() {
357         return this.blockId;
358     }
359 
360     @Override
361     public String getDescription() {
362         return this.description;
363     }
364 
365     @Override
366     public DateTime getLeaveDateTime() {
367         return this.leaveDateTime;
368     }
369 
370     @Override
371     public String getAssignmentTitle() {
372         return this.assignmentTitle;
373     }
374 
375     @Override
376     public String getCalendarId() {
377         return this.calendarId;
378     }
379 
380     @Override
381     public String getEarnCodeDescription() {
382         return this.earnCodeDescription;
383     }
384 
385     @Override
386     public String getLeaveBlockType() {
387         return this.leaveBlockType;
388     }
389 
390     //@Override
391     //public boolean isEditable() {
392     //    return this.editable;
393     //}
394 
395     //@Override
396     //public boolean isDeletable() {
397     //    return this.deletable;
398     //}
399 
400     @Override
401     public String getAssignmentKey() {
402         return this.assignmentKey;
403     }
404 
405     @Override
406     public String getDocumentStatus() {
407         return this.documentStatus;
408     }
409 
410     @Override
411     public String getLeaveRequestDocumentId() {
412         return this.leaveRequestDocumentId;
413     }
414 
415     @Override
416     public String getPlanningDescription() {
417         return this.planningDescription;
418     }
419 
420     @Override
421     public String getTransactionalDocId() {
422         return this.transactionalDocId;
423     }
424 
425     @Override
426     public DateTime getBeginDateTime() {
427         return this.beginDateTime;
428     }
429 
430     @Override
431     public DateTime getEndDateTime() {
432         return this.endDateTime;
433     }
434 
435     @Override
436     public String getLmLeaveBlockId() {
437         return this.lmLeaveBlockId;
438     }
439 
440     @Override
441     public BigDecimal getLeaveAmount() {
442         return this.leaveAmount;
443     }
444 
445     @Override
446     public Long getWorkArea() {
447         return this.workArea;
448     }
449 
450     @Override
451     public Long getJobNumber() {
452         return this.jobNumber;
453     }
454 
455     @Override
456     public Boolean isAccrualGenerated() {
457         return this.accrualGenerated;
458     }
459 
460     @Override
461     public LocalDate getLeaveLocalDate() {
462         return this.leaveLocalDate;
463     }
464 
465     @Override
466     public String getScheduleTimeOffId() {
467         return this.scheduleTimeOffId;
468     }
469 
470     @Override
471     public String getRequestStatus() {
472         return this.requestStatus;
473     }
474 
475     @Override
476     public String getRequestStatusString() {
477         return this.requestStatusString;
478     }
479 
480     @Override
481     public String getReason() {
482         return this.reason;
483     }
484 
485     @Override
486     public BigDecimal getHours() {
487         return this.hours;
488     }
489 
490     @Override
491     public DateTime getCreateTime() {
492         return this.createTime;
493     }
494 
495     @Override
496     public String getHrCalendarBlockId() {
497         return this.hrCalendarBlockId;
498     }
499 
500     @Override
501     public String getConcreteBlockType() {
502         return this.concreteBlockType;
503     }
504 
505     @Override
506     public String getConcreteBlockId() {
507         return this.concreteBlockId;
508     }
509 
510     @Override
511     public String getDocumentId() {
512         return this.documentId;
513     }
514 
515     @Override
516     public String getPrincipalId() {
517         return this.principalId;
518     }
519 
520     @Override
521     public BigDecimal getAmount() {
522         return this.amount;
523     }
524 
525     @Override
526     public String getOvertimePref() {
527         return this.overtimePref;
528     }
529 
530     @Override
531     public boolean isLunchDeleted() {
532         return this.lunchDeleted;
533     }
534 
535     @Override
536     public String getUserPrincipalId() {
537         return this.userPrincipalId;
538     }
539 
540     @Override
541     public String getAffectPay() {
542         return this.affectsPay;
543     }
544 
545     @Override
546     public String getObjectId() {
547         return this.objectId;
548     }
549 
550     @Override
551     public Long getVersionNumber() {
552         return this.versionNumber;
553     }
554 
555 
556     @Override
557     public boolean equals(Object obj) {
558         if (obj == null) {
559             return false;
560         }
561         if (obj == this) {
562             return true;
563         }
564         if (obj.getClass() != getClass()) {
565             return false;
566         }
567         LeaveBlock leaveBlock = (LeaveBlock) obj;
568         return new EqualsBuilder()
569                 .append(principalId, leaveBlock.principalId)
570                 .append(jobNumber, leaveBlock.jobNumber)
571                 .append(groupKeyCode, leaveBlock.getGroupKeyCode())
572                 .append(workArea, leaveBlock.workArea)
573                 .append(task, leaveBlock.task)
574                 .append(earnCode, leaveBlock.earnCode)
575                 .append(leaveDateTime, leaveBlock.leaveDateTime)
576                 .append(KpmeUtils.nullSafeCompare(leaveAmount, leaveBlock.leaveAmount), 0)
577                 .append(accrualCategory, leaveBlock.accrualCategory)
578                 .append(earnCode, leaveBlock.earnCode)
579                 .append(description, leaveBlock.description)
580                 .append(leaveBlockType, leaveBlock.leaveBlockType)
581                 .isEquals();
582     }
583     /**
584      * A builder which can be used to construct {@link LeaveBlock} instances.  Enforces the constraints of the {@link LeaveBlockContract}.
585      *
586      */
587     public final static class Builder
588             implements Serializable, LeaveBlockContract, ModelBuilder
589     {
590 
591         private Long task;
592         private String earnCode;
593         private AccrualCategoryRule.Builder accrualCategoryRule;
594         private AccrualCategory.Builder accrualCategoryObj;
595         private String accrualCategoryRuleId;
596         private String accrualCategory;
597         private boolean submit;
598         private Long blockId;
599         private String description;
600         private DateTime leaveDateTime;
601         private String assignmentTitle;
602         private String calendarId;
603         private String earnCodeDescription;
604         private String leaveBlockType;
605         private String groupKeyCode;
606         private HrGroupKey.Builder groupKey;
607         private String assignmentKey;
608         private String documentStatus;
609         private String leaveRequestDocumentId;
610         private String planningDescription;
611         private String transactionalDocId;
612         private DateTime beginDateTime;
613         private DateTime endDateTime;
614         private String lmLeaveBlockId;
615         private BigDecimal leaveAmount;
616         private Long workArea;
617         private Long jobNumber;
618         private Boolean accrualGenerated;
619         private LocalDate leaveLocalDate;
620         private String scheduleTimeOffId;
621         private String requestStatus;
622         private String requestStatusString;
623         private String reason;
624         private BigDecimal hours;
625         private DateTime createTime;
626         private String hrCalendarBlockId;
627         private String concreteBlockType;
628         private String concreteBlockId;
629         private String documentId;
630         private String principalId;
631         private BigDecimal amount;
632         private String overtimePref;
633         private boolean lunchDeleted;
634         private String userPrincipalId;
635         private String affectsPay;
636         private String objectId;
637         private Long versionNumber;
638 
639         private Builder(String principalId, String earnCode, BigDecimal leaveAmount) {
640             setPrincipalId(principalId);
641             setEarnCode(earnCode);
642             setLeaveAmount(leaveAmount);
643         }
644 
645         public static Builder create(String principalId, String earnCode, BigDecimal leaveAmount) {
646             return new Builder(principalId, earnCode, leaveAmount);
647         }
648 
649         public static Builder create(String principalId, String earnCode, BigDecimal leaveAmount, LocalDate leaveLocalDate, String documentId) {
650             Builder builder = create(principalId, earnCode, leaveAmount);
651             builder.setLeaveLocalDate(leaveLocalDate);
652             builder.setDocumentId(documentId);
653             return builder;
654         }
655 
656         public static Builder create(LeaveBlockContract contract) {
657             if (contract == null) {
658                 throw new IllegalArgumentException("contract was null");
659             }
660 
661             Builder builder = create(contract.getPrincipalId(), contract.getEarnCode(), contract.getLeaveAmount());
662             builder.setTask(contract.getTask());
663             builder.setAccrualCategoryRule(contract.getAccrualCategoryRule() == null ? null : AccrualCategoryRule.Builder.create(contract.getAccrualCategoryRule()));
664             builder.setAccrualCategoryObj(contract.getAccrualCategoryObj() == null ? null : AccrualCategory.Builder.create(contract.getAccrualCategoryObj()));
665             builder.setAccrualCategoryRuleId(contract.getAccrualCategoryRuleId());
666             builder.setAccrualCategory(contract.getAccrualCategory());
667             builder.setSubmit(contract.isSubmit());
668             builder.setBlockId(contract.getBlockId());
669             builder.setDescription(contract.getDescription());
670             builder.setLeaveDateTime(contract.getLeaveDateTime());
671             builder.setAssignmentTitle(contract.getAssignmentTitle());
672             builder.setCalendarId(contract.getCalendarId());
673             builder.setEarnCodeDescription(contract.getEarnCodeDescription());
674             builder.setLeaveBlockType(contract.getLeaveBlockType());
675             builder.setGroupKeyCode(contract.getGroupKeyCode());
676             builder.setGroupKey(contract.getGroupKey() == null ? null : HrGroupKey.Builder.create(contract.getGroupKey()));
677             builder.setAssignmentKey(contract.getAssignmentKey());
678             builder.setDocumentStatus(contract.getDocumentStatus());
679             builder.setLeaveRequestDocumentId(contract.getLeaveRequestDocumentId());
680             builder.setPlanningDescription(contract.getPlanningDescription());
681             builder.setTransactionalDocId(contract.getTransactionalDocId());
682             builder.setBeginDateTime(contract.getBeginDateTime());
683             builder.setEndDateTime(contract.getEndDateTime());
684             builder.setLmLeaveBlockId(contract.getLmLeaveBlockId());
685             builder.setWorkArea(contract.getWorkArea());
686             builder.setJobNumber(contract.getJobNumber());
687             builder.setAccrualGenerated(contract.isAccrualGenerated());
688             builder.setLeaveLocalDate(contract.getLeaveLocalDate());
689             builder.setScheduleTimeOffId(contract.getScheduleTimeOffId());
690             builder.setRequestStatus(contract.getRequestStatus());
691             builder.setRequestStatusString(contract.getRequestStatusString());
692             builder.setReason(contract.getReason());
693             builder.setHours(contract.getHours());
694             builder.setCreateTime(contract.getCreateTime());
695             builder.setHrCalendarBlockId(contract.getHrCalendarBlockId());
696             builder.setConcreteBlockType(contract.getConcreteBlockType());
697             builder.setConcreteBlockId(contract.getConcreteBlockId());
698             builder.setDocumentId(contract.getDocumentId());
699             builder.setAmount(contract.getAmount());
700             builder.setOvertimePref(contract.getOvertimePref());
701             builder.setLunchDeleted(contract.isLunchDeleted());
702             builder.setUserPrincipalId(contract.getUserPrincipalId());
703             builder.setAffectsPay(contract.getAffectPay());
704             builder.setObjectId(contract.getObjectId());
705             builder.setVersionNumber(contract.getVersionNumber());
706             return builder;
707         }
708 
709         public LeaveBlock build() {
710             return new LeaveBlock(this);
711         }
712 
713         @Override
714         public Long getTask() {
715             return this.task;
716         }
717 
718         @Override
719         public String getEarnCode() {
720             return this.earnCode;
721         }
722 
723         @Override
724         public AccrualCategoryRule.Builder getAccrualCategoryRule() {
725             return this.accrualCategoryRule;
726         }
727 
728         @Override
729         public AccrualCategory.Builder getAccrualCategoryObj() {
730             return this.accrualCategoryObj;
731         }
732 
733         @Override
734         public String getAccrualCategoryRuleId() {
735             return this.accrualCategoryRuleId;
736         }
737 
738         @Override
739         public String getAccrualCategory() {
740             return this.accrualCategory;
741         }
742 
743         @Override
744         public boolean isSubmit() {
745             return this.submit;
746         }
747 
748         @Override
749         public Long getBlockId() {
750             return this.blockId;
751         }
752 
753         @Override
754         public String getDescription() {
755             return this.description;
756         }
757 
758         @Override
759         public DateTime getLeaveDateTime() {
760             return this.leaveDateTime;
761         }
762 
763         @Override
764         public String getAssignmentTitle() {
765             return this.assignmentTitle;
766         }
767 
768         @Override
769         public String getCalendarId() {
770             return this.calendarId;
771         }
772 
773         @Override
774         public String getEarnCodeDescription() {
775             return this.earnCodeDescription;
776         }
777 
778         @Override
779         public String getLeaveBlockType() {
780             return this.leaveBlockType;
781         }
782 
783         //@Override
784         //public boolean isEditable() {
785         //    return this.editable;
786         //}
787 
788         //@Override
789         //public boolean isDeletable() {
790         //    return this.deletable;
791         //}
792 
793         @Override
794         public String getAssignmentKey() {
795             return this.assignmentKey;
796         }
797 
798         @Override
799         public String getDocumentStatus() {
800             return this.documentStatus;
801         }
802 
803         @Override
804         public String getLeaveRequestDocumentId() {
805             return this.leaveRequestDocumentId;
806         }
807 
808         @Override
809         public String getPlanningDescription() {
810             return this.planningDescription;
811         }
812 
813         @Override
814         public String getTransactionalDocId() {
815             return this.transactionalDocId;
816         }
817 
818         @Override
819         public DateTime getBeginDateTime() {
820             return this.beginDateTime;
821         }
822 
823         @Override
824         public DateTime getEndDateTime() {
825             return this.endDateTime;
826         }
827 
828         @Override
829         public String getLmLeaveBlockId() {
830             return this.lmLeaveBlockId;
831         }
832 
833         @Override
834         public BigDecimal getLeaveAmount() {
835             return this.leaveAmount;
836         }
837 
838         @Override
839         public Long getWorkArea() {
840             return this.workArea;
841         }
842 
843         @Override
844         public Long getJobNumber() {
845             return this.jobNumber;
846         }
847 
848         @Override
849         public Boolean isAccrualGenerated() {
850             return this.accrualGenerated;
851         }
852 
853         @Override
854         public LocalDate getLeaveLocalDate() {
855             return this.leaveLocalDate;
856         }
857 
858         @Override
859         public String getScheduleTimeOffId() {
860             return this.scheduleTimeOffId;
861         }
862 
863         @Override
864         public String getRequestStatus() {
865             return this.requestStatus;
866         }
867 
868         @Override
869         public String getRequestStatusString() {
870             return this.requestStatusString;
871         }
872 
873         @Override
874         public String getReason() {
875             return this.reason;
876         }
877 
878         @Override
879         public BigDecimal getHours() {
880             return this.hours;
881         }
882 
883         @Override
884         public DateTime getCreateTime() {
885             return this.createTime;
886         }
887 
888         @Override
889         public String getHrCalendarBlockId() {
890             return this.hrCalendarBlockId;
891         }
892 
893         @Override
894         public String getConcreteBlockType() {
895             return this.concreteBlockType;
896         }
897 
898         @Override
899         public String getConcreteBlockId() {
900             return this.concreteBlockId;
901         }
902 
903         @Override
904         public String getDocumentId() {
905             return this.documentId;
906         }
907 
908         @Override
909         public String getPrincipalId() {
910             return this.principalId;
911         }
912 
913         @Override
914         public BigDecimal getAmount() {
915             return this.amount;
916         }
917 
918         @Override
919         public String getOvertimePref() {
920             return this.overtimePref;
921         }
922 
923         @Override
924         public boolean isLunchDeleted() {
925             return this.lunchDeleted;
926         }
927 
928         @Override
929         public String getUserPrincipalId() {
930             return this.userPrincipalId;
931         }
932 
933         @Override
934         public String getAffectPay() {
935             return this.affectsPay;
936         }
937 
938         @Override
939         public String getObjectId() {
940             return this.objectId;
941         }
942 
943         @Override
944         public Long getVersionNumber() {
945             return this.versionNumber;
946         }
947 
948         @Override
949         public String getGroupKeyCode() {
950             return groupKeyCode;
951         }
952 
953         @Override
954         public HrGroupKey.Builder getGroupKey() {
955             return groupKey;
956         }
957 
958         public void setTask(Long task) {
959             
960             this.task = task;
961         }
962 
963         public void setEarnCode(String earnCode) {
964             
965             this.earnCode = earnCode;
966         }
967 
968         public void setAccrualCategoryRule(AccrualCategoryRule.Builder accrualCategoryRule) {
969             
970             this.accrualCategoryRule = accrualCategoryRule;
971         }
972 
973         public void setAccrualCategoryObj(AccrualCategory.Builder accrualCategoryObj) {
974             
975             this.accrualCategoryObj = accrualCategoryObj;
976         }
977 
978         public void setAccrualCategoryRuleId(String accrualCategoryRuleId) {
979             
980             this.accrualCategoryRuleId = accrualCategoryRuleId;
981         }
982 
983         public void setAccrualCategory(String accrualCategory) {
984             
985             this.accrualCategory = accrualCategory;
986         }
987 
988         public void setSubmit(boolean submit) {
989             
990             this.submit = submit;
991         }
992 
993         public void setBlockId(Long blockId) {
994             
995             this.blockId = blockId;
996         }
997 
998         public void setDescription(String description) {
999             
1000             this.description = description;
1001         }
1002 
1003         //public void setLeaveDate(Date leaveDate) {
1004             
1005         //   this.leaveDate = leaveDate;
1006         //}
1007 
1008         public void setAssignmentTitle(String assignmentTitle) {
1009             
1010             this.assignmentTitle = assignmentTitle;
1011         }
1012 
1013         public void setCalendarId(String calendarId) {
1014             
1015             this.calendarId = calendarId;
1016         }
1017 
1018         public void setEarnCodeDescription(String earnCodeDescription) {
1019             
1020             this.earnCodeDescription = earnCodeDescription;
1021         }
1022 
1023         public void setLeaveBlockType(String leaveBlockType) {
1024             
1025             this.leaveBlockType = leaveBlockType;
1026         }
1027 
1028         public void setGroupKeyCode(String groupKeyCode) {
1029             this.groupKeyCode = groupKeyCode;
1030         }
1031 
1032         public void setGroupKey(HrGroupKey.Builder groupKey) {
1033             this.groupKey = groupKey;
1034         }
1035 
1036         public void setAssignmentKey(String assignmentKey) {
1037             
1038             this.assignmentKey = assignmentKey;
1039         }
1040 
1041         public void setDocumentStatus(String documentStatus) {
1042             
1043             this.documentStatus = documentStatus;
1044         }
1045 
1046         public void setLeaveRequestDocumentId(String leaveRequestDocumentId) {
1047             
1048             this.leaveRequestDocumentId = leaveRequestDocumentId;
1049         }
1050 
1051         public void setPlanningDescription(String planningDescription) {
1052             
1053             this.planningDescription = planningDescription;
1054         }
1055 
1056         public void setTransactionalDocId(String transactionalDocId) {
1057             
1058             this.transactionalDocId = transactionalDocId;
1059         }
1060 
1061         public void setBeginDateTime(DateTime beginDateTime) {
1062             
1063             this.beginDateTime = beginDateTime;
1064         }
1065 
1066         public void setEndDateTime(DateTime endDateTime) {
1067             
1068             this.endDateTime = endDateTime;
1069         }
1070 
1071         public void setLmLeaveBlockId(String lmLeaveBlockId) {
1072             
1073             this.lmLeaveBlockId = lmLeaveBlockId;
1074         }
1075 
1076         public void setLeaveAmount(BigDecimal leaveAmount) {
1077             
1078             this.leaveAmount = leaveAmount;
1079         }
1080 
1081         public void setWorkArea(Long workArea) {
1082             
1083             this.workArea = workArea;
1084         }
1085 
1086         public void setJobNumber(Long jobNumber) {
1087             
1088             this.jobNumber = jobNumber;
1089         }
1090 
1091         public void setAccrualGenerated(Boolean accrualGenerated) {
1092             
1093             this.accrualGenerated = accrualGenerated;
1094         }
1095 
1096         public void setLeaveLocalDate(LocalDate leaveLocalDate) {
1097             
1098             this.leaveLocalDate = leaveLocalDate;
1099         }
1100 
1101         public void setScheduleTimeOffId(String scheduleTimeOffId) {
1102             
1103             this.scheduleTimeOffId = scheduleTimeOffId;
1104         }
1105 
1106         public void setRequestStatus(String requestStatus) {
1107             
1108             this.requestStatus = requestStatus;
1109         }
1110 
1111         public void setRequestStatusString(String requestStatusString) {
1112             
1113             this.requestStatusString = requestStatusString;
1114         }
1115 
1116         public void setReason(String reason) {
1117             
1118             this.reason = reason;
1119         }
1120 
1121         public void setHours(BigDecimal hours) {
1122             
1123             this.hours = hours;
1124         }
1125 
1126         public void setCreateTime(DateTime createTime) {
1127             
1128             this.createTime = createTime;
1129         }
1130 
1131         public void setHrCalendarBlockId(String hrCalendarBlockId) {
1132             
1133             this.hrCalendarBlockId = hrCalendarBlockId;
1134         }
1135 
1136         public void setConcreteBlockType(String concreteBlockType) {
1137             
1138             this.concreteBlockType = concreteBlockType;
1139         }
1140 
1141         public void setConcreteBlockId(String concreteBlockId) {
1142             
1143             this.concreteBlockId = concreteBlockId;
1144         }
1145 
1146         public void setDocumentId(String documentId) {
1147             
1148             this.documentId = documentId;
1149         }
1150 
1151         public void setPrincipalId(String principalId) {
1152             
1153             this.principalId = principalId;
1154         }
1155 
1156         public void setAmount(BigDecimal amount) {
1157             
1158             this.amount = amount;
1159         }
1160 
1161         public void setOvertimePref(String overtimePref) {
1162             
1163             this.overtimePref = overtimePref;
1164         }
1165 
1166         public void setLunchDeleted(boolean lunchDeleted) {
1167             
1168             this.lunchDeleted = lunchDeleted;
1169         }
1170 
1171         public void setUserPrincipalId(String userPrincipalId) {
1172             this.userPrincipalId = userPrincipalId;
1173         }
1174 
1175         public void setAffectsPay(String affectsPay) {
1176             this.affectsPay = affectsPay;
1177         }
1178 
1179         public void setLeaveDateTime(DateTime leaveDateTime) {
1180             this.leaveDateTime = leaveDateTime;
1181         }
1182 
1183         public void setObjectId(String objectId) {
1184             this.objectId = objectId;
1185         }
1186 
1187         public void setVersionNumber(Long versionNumber) {
1188 
1189             this.versionNumber = versionNumber;
1190         }
1191     }
1192 
1193 
1194     /**
1195      * Defines some internal constants used on this class.
1196      *
1197      */
1198     static class Constants {
1199 
1200         final static String ROOT_ELEMENT_NAME = "leaveBlock";
1201         final static String TYPE_NAME = "LeaveBlockType";
1202 
1203     }
1204 
1205 
1206     /**
1207      * A private class which exposes constants which define the XML element names to use when this object is marshalled to XML.
1208      *
1209      */
1210     static class Elements {
1211 
1212         final static String TASK = "task";
1213         final static String EARN_CODE = "earnCode";
1214         final static String ACCRUAL_CATEGORY_RULE = "accrualCategoryRule";
1215         final static String ACCRUAL_CATEGORY_OBJ = "accrualCategoryObj";
1216         final static String ACCRUAL_CATEGORY_RULE_ID = "accrualCategoryRuleId";
1217         final static String ACCRUAL_CATEGORY = "accrualCategory";
1218         final static String SUBMIT = "submit";
1219         final static String BLOCK_ID = "blockId";
1220         final static String DESCRIPTION = "description";
1221         final static String ASSIGNMENT_TITLE = "assignmentTitle";
1222         final static String CALENDAR_ID = "calendarId";
1223         final static String EARN_CODE_DESCRIPTION = "earnCodeDescription";
1224         final static String LEAVE_BLOCK_TYPE = "leaveBlockType";
1225         final static String ASSIGNMENT_KEY = "assignmentKey";
1226         final static String DOCUMENT_STATUS = "documentStatus";
1227         final static String LEAVE_REQUEST_DOCUMENT_ID = "leaveRequestDocumentId";
1228         final static String PLANNING_DESCRIPTION = "planningDescription";
1229         final static String TRANSACTIONAL_DOC_ID = "transactionalDocId";
1230         final static String BEGIN_DATE_TIME = "beginDateTime";
1231         final static String END_DATE_TIME = "endDateTime";
1232         final static String LM_LEAVE_BLOCK_ID = "lmLeaveBlockId";
1233         final static String LEAVE_AMOUNT = "leaveAmount";
1234         final static String WORK_AREA = "workArea";
1235         final static String JOB_NUMBER = "jobNumber";
1236         final static String ACCRUAL_GENERATED = "accrualGenerated";
1237         final static String LEAVE_LOCAL_DATE = "leaveLocalDate";
1238         final static String SCHEDULE_TIME_OFF_ID = "scheduleTimeOffId";
1239         final static String REQUEST_STATUS = "requestStatus";
1240         final static String REQUEST_STATUS_STRING = "requestStatusString";
1241         final static String REASON = "reason";
1242         final static String HOURS = "hours";
1243         final static String CREATE_TIME = "createTime";
1244         final static String HR_CALENDAR_BLOCK_ID = "hrCalendarBlockId";
1245         final static String CONCRETE_BLOCK_TYPE = "concreteBlockType";
1246         final static String CONCRETE_BLOCK_ID = "concreteBlockId";
1247         final static String DOCUMENT_ID = "documentId";
1248         final static String PRINCIPAL_ID = "principalId";
1249         final static String AMOUNT = "amount";
1250         final static String OVERTIME_PREF = "overtimePref";
1251         final static String LUNCH_DELETED = "lunchDeleted";
1252         final static String USER_PRINCIPAL_ID = "userPrincipalId";
1253         final static String AFFECTS_PAY = "affectsPay";
1254         final static String LEAVE_DATE_TIME = "leaveDateTime";
1255     }
1256 
1257     public static final String CACHE_NAME = TkConstants.Namespace.NAMESPACE_PREFIX + "LeaveBlock";
1258 
1259 
1260 }