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