1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.time.timesheet;
17
18 import java.util.HashMap;
19 import java.util.LinkedList;
20 import java.util.List;
21 import java.util.Map;
22
23 import org.kuali.hr.job.Job;
24 import org.kuali.hr.time.assignment.Assignment;
25 import org.kuali.hr.time.calendar.CalendarEntries;
26 import org.kuali.hr.time.timeblock.TimeBlock;
27 import org.kuali.hr.time.timesummary.TimeSummary;
28 import org.kuali.hr.time.workflow.TimesheetDocumentHeader;
29
30
31 public class TimesheetDocument {
32
33 public static final String TIMESHEET_DOCUMENT_TYPE = "TimesheetDocument";
34 public static final String TIMESHEET_DOCUMENT_TITLE = "TimesheetDocument";
35
36 private TimesheetDocumentHeader documentHeader;
37 private List<Assignment> assignments = new LinkedList<Assignment>();
38 private List<Job> jobs = new LinkedList<Job>();
39 private List<TimeBlock> timeBlocks = new LinkedList<TimeBlock>();
40 private CalendarEntries payCalendarEntry = null;
41 private TimeSummary timeSummary = new TimeSummary();
42 private Map<Long, Job> jobNumberToJobMap = new HashMap<Long,Job>();
43
44 public TimesheetDocument(TimesheetDocumentHeader documentHeader) {
45 this.documentHeader = documentHeader;
46 }
47
48 public TimesheetDocumentHeader getDocumentHeader() {
49 return documentHeader;
50 }
51
52 public void setDocumentHeader(TimesheetDocumentHeader documentHeader) {
53 this.documentHeader = documentHeader;
54 }
55
56 public List<Assignment> getAssignments() {
57 return assignments;
58 }
59
60 public void setAssignments(List<Assignment> assignments) {
61 this.assignments = assignments;
62 }
63
64 public List<Job> getJobs() {
65 return jobs;
66 }
67
68 public void setJobs(List<Job> jobs) {
69 this.jobs = jobs;
70 jobNumberToJobMap.clear();
71 if(jobs!=null){
72 for(Job job : jobs){
73 jobNumberToJobMap.put(job.getJobNumber(), job);
74 }
75 }
76 }
77
78 public List<TimeBlock> getTimeBlocks() {
79 return timeBlocks;
80 }
81
82 public void setTimeBlocks(List<TimeBlock> timeBlocks) {
83 this.timeBlocks = timeBlocks;
84 }
85
86 public CalendarEntries getPayCalendarEntry() {
87 return payCalendarEntry;
88 }
89
90 public void setPayCalendarEntry(CalendarEntries payCalendarEntry) {
91 this.payCalendarEntry = payCalendarEntry;
92 }
93
94 public void setTimeSummary(TimeSummary timeSummary) {
95 this.timeSummary = timeSummary;
96 }
97
98 public TimeSummary getTimeSummary() {
99 return timeSummary;
100 }
101
102 public String getPrincipalId(){
103 return getDocumentHeader().getPrincipalId();
104 }
105
106 public Job getJob(Long jobNumber){
107 return jobNumberToJobMap.get(jobNumber);
108 }
109
110 public java.sql.Date getAsOfDate(){
111 return new java.sql.Date(getPayCalendarEntry().getBeginPeriodDateTime().getTime());
112 }
113
114 public String getDocumentId(){
115 return this.getDocumentHeader().getDocumentId();
116 }
117 }