1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.time.detail.web;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.kuali.hr.time.calendar.TkCalendar;
20 import org.kuali.hr.time.service.base.TkServiceLocator;
21 import org.kuali.hr.time.timeblock.TimeBlock;
22 import org.kuali.hr.time.timesummary.TimeSummary;
23 import org.kuali.hr.time.util.TKUtils;
24 import org.kuali.hr.time.util.TkConstants;
25
26 import java.text.SimpleDateFormat;
27 import java.util.*;
28
29 public class TimeDetailActionForm extends TimeDetailActionFormBase {
30
31 private static SimpleDateFormat SDF_NO_TZ = new SimpleDateFormat("EEE MMM d HH:mm:ss yyyy");
32
33
34
35
36 private static final long serialVersionUID = 5277197287612035236L;
37
38
39 private TimeBlock timeBlock;
40 private String clockAction;
41 private String serverTimezone;
42 private String userTimezone;
43 private TimeSummary timeSummary;
44 private Map<String, String> assignStyleClassMap = new HashMap<String, String>();
45 private String timeBlockString;
46 private TkCalendar calendar;
47 private String docEditable;
48 private String workingOnItsOwn;
49 private List<String> overtimeEarnCodes = new ArrayList<String>();
50 private String tkTimeHourDetailId;
51 private String isLunchDeleted;
52 private boolean canAddTimeblock;
53 private String spanningWeeks;
54
55 public String getSpanningWeeks() {
56 return spanningWeeks;
57 }
58
59 public void setSpanningWeeks(String spanningWeeks) {
60 this.spanningWeeks = spanningWeeks;
61 }
62
63
64 public TkCalendar getTkCalendar() {
65 return calendar;
66 }
67
68 public void setTkCalendar(TkCalendar calendar) {
69 this.calendar = calendar;
70 }
71
72 public List<TimeBlock> getTimeBlockList() {
73 return this.getTimesheetDocument().getTimeBlocks();
74 }
75
76
77 public List<TimeBlock> getClockLogTimeBlockList() {
78 List<TimeBlock> clockList = new ArrayList<TimeBlock>();
79 for(TimeBlock tb : this.getTimeBlockList()){
80 if(tb.getClockLogCreated()) {
81 clockList.add(tb);
82 }
83 }
84 return clockList;
85 }
86
87 public TimeBlock getTimeBlock() {
88 return timeBlock;
89 }
90
91 public void setTimeBlock(TimeBlock timeBlock) {
92 this.timeBlock = timeBlock;
93 }
94
95 public String getClockAction() {
96 return clockAction;
97 }
98
99 public void setClockAction(String clockAction) {
100 this.clockAction = clockAction;
101 }
102
103 public String getIsVirtualWorkDay() {
104 Calendar cal = Calendar.getInstance();
105 cal.setTime(getBeginPeriodDateTime());
106 return Boolean.toString(TKUtils.isVirtualWorkDay(cal));
107 }
108
109 public TimeSummary getTimeSummary() {
110 return timeSummary;
111 }
112
113 public void setTimeSummary(TimeSummary timeSummary) {
114 this.timeSummary = timeSummary;
115 }
116
117 public String getServerTimezone() {
118 return TKUtils.getSystemTimeZone();
119 }
120
121 public String getUserTimezone() {
122 return TkServiceLocator.getTimezoneService().getUserTimezone();
123 }
124
125 public Map<String, String> getAssignStyleClassMap() {
126 return assignStyleClassMap;
127 }
128
129 public void setAssignStyleClassMap(Map<String, String> assignStyleClassMap) {
130 this.assignStyleClassMap = assignStyleClassMap;
131 }
132
133 public String getTimeBlockString() {
134 return timeBlockString;
135 }
136
137 public void setTimeBlockString(String timeBlockString) {
138 this.timeBlockString = timeBlockString;
139 }
140
141 public String getBeginPeriodDTNoTZ() {
142 return SDF_NO_TZ.format(this.getBeginPeriodDateTime());
143 }
144
145 public String getEndPeriodDTNoTZ() {
146 return SDF_NO_TZ.format(this.getEndPeriodDateTime());
147 }
148
149 public String getDocEditable() {
150 if(StringUtils.isEmpty(docEditable)) {
151 docEditable="false";
152 }
153 return docEditable;
154 }
155
156 public void setDocEditable(String docEditable) {
157 this.docEditable = docEditable;
158 }
159
160 public List<String> getOvertimeEarnCodes() {
161 return overtimeEarnCodes;
162 }
163
164 public void setOvertimeEarnCodes(List<String> overtimeEarnCodes) {
165 this.overtimeEarnCodes = overtimeEarnCodes;
166 }
167
168 public String getTkTimeHourDetailId() {
169 return tkTimeHourDetailId;
170 }
171
172 public void setTkTimeHourDetailId(String tkTimeHourDetailId) {
173 this.tkTimeHourDetailId = tkTimeHourDetailId;
174 }
175
176 public String getLunchDeleted() {
177 return isLunchDeleted;
178 }
179
180 public void setLunchDeleted(String lunchDeleted) {
181 isLunchDeleted = lunchDeleted;
182 }
183
184 public boolean isCanAddTimeblock() {
185 return TkServiceLocator.getPermissionsService().canAddTimeBlock();
186 }
187
188 public String getWorkingOnItsOwn() {
189 if(StringUtils.isEmpty(workingOnItsOwn)) {
190 workingOnItsOwn="false";
191 }
192 return workingOnItsOwn;
193 }
194
195 public void setWorkingOnItsOwn(String workingOnItsOwn) {
196 this.workingOnItsOwn = workingOnItsOwn;
197 }
198 }