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