1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.lm.leavecalendar;
17
18 import java.io.Serializable;
19 import java.util.ArrayList;
20 import java.util.LinkedList;
21 import java.util.List;
22
23 import org.kuali.hr.core.document.calendar.CalendarDocumentContract;
24 import org.kuali.hr.lm.leaveblock.LeaveBlock;
25 import org.kuali.hr.lm.workflow.LeaveCalendarDocumentHeader;
26 import org.kuali.hr.time.assignment.Assignment;
27 import org.kuali.hr.time.calendar.CalendarEntries;
28
29 public class LeaveCalendarDocument implements CalendarDocumentContract, Serializable {
30
31 public static final String LEAVE_CALENDAR_DOCUMENT_TYPE = "LeaveCalendarDocument";
32
33 LeaveCalendarDocumentHeader documentHeader;
34 List<LeaveBlock> leaveBlocks = new ArrayList<LeaveBlock>();
35 private List<Assignment> assignments = new LinkedList<Assignment>();
36 private CalendarEntries calendarEntry;
37
38 public LeaveCalendarDocument(CalendarEntries calendarEntry) {
39 this.calendarEntry = calendarEntry;
40 }
41
42 public LeaveCalendarDocument(
43 LeaveCalendarDocumentHeader documentHeader) {
44 this.documentHeader = documentHeader;
45 }
46
47 @Override
48 public LeaveCalendarDocumentHeader getDocumentHeader() {
49 return documentHeader;
50 }
51
52 public void setDocumentHeader(
53 LeaveCalendarDocumentHeader documentHeader) {
54 this.documentHeader = documentHeader;
55 }
56
57 public List<LeaveBlock> getLeaveBlocks() {
58 return leaveBlocks;
59 }
60
61 public void setLeaveBlocks(List<LeaveBlock> leaveBlocks) {
62 this.leaveBlocks = leaveBlocks;
63 }
64
65 @Override
66 public CalendarEntries getCalendarEntry() {
67 return calendarEntry;
68 }
69
70 public void setCalendarEntry(CalendarEntries calendarEntry) {
71 this.calendarEntry = calendarEntry;
72 }
73
74 public String getPrincipalId() {
75 return getDocumentHeader().getPrincipalId();
76 }
77
78 public String getDocumentId() {
79 if (getDocumentHeader() != null) {
80 return getDocumentHeader().getDocumentId();
81 } else {
82 return null;
83 }
84 }
85
86 @Override
87 public List<Assignment> getAssignments() {
88 return assignments;
89 }
90
91 public void setAssignments(List<Assignment> assignments) {
92 this.assignments = assignments;
93 }
94
95 @Override
96 public java.sql.Date getAsOfDate(){
97 return new java.sql.Date(getCalendarEntry().getBeginPeriodDateTime().getTime());
98 }
99
100
101 }