1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.time.util;
17
18 import java.math.BigDecimal;
19 import java.math.MathContext;
20 import java.math.RoundingMode;
21 import java.util.ArrayList;
22 import java.util.HashMap;
23 import java.util.HashSet;
24 import java.util.LinkedHashMap;
25 import java.util.List;
26 import java.util.Map;
27 import java.util.Set;
28 import java.util.TimeZone;
29
30 import org.joda.time.DateTimeZone;
31 import org.joda.time.format.DateTimeFormat;
32 import org.joda.time.format.DateTimeFormatter;
33 import org.kuali.hr.time.accrual.AccrualCategory;
34 import org.kuali.hr.time.earncode.EarnCode;
35 import org.kuali.rice.kew.api.KewApiConstants;
36 import org.kuali.rice.kew.api.document.DocumentStatus;
37
38 public class TkConstants {
39
40 public static final class RECORD_METHOD {
41 public static final String TIME = "T";
42 public static final String HOUR = "H";
43 public static final String AMOUNT = "A";
44 public static final String DAY = "D";
45 }
46
47 public static final Map<String, String> RECORD_METHOD_MAP = new HashMap<String, String>(2);
48 static {
49 RECORD_METHOD_MAP.put(RECORD_METHOD.TIME, "Time");
50 RECORD_METHOD_MAP.put(RECORD_METHOD.HOUR, "Hours");
51 RECORD_METHOD_MAP.put(RECORD_METHOD.AMOUNT, "Amount");
52 RECORD_METHOD_MAP.put(RECORD_METHOD.DAY, "Days");
53 }
54
55 public static final int DEFAULT_CACHE_TIME = 900;
56 public static final String TK_TARGET_USER_RETURN = "tkTargetReturn";
57 public static final String TK_TARGET_USER_PERSON = "tkTargetPerson";
58
59 public static final String WILDCARD_CHARACTER = "%";
60 public static final Long WILDCARD_LONG = -1L;
61
62
63 public static final Integer LENGTH_OF_WORK_SCHEDULE = 10;
64
65 public static final String CLOCK_IN = "CI";
66 public static final String CLOCK_OUT = "CO";
67 public static final String LUNCH_IN = "LI";
68 public static final String LUNCH_OUT = "LO";
69
70 public static final List<String> ON_THE_CLOCK_CODES = new ArrayList<String>();
71
72 static {
73 ON_THE_CLOCK_CODES.add(CLOCK_IN);
74 ON_THE_CLOCK_CODES.add(LUNCH_IN);
75 }
76
77
78 public static final String DELETE = "DELETE";
79 public static final String ADD = "ADD";
80 public static final String MODIFIED = "MODIFIED";
81
82
83 public static final String EARN_CODE_HOUR = "H";
84 public static final String EARN_CODE_TIME = "T";
85 public static final String EARN_CODE_AMOUNT = "A";
86 public static final String EARN_CODE_OVT = "OVT";
87 public static final String EARN_CODE_CPE = "CPE";
88 public static final String EARN_CODE_DAY = "D";
89
90 public static final String GMT_TIME_ZONE_ID = "Etc/GMT";
91 public static final TimeZone GMT_TIME_ZONE = TimeZone.getTimeZone(GMT_TIME_ZONE_ID);
92
93
94
95 public static DateTimeFormatter DT_BASIC_TIME_FORMAT = DateTimeFormat.forPattern("hh:mm aa");
96 public static DateTimeFormatter DT_MILITARY_TIME_FORMAT = DateTimeFormat.forPattern("H:mm");
97 public static DateTimeFormatter DT_BASIC_DATE_FORMAT = DateTimeFormat.forPattern("MM/dd/yyyy");
98 public static DateTimeFormatter DT_ABBREV_DATE_FORMAT = DateTimeFormat.forPattern("MM/dd");
99 public static DateTimeFormatter DT_FULL_DATE_TIME_FORMAT = DateTimeFormat.forPattern("MM/dd/yyyy hh:mm aa");
100
101 public static final int BIG_DECIMAL_SCALE = 2;
102 public static final RoundingMode BIG_DECIMAL_SCALE_ROUNDING = RoundingMode.HALF_EVEN;
103 public static final BigDecimal BIG_DECIMAL_SCALED_ZERO = BigDecimal.ZERO.setScale(TkConstants.BIG_DECIMAL_SCALE, TkConstants.BIG_DECIMAL_SCALE_ROUNDING);
104 public static final BigDecimal BIG_DECIMAL_NEGATIVE_ONE = new BigDecimal("-1");
105
106 public static final MathContext MATH_CONTEXT = new MathContext(5, BIG_DECIMAL_SCALE_ROUNDING);
107 public static final BigDecimal BIG_DECIMAL_1000 = BigDecimal.TEN.multiply(BigDecimal.TEN).multiply(BigDecimal.TEN);
108 public static final BigDecimal BIG_DECIMAL_60 = BigDecimal.TEN.multiply(new BigDecimal("6"));
109 public static final BigDecimal BIG_DECIMAL_MS_IN_H = BIG_DECIMAL_1000.multiply(BIG_DECIMAL_60).multiply(BIG_DECIMAL_60);
110 public static final BigDecimal BIG_DECIMAL_MS_IN_M = BIG_DECIMAL_1000.multiply(BIG_DECIMAL_60);
111 public static final BigDecimal BIG_DECIMAL_HRS_IN_DAY = new BigDecimal(24);
112
113 public static final String SUPER_USER = TkConstants.ROLE_TK_SYS_ADMIN;
114
115
116 public static final Map<String, String> LOCATION_TO_TIME_ZONE_MAP = new HashMap<String, String>();
117
118 static {
119 LOCATION_TO_TIME_ZONE_MAP.put("NW", "America/Chicago");
120 }
121
122
123
124
125
126
127
128 public static final String ROLE_NAMESAPCE = "KUALI";
129 public static final String ROLE_TK_GLOBAL_VO = "TK_GLOBAL_VO";
130 public static final String ROLE_TK_DEPT_VO = "TK_DEPT_VO";
131 public static final String ROLE_LV_DEPT_VO = "LV_DEPT_VO";
132 public static final String ROLE_TK_LOCATION_VO = "TK_LOCATION_VO";
133 public static final String ROLE_TK_REVIEWER = "TK_REVIEWER";
134 public static final String ROLE_TK_APPROVER = "TK_APPROVER";
135 public static final String ROLE_TK_APPROVER_DELEGATE = "TK_APPROVER_DELEGATE";
136 public static final String ROLE_TK_EMPLOYEE = "TK_EMPLOYEE";
137 public static final String ROLE_TK_LOCATION_ADMIN = "TK_ORG_ADMIN";
138 public static final String ROLE_TK_DEPT_ADMIN = "TK_DEPT_ADMIN";
139 public static final String ROLE_LV_DEPT_ADMIN = "LV_DEPT_ADMIN";
140 public static final String ROLE_TK_SYS_ADMIN = "TK_SYS_ADMIN";
141 public static final String ROLE_WORK_AREA_QUALIFIER_ID = "workArea";
142 public static final List<String> ROLE_ASSIGNMENT_FOR_WORK_AREA = new ArrayList<String>(2);
143 public static final List<String> ROLE_ASSIGNMENT_FOR_USER_ROLES = new ArrayList<String>(6);
144 public static final Map<String, String> ALL_ROLES_MAP = new HashMap<String, String>();
145 public static final List<String> ROLE_ASSIGNMENT_FOR_WORK_AREA_OT_EDIT = new ArrayList<String>(3);
146
147 static {
148 ROLE_ASSIGNMENT_FOR_WORK_AREA.add(TkConstants.ROLE_TK_APPROVER);
149 ROLE_ASSIGNMENT_FOR_USER_ROLES.add(TkConstants.ROLE_TK_GLOBAL_VO);
150 ROLE_ASSIGNMENT_FOR_USER_ROLES.add(TkConstants.ROLE_TK_DEPT_VO);
151 ROLE_ASSIGNMENT_FOR_USER_ROLES.add(TkConstants.ROLE_TK_DEPT_ADMIN);
152 ROLE_ASSIGNMENT_FOR_USER_ROLES.add(TkConstants.ROLE_TK_REVIEWER);
153 ROLE_ASSIGNMENT_FOR_USER_ROLES.add(TkConstants.ROLE_TK_APPROVER);
154 ROLE_ASSIGNMENT_FOR_USER_ROLES.add(TkConstants.ROLE_TK_APPROVER_DELEGATE);
155 ROLE_ASSIGNMENT_FOR_USER_ROLES.add(TkConstants.ROLE_TK_LOCATION_ADMIN);
156 ROLE_ASSIGNMENT_FOR_USER_ROLES.add(TkConstants.ROLE_TK_LOCATION_VO);
157 ROLE_ASSIGNMENT_FOR_USER_ROLES.add(TkConstants.ROLE_TK_SYS_ADMIN);
158
159 ROLE_ASSIGNMENT_FOR_WORK_AREA_OT_EDIT.add(TkConstants.ROLE_TK_EMPLOYEE);
160 ROLE_ASSIGNMENT_FOR_WORK_AREA_OT_EDIT.add(TkConstants.ROLE_TK_APPROVER);
161 ROLE_ASSIGNMENT_FOR_WORK_AREA_OT_EDIT.add(TkConstants.ROLE_TK_APPROVER_DELEGATE);
162 ROLE_ASSIGNMENT_FOR_WORK_AREA_OT_EDIT.add(TkConstants.ROLE_TK_DEPT_ADMIN);
163
164 ALL_ROLES_MAP.put(TkConstants.ROLE_TK_REVIEWER, "Reviewer");
165 ALL_ROLES_MAP.put(TkConstants.ROLE_TK_GLOBAL_VO, "Global View Only");
166 ALL_ROLES_MAP.put(TkConstants.ROLE_TK_DEPT_VO, "Time Department View Only");
167 ALL_ROLES_MAP.put(TkConstants.ROLE_LV_DEPT_VO, "Leave Department View Only");
168
169 ALL_ROLES_MAP.put(TkConstants.ROLE_TK_LOCATION_VO, "Location View Only");
170 ALL_ROLES_MAP.put(TkConstants.ROLE_TK_APPROVER, "Approver");
171 ALL_ROLES_MAP.put(TkConstants.ROLE_TK_APPROVER_DELEGATE, "Approver Delegate");
172 ALL_ROLES_MAP.put(TkConstants.ROLE_TK_EMPLOYEE, "Employee");
173 ALL_ROLES_MAP.put(TkConstants.ROLE_TK_LOCATION_ADMIN, "Location Admin");
174 ALL_ROLES_MAP.put(TkConstants.ROLE_TK_DEPT_ADMIN, "Time Department Admin");
175 ALL_ROLES_MAP.put(TkConstants.ROLE_LV_DEPT_ADMIN, "Leave Department Admin");
176 ALL_ROLES_MAP.put(TkConstants.ROLE_TK_SYS_ADMIN, "System Admin");
177
178 }
179
180 public static final class ACTIONS {
181 public static final String CLOCK_IN = "clockIn";
182 public static final String CLOCK_OUT = "clockOut";
183 public static final String ADD_TIME_BLOCK = "addTimeBlock";
184 public static final String UPDATE_TIME_BLOCK = "updateTimeBlock";
185 public static final String DELETE_TIME_BLOCK = "deleteTimeBlock";
186 }
187
188 public static final List<String> ClOCK_ACTIONS = new ArrayList<String>();
189
190 static {
191 ClOCK_ACTIONS.add("CI");
192 ClOCK_ACTIONS.add("CO");
193 ClOCK_ACTIONS.add("LI");
194 ClOCK_ACTIONS.add("LO");
195 }
196
197
198
199
200 public static final Map<String, Set<String>> CLOCK_ACTION_TRANSITION_MAP = new HashMap<String, Set<String>>(4);
201
202 static {
203 Set<String> ci = new HashSet<String>();
204 ci.add(LUNCH_OUT);
205 ci.add(CLOCK_OUT);
206
207 Set<String> co = new HashSet<String>();
208 co.add(CLOCK_IN);
209
210 Set<String> li = new HashSet<String>();
211 li.add(CLOCK_OUT);
212
213 Set<String> lo = new HashSet<String>();
214 lo.add(LUNCH_IN);
215
216 CLOCK_ACTION_TRANSITION_MAP.put(CLOCK_IN, ci);
217 CLOCK_ACTION_TRANSITION_MAP.put(CLOCK_OUT, co);
218 CLOCK_ACTION_TRANSITION_MAP.put(LUNCH_IN, li);
219 CLOCK_ACTION_TRANSITION_MAP.put(LUNCH_OUT, lo);
220 }
221
222
223
224 public static final Map<String, Set<String>> CLOCK_AVAILABLE_ACTION_MAP = new HashMap<String, Set<String>>(4);
225
226 static {
227 Set<String> ci = new HashSet<String>();
228 ci.add(CLOCK_IN);
229
230 Set<String> co = new HashSet<String>();
231 co.add(CLOCK_OUT);
232 co.add(LUNCH_OUT);
233
234 Set<String> li = new HashSet<String>();
235 li.add(LUNCH_IN);
236
237 Set<String> lo = new HashSet<String>();
238 lo.add(CLOCK_OUT);
239 lo.add(LUNCH_OUT);
240
241 CLOCK_AVAILABLE_ACTION_MAP.put(CLOCK_IN, ci);
242 CLOCK_AVAILABLE_ACTION_MAP.put(CLOCK_OUT, co);
243 CLOCK_AVAILABLE_ACTION_MAP.put(LUNCH_IN, li);
244 CLOCK_AVAILABLE_ACTION_MAP.put(LUNCH_OUT, lo);
245 }
246
247 public static final Map<String, String> CLOCK_ACTION_STRINGS = new HashMap<String, String>(4);
248
249 static {
250 CLOCK_ACTION_STRINGS.put(CLOCK_IN, "Clock In");
251 CLOCK_ACTION_STRINGS.put(CLOCK_OUT, "Clock Out");
252 CLOCK_ACTION_STRINGS.put(LUNCH_IN, "Lunch In");
253 CLOCK_ACTION_STRINGS.put(LUNCH_OUT, "Lunch Out");
254 }
255
256 public static final class DOCUMENT_ACTIONS {
257 public static final String ROUTE = "R";
258 public static final String APPROVE = "A";
259 public static final String DISAPPROVE = "D";
260 }
261
262 public static final class BATCH_JOB_ACTIONS {
263 public static final String BATCH_JOB_INITIATE = "BI";
264 public static final String BATCH_JOB_ROUTE = "BR";
265 public static final String BATCH_JOB_APPROVE = "BA";
266 }
267
268 public static final class ROUTE_STATUS {
269 public static final String INITIATED = DocumentStatus.INITIATED.getCode();
270 public static final String ENROUTE = DocumentStatus.ENROUTE.getCode();
271 public static final String FINAL = DocumentStatus.FINAL.getCode();
272 public static final String CANCEL = DocumentStatus.CANCELED.getCode();
273 public static final String SAVED = DocumentStatus.SAVED.getCode();
274 public static final String DISAPPROVED = DocumentStatus.DISAPPROVED.getCode();
275 public static final String EXCEPTION = DocumentStatus.EXCEPTION.getCode();
276 }
277
278 public static final Map<String, String> DOC_ROUTE_STATUS = new HashMap<String, String>(8);
279
280 static {
281 DOC_ROUTE_STATUS.put(KewApiConstants.ROUTE_HEADER_INITIATED_CD, KewApiConstants.ROUTE_HEADER_INITIATED_LABEL);
282 DOC_ROUTE_STATUS.put(KewApiConstants.ROUTE_HEADER_CANCEL_CD, KewApiConstants.ROUTE_HEADER_CANCEL_LABEL);
283 DOC_ROUTE_STATUS.put(KewApiConstants.ROUTE_HEADER_ENROUTE_CD, KewApiConstants.ROUTE_HEADER_ENROUTE_LABEL);
284 DOC_ROUTE_STATUS.put(KewApiConstants.ROUTE_HEADER_FINAL_CD, KewApiConstants.ROUTE_HEADER_FINAL_LABEL);
285 DOC_ROUTE_STATUS.put(KewApiConstants.ROUTE_HEADER_DISAPPROVED_CD, KewApiConstants.ROUTE_HEADER_DISAPPROVED_LABEL);
286 DOC_ROUTE_STATUS.put(KewApiConstants.ROUTE_HEADER_EXCEPTION_CD, KewApiConstants.ROUTE_HEADER_EXCEPTION_LABEL);
287 DOC_ROUTE_STATUS.put(KewApiConstants.ROUTE_HEADER_SAVED_CD, KewApiConstants.ROUTE_HEADER_SAVED_LABEL);
288 }
289
290 public static final class BATCH_JOB_ENTRY_STATUS {
291 public static final String SCHEDULED = "S";
292 public static final String RUNNING = "R";
293 public static final String FINISHED = "F";
294 public static final String EXCEPTION = "E";
295 }
296
297 public static final class BATCH_JOB_NAMES {
298 public static final String INITIATE = "Initiate";
299 public static final String APPROVE = "Approve";
300 public static final String PAY_PERIOD_END = "Pay Period End";
301 public static final String SUPERVISOR_APPROVAL = "Supervisor Approval";
302 public static final String BATCH_APPROVE_MISSED_PUNCH = "Batch Approve Missed Punch";
303 }
304
305 public static final String BATCH_JOB_USER_PRINCIPAL_ID = "admin";
306
307 public static final String ASSIGNMENT_KEY_DELIMITER = "_";
308 public static final String HOLIDAY_EARN_CODE = "HOL";
309
310 public static final String LUNCH_EARN_CODE = "LUN";
311
312
313 public static final String NEXT_TIMESHEET = "next";
314 public static final String PREV_TIMESHEET = "prev";
315
316
317 public static final String TIMESHEET_DOCUMENT_ID_REQUEST_NAME = "tdocid";
318
319 public static final String DOCUMENT_ID_REQUEST_NAME = "docid";
320
321 public static final Integer NUMBER_OF_HOURS_CLOCKED_IN_APPROVE_TAB_HIGHLIGHT = 12;
322
323 public static final List<String> TIME_ZONES = new ArrayList<String>();
324
325 static {
326 TIME_ZONES.add("America/Chicago");
327 TIME_ZONES.add("America/Denver");
328 TIME_ZONES.add("America/Detroit");
329 TIME_ZONES.add("America/Indiana/Indianapolis");
330 TIME_ZONES.add("America/Phoenix");
331 }
332
333 public String getLUNCH_EARN_CODE() {
334 return LUNCH_EARN_CODE;
335 }
336
337 public String getEARN_CODE_AMOUNT() {
338 return EARN_CODE_AMOUNT;
339 }
340
341 public String getHOLIDAY_EARN_CODE() {
342 return HOLIDAY_EARN_CODE;
343 }
344
345 public static final Map<String, String> DOCUMENT_STATUS = new HashMap<String, String>();
346
347 static {
348 DOCUMENT_STATUS.put("I", "Initiated");
349 DOCUMENT_STATUS.put("S", "Saved");
350 DOCUMENT_STATUS.put("R", "Enroute");
351 DOCUMENT_STATUS.put("F", "Final");
352 }
353
354 public static class ConfigSettings {
355 public static final String SESSION_TIMEOUT = "session.timeout";
356 public static final String KPME_SYSTEM_TIMEZONE = "kpme.system.timezone";
357 }
358
359 public static final Integer PAGE_SIZE = 20;
360 public static final String APPROVAL_TABLE_ID = "row";
361
362 public static final String IP_SEPERATOR = ".";
363 public static final String IP_WILDCARD_PATTERN = "(%|(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))";
364
365 public static final String TASK_DEFAULT_DESP = "Default";
366
367 public static final Map<String, String> ACCRUAL_EARN_INTERVAL = new LinkedHashMap<String, String>(6);
368
369 static {
370 ACCRUAL_EARN_INTERVAL.put("D", "Daily");
371 ACCRUAL_EARN_INTERVAL.put("W", "Weekly");
372 ACCRUAL_EARN_INTERVAL.put("S", "Semi-Monthly");
373 ACCRUAL_EARN_INTERVAL.put("M", "Monthly");
374 ACCRUAL_EARN_INTERVAL.put("Y", "Yearly");
375 ACCRUAL_EARN_INTERVAL.put("N", "No Accrual");
376 }
377
378 public static final Map<String, String> SERVICE_UNIT_OF_TIME = new LinkedHashMap<String, String>(3);
379
380 static {
381 SERVICE_UNIT_OF_TIME.put("Y", "Years");
382 SERVICE_UNIT_OF_TIME.put("M", "Months");
383
384 }
385
386 public static final Map<String, String> UNIT_OF_TIME = new LinkedHashMap<String, String>(2);
387
388 static {
389 UNIT_OF_TIME.put("D", "Days");
390 UNIT_OF_TIME.put("H", "Hours");
391 }
392
393 public static final Map<String, String> MAX_BAL_FLAG = new LinkedHashMap<String, String>(2);
394
395 static {
396 MAX_BAL_FLAG.put("Y", "Yes");
397 MAX_BAL_FLAG.put("N", "No");
398 }
399
400 public static final Map<String, String> MAX_BALANCE_ACTION_FREQUENCY = new LinkedHashMap<String, String>(3);
401
402 static {
403 MAX_BALANCE_ACTION_FREQUENCY.put("LA", "Leave Approve");
404 MAX_BALANCE_ACTION_FREQUENCY.put("YE", "Year End");
405
406 }
407
408 public static final Map<String, String> ACTION_AT_MAX_BALANCE = new LinkedHashMap<String, String>(3);
409
410 static {
411 ACTION_AT_MAX_BALANCE.put("T", "Transfer");
412 ACTION_AT_MAX_BALANCE.put("P", "Payout");
413 ACTION_AT_MAX_BALANCE.put("L", "Lose");
414
415 }
416
417 public static final Map<String, String> UNUSED_TIME = new LinkedHashMap<String, String>(3);
418
419 static {
420 UNUSED_TIME.put("NUTA", "No Unused Time Allowed");
421 UNUSED_TIME.put("T", "Transfer");
422 UNUSED_TIME.put("B", "Bank");
423 }
424
425 public static final Map<String, String> EMPLOYEE_OVERRIDE_TYPE = new LinkedHashMap<String, String>(5);
426
427 static {
428 EMPLOYEE_OVERRIDE_TYPE.put("MB", "Max Balance");
429 EMPLOYEE_OVERRIDE_TYPE.put("MTA", "Max Transfer Amount");
430 EMPLOYEE_OVERRIDE_TYPE.put("MPA", "Max Payout Amount");
431 EMPLOYEE_OVERRIDE_TYPE.put("MU", "Max Usage");
432 EMPLOYEE_OVERRIDE_TYPE.put("MAC", "Max Annual Carryover");
433 }
434
435 public static final String DAILY_OVT_CODE = "DOT";
436
437 public static final Map<String, Set<String>> CLASS_INQUIRY_KEY_MAP = new HashMap<String, Set<String>>(4);
438
439 static {
440 Set<String> keys = new HashSet<String>();
441 keys.add("accrualCategory");
442 keys.add("effectiveDate");
443 CLASS_INQUIRY_KEY_MAP.put(AccrualCategory.class.getName(), keys);
444
445 keys = new HashSet<String>();
446 keys.add("earnCode");
447 keys.add("effectiveDate");
448 CLASS_INQUIRY_KEY_MAP.put(EarnCode.class.getName(), keys);
449 }
450
451 public static final String FLSA_STATUS_NON_EXEMPT ="NE";
452 public static final String FLSA_STATUS_EXEMPT ="E";
453 }