001 /** 002 * Copyright 2004-2013 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package org.kuali.hr.lm.leavecalendar.web; 017 018 import org.apache.struts.action.ActionMapping; 019 import org.joda.time.DateTime; 020 import org.joda.time.format.DateTimeFormat; 021 import org.joda.time.format.DateTimeFormatter; 022 import org.kuali.hr.lm.balancetransfer.BalanceTransfer; 023 import org.kuali.hr.lm.leaveSummary.LeaveSummary; 024 import org.kuali.hr.lm.leavecalendar.LeaveCalendarDocument; 025 import org.kuali.hr.time.base.web.TkCommonCalendarForm; 026 import org.kuali.hr.time.calendar.CalendarEntries; 027 import org.kuali.hr.time.calendar.LeaveCalendar; 028 import org.kuali.hr.time.util.TKUtils; 029 030 import javax.servlet.http.HttpServletRequest; 031 import java.math.BigDecimal; 032 import java.util.LinkedHashMap; 033 import java.util.List; 034 import java.util.Map; 035 036 @SuppressWarnings("serial") 037 public class LeaveCalendarForm extends TkCommonCalendarForm { 038 039 private static final DateTimeFormatter SDF_NO_TZ = DateTimeFormat.forPattern("EEE MMM d HH:mm:ss yyyy"); 040 041 private String documentId; 042 private LeaveCalendar leaveCalendar; 043 private LeaveCalendarDocument leaveCalendarDocument; 044 CalendarEntries calendarEntry; 045 private String startDate; 046 private String endDate; 047 private String selectedEarnCode; 048 private BigDecimal leaveAmount; 049 private String description; 050 private String leaveBlockId; 051 private String prevDocumentId; 052 private String nextDocumentId; 053 private String prevCalEntryId; 054 private String nextCalEntryId; 055 private String calEntryId; 056 /** String (concat(job number, work_area, task)) -> Formatted Assignment Descriptions */ 057 private Map<String,String> assignmentDescriptions; 058 private String selectedAssignment; 059 private String spanningWeeks; // KPME-1446 060 private String leaveBlockString; // KPME-1447 061 private boolean isDocEditable; 062 private String currentPayCalStartDate; 063 private String currentPayCalEndDate; 064 private DateTime currentPayCalStart; 065 private DateTime currentPayCalEnd; 066 private LeaveSummary leaveSummary; 067 private boolean leavePlanningCalendar; 068 private List<BalanceTransfer> forfeitures; 069 private String startTime; 070 private String endTime; 071 072 public boolean isCurrentLeavePeriod () { 073 return (TKUtils.getCurrentDate().compareTo(calendarEntry.getBeginPeriodDate()) >= 0 && TKUtils.getCurrentDate().compareTo(calendarEntry.getEndPeriodDate()) < 0); 074 } 075 public DateTime getCurrentPayCalStart() { 076 return currentPayCalStart; 077 } 078 079 public void setCurrentPayCalStart(DateTime currentPayCalStart) { 080 this.currentPayCalStart = currentPayCalStart; 081 } 082 083 public DateTime getCurrentPayCalEnd() { 084 return currentPayCalEnd; 085 } 086 087 public void setCurrentPayCalEnd(DateTime currentPayCalEnd) { 088 this.currentPayCalEnd = currentPayCalEnd; 089 } 090 091 public String getCurrentPayCalStartDate() { 092 if(currentPayCalStart != null) { 093 return this.currentPayCalStart.toString(SDF_NO_TZ); 094 } else { 095 return null; 096 } 097 } 098 099 public void setCurrentPayCalStartDate(String currentPayCalStartDate) { 100 this.currentPayCalStartDate = currentPayCalStartDate; 101 } 102 103 public String getCurrentPayCalEndDate() { 104 if(currentPayCalEnd != null) { 105 return this.currentPayCalEnd.toString(SDF_NO_TZ); 106 } else { 107 return null; 108 } 109 } 110 111 public void setCurrentPayCalEndDate(String currentPayCalEndDate) { 112 this.currentPayCalEndDate = currentPayCalEndDate; 113 } 114 115 public boolean isDocEditable() { 116 return isDocEditable; 117 } 118 119 public void setDocEditable(boolean isDocEditable) { 120 this.isDocEditable = isDocEditable; 121 } 122 123 public boolean isLeavePlanningCalendar() { 124 return leavePlanningCalendar; 125 } 126 127 public void setLeavePlanningCalendar(boolean leavePlanningCalendar) { 128 this.leavePlanningCalendar = leavePlanningCalendar; 129 } 130 131 public String getLeaveBlockString() { 132 return leaveBlockString; 133 } 134 135 public void setLeaveBlockString(String leaveBlockString) { 136 this.leaveBlockString = leaveBlockString; 137 } 138 139 public String getSpanningWeeks() { 140 return spanningWeeks; 141 } 142 143 public void setSpanningWeeks(String spanningWeeks) { 144 this.spanningWeeks = spanningWeeks; 145 } 146 147 public String getSelectedAssignment() { 148 return selectedAssignment; 149 } 150 151 public void setSelectedAssignment(String selectedAssignment) { 152 this.selectedAssignment = selectedAssignment; 153 } 154 155 public Map<String, String> getAssignmentDescriptions() { 156 return assignmentDescriptions; 157 } 158 159 public void setAssignmentDescriptions(Map<String, String> assignmentDescriptions) { 160 this.assignmentDescriptions = assignmentDescriptions; 161 } 162 163 public String getPrevCalEntryId() { 164 return prevCalEntryId; 165 } 166 167 public void setPrevCalEntryId(String prevCalEntryId) { 168 this.prevCalEntryId = prevCalEntryId; 169 } 170 171 public String getNextCalEntryId() { 172 return nextCalEntryId; 173 } 174 175 public void setNextCalEntryId(String nextCalEntryId) { 176 this.nextCalEntryId = nextCalEntryId; 177 } 178 179 public String getCalEntryId() { 180 return calEntryId; 181 } 182 183 public void setCalEntryId(String calEntryId) { 184 this.calEntryId = calEntryId; 185 } 186 187 @Override 188 public void reset(ActionMapping mapping, HttpServletRequest request) { 189 super.reset(mapping, request); 190 } 191 192 public LeaveCalendar getLeaveCalendar() { 193 return leaveCalendar; 194 } 195 196 public void setLeaveCalendar(LeaveCalendar leaveCalendar) { 197 this.leaveCalendar = leaveCalendar; 198 } 199 200 public String getDocumentId() { 201 return documentId; 202 } 203 204 public void setDocumentId(String documentId) { 205 this.documentId = documentId; 206 } 207 208 public CalendarEntries getCalendarEntry() { 209 return calendarEntry; 210 } 211 212 public void setCalendarEntry(CalendarEntries calendarEntry) { 213 this.calendarEntry = calendarEntry; 214 } 215 216 public LeaveCalendarDocument getLeaveCalendarDocument() { 217 return leaveCalendarDocument; 218 } 219 220 public void setLeaveCalendarDocument(LeaveCalendarDocument leaveCalendarDocument) { 221 this.leaveCalendarDocument = leaveCalendarDocument; 222 } 223 224 public String getStartDate() { 225 return startDate; 226 } 227 228 public void setStartDate(String startDate) { 229 this.startDate = startDate; 230 } 231 232 public String getEndDate() { 233 return endDate; 234 } 235 236 public void setEndDate(String endDate) { 237 this.endDate = endDate; 238 } 239 240 public BigDecimal getLeaveAmount() { 241 return leaveAmount; 242 } 243 244 public void setLeaveAmount(BigDecimal leaveAmount) { 245 this.leaveAmount = leaveAmount; 246 } 247 248 public String getDescription() { 249 return description; 250 } 251 252 public void setDescription(String description) { 253 this.description = description; 254 } 255 256 public String getLeaveBlockId() { 257 return leaveBlockId; 258 } 259 260 public void setLeaveBlockId(String leaveBlockId) { 261 this.leaveBlockId = leaveBlockId; 262 } 263 264 public String getNextDocumentId() { 265 return nextDocumentId; 266 } 267 268 public void setNextDocumentId(String nextDocumentId) { 269 this.nextDocumentId = nextDocumentId; 270 } 271 272 public String getPrevDocumentId() { 273 return prevDocumentId; 274 } 275 276 public void setPrevDocumentId(String prevDocumentId) { 277 this.prevDocumentId = prevDocumentId; 278 } 279 280 public String getBeginPeriodDateTime() { 281 return leaveCalendar.getBeginDateTime().toString(SDF_NO_TZ); 282 } 283 284 public String getEndPeriodDateTime() { 285 return leaveCalendar.getEndDateTime().toString(SDF_NO_TZ); 286 } 287 288 public String getSelectedEarnCode() { 289 return selectedEarnCode; 290 } 291 292 public void setSelectedEarnCode(String selectedEarnCode) { 293 this.selectedEarnCode = selectedEarnCode; 294 } 295 296 public LeaveSummary getLeaveSummary() { 297 return leaveSummary; 298 } 299 300 public void setLeaveSummary(LeaveSummary leaveSummary) { 301 this.leaveSummary = leaveSummary; 302 } 303 304 public List<BalanceTransfer> getForfeitures() { 305 return forfeitures; 306 } 307 308 public void setForfeitures(List<BalanceTransfer> forfeitures) { 309 this.forfeitures = forfeitures; 310 } 311 312 public String getStartTime() { 313 return startTime; 314 } 315 316 public void setStartTime(String startTime) { 317 this.startTime = startTime; 318 } 319 320 public String getEndTime() { 321 return endTime; 322 } 323 324 public void setEndTime(String endTime) { 325 this.endTime = endTime; 326 } 327 328 }