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_HRS_IN_DAY = new BigDecimal(24);
111
112 public static final String SUPER_USER = TkConstants.ROLE_TK_SYS_ADMIN;
113
114
115 public static final Map<String, String> LOCATION_TO_TIME_ZONE_MAP = new HashMap<String, String>();
116
117 static {
118 LOCATION_TO_TIME_ZONE_MAP.put("NW", "America/Chicago");
119 }
120
121
122
123
124
125
126
127 public static final String ROLE_NAMESAPCE = "KUALI";
128 public static final String ROLE_TK_GLOBAL_VO = "TK_GLOBAL_VO";
129 public static final String ROLE_TK_DEPT_VO = "TK_DEPT_VO";
130 public static final String ROLE_LV_DEPT_VO = "LV_DEPT_VO";
131 public static final String ROLE_TK_LOCATION_VO = "TK_LOCATION_VO";
132 public static final String ROLE_TK_REVIEWER = "TK_REVIEWER";
133 public static final String ROLE_TK_APPROVER = "TK_APPROVER";
134 public static final String ROLE_TK_APPROVER_DELEGATE = "TK_APPROVER_DELEGATE";
135 public static final String ROLE_TK_EMPLOYEE = "TK_EMPLOYEE";
136 public static final String ROLE_TK_LOCATION_ADMIN = "TK_ORG_ADMIN";
137 public static final String ROLE_TK_DEPT_ADMIN = "TK_DEPT_ADMIN";
138 public static final String ROLE_LV_DEPT_ADMIN = "LV_DEPT_ADMIN";
139 public static final String ROLE_TK_SYS_ADMIN = "TK_SYS_ADMIN";
140 public static final String ROLE_WORK_AREA_QUALIFIER_ID = "workArea";
141 public static final List<String> ROLE_ASSIGNMENT_FOR_WORK_AREA = new ArrayList<String>(2);
142 public static final List<String> ROLE_ASSIGNMENT_FOR_USER_ROLES = new ArrayList<String>(6);
143 public static final Map<String, String> ALL_ROLES_MAP = new HashMap<String, String>();
144 public static final List<String> ROLE_ASSIGNMENT_FOR_WORK_AREA_OT_EDIT = new ArrayList<String>(3);
145
146 static {
147 ROLE_ASSIGNMENT_FOR_WORK_AREA.add(TkConstants.ROLE_TK_APPROVER);
148 ROLE_ASSIGNMENT_FOR_USER_ROLES.add(TkConstants.ROLE_TK_GLOBAL_VO);
149 ROLE_ASSIGNMENT_FOR_USER_ROLES.add(TkConstants.ROLE_TK_DEPT_VO);
150 ROLE_ASSIGNMENT_FOR_USER_ROLES.add(TkConstants.ROLE_TK_DEPT_ADMIN);
151 ROLE_ASSIGNMENT_FOR_USER_ROLES.add(TkConstants.ROLE_TK_REVIEWER);
152 ROLE_ASSIGNMENT_FOR_USER_ROLES.add(TkConstants.ROLE_TK_APPROVER);
153 ROLE_ASSIGNMENT_FOR_USER_ROLES.add(TkConstants.ROLE_TK_APPROVER_DELEGATE);
154 ROLE_ASSIGNMENT_FOR_USER_ROLES.add(TkConstants.ROLE_TK_LOCATION_ADMIN);
155 ROLE_ASSIGNMENT_FOR_USER_ROLES.add(TkConstants.ROLE_TK_LOCATION_VO);
156 ROLE_ASSIGNMENT_FOR_USER_ROLES.add(TkConstants.ROLE_TK_SYS_ADMIN);
157
158 ROLE_ASSIGNMENT_FOR_WORK_AREA_OT_EDIT.add(TkConstants.ROLE_TK_EMPLOYEE);
159 ROLE_ASSIGNMENT_FOR_WORK_AREA_OT_EDIT.add(TkConstants.ROLE_TK_APPROVER);
160 ROLE_ASSIGNMENT_FOR_WORK_AREA_OT_EDIT.add(TkConstants.ROLE_TK_APPROVER_DELEGATE);
161 ROLE_ASSIGNMENT_FOR_WORK_AREA_OT_EDIT.add(TkConstants.ROLE_TK_DEPT_ADMIN);
162
163 ALL_ROLES_MAP.put(TkConstants.ROLE_TK_REVIEWER, "Reviewer");
164 ALL_ROLES_MAP.put(TkConstants.ROLE_TK_GLOBAL_VO, "Global View Only");
165 ALL_ROLES_MAP.put(TkConstants.ROLE_TK_DEPT_VO, "Time Department View Only");
166 ALL_ROLES_MAP.put(TkConstants.ROLE_LV_DEPT_VO, "Leave Department View Only");
167
168 ALL_ROLES_MAP.put(TkConstants.ROLE_TK_LOCATION_VO, "Location View Only");
169 ALL_ROLES_MAP.put(TkConstants.ROLE_TK_APPROVER, "Approver");
170 ALL_ROLES_MAP.put(TkConstants.ROLE_TK_APPROVER_DELEGATE, "Approver Delegate");
171 ALL_ROLES_MAP.put(TkConstants.ROLE_TK_EMPLOYEE, "Employee");
172 ALL_ROLES_MAP.put(TkConstants.ROLE_TK_LOCATION_ADMIN, "Location Admin");
173 ALL_ROLES_MAP.put(TkConstants.ROLE_TK_DEPT_ADMIN, "Time Department Admin");
174 ALL_ROLES_MAP.put(TkConstants.ROLE_LV_DEPT_ADMIN, "Leave Department Admin");
175 ALL_ROLES_MAP.put(TkConstants.ROLE_TK_SYS_ADMIN, "System Admin");
176
177 }
178
179 public static final class ACTIONS {
180 public static final String CLOCK_IN = "clockIn";
181 public static final String CLOCK_OUT = "clockOut";
182 public static final String ADD_TIME_BLOCK = "addTimeBlock";
183 public static final String UPDATE_TIME_BLOCK = "updateTimeBlock";
184 public static final String DELETE_TIME_BLOCK = "deleteTimeBlock";
185 }
186
187 public static final List<String> ClOCK_ACTIONS = new ArrayList<String>();
188
189 static {
190 ClOCK_ACTIONS.add("CI");
191 ClOCK_ACTIONS.add("CO");
192 ClOCK_ACTIONS.add("LI");
193 ClOCK_ACTIONS.add("LO");
194 }
195
196
197
198
199 public static final Map<String, Set<String>> CLOCK_ACTION_TRANSITION_MAP = new HashMap<String, Set<String>>(4);
200
201 static {
202 Set<String> ci = new HashSet<String>();
203 ci.add(LUNCH_OUT);
204 ci.add(CLOCK_OUT);
205
206 Set<String> co = new HashSet<String>();
207 co.add(CLOCK_IN);
208
209 Set<String> li = new HashSet<String>();
210 li.add(CLOCK_OUT);
211
212 Set<String> lo = new HashSet<String>();
213 lo.add(LUNCH_IN);
214
215 CLOCK_ACTION_TRANSITION_MAP.put(CLOCK_IN, ci);
216 CLOCK_ACTION_TRANSITION_MAP.put(CLOCK_OUT, co);
217 CLOCK_ACTION_TRANSITION_MAP.put(LUNCH_IN, li);
218 CLOCK_ACTION_TRANSITION_MAP.put(LUNCH_OUT, lo);
219 }
220
221
222
223 public static final Map<String, Set<String>> CLOCK_AVAILABLE_ACTION_MAP = new HashMap<String, Set<String>>(4);
224
225 static {
226 Set<String> ci = new HashSet<String>();
227 ci.add(CLOCK_IN);
228
229 Set<String> co = new HashSet<String>();
230 co.add(CLOCK_OUT);
231 co.add(LUNCH_OUT);
232
233 Set<String> li = new HashSet<String>();
234 li.add(LUNCH_IN);
235
236 Set<String> lo = new HashSet<String>();
237 lo.add(CLOCK_OUT);
238 lo.add(LUNCH_OUT);
239
240 CLOCK_AVAILABLE_ACTION_MAP.put(CLOCK_IN, ci);
241 CLOCK_AVAILABLE_ACTION_MAP.put(CLOCK_OUT, co);
242 CLOCK_AVAILABLE_ACTION_MAP.put(LUNCH_IN, li);
243 CLOCK_AVAILABLE_ACTION_MAP.put(LUNCH_OUT, lo);
244 }
245
246 public static final Map<String, String> CLOCK_ACTION_STRINGS = new HashMap<String, String>(4);
247
248 static {
249 CLOCK_ACTION_STRINGS.put(CLOCK_IN, "Clock In");
250 CLOCK_ACTION_STRINGS.put(CLOCK_OUT, "Clock Out");
251 CLOCK_ACTION_STRINGS.put(LUNCH_IN, "Lunch In");
252 CLOCK_ACTION_STRINGS.put(LUNCH_OUT, "Lunch Out");
253 }
254
255 public static final class DOCUMENT_ACTIONS {
256 public static final String ROUTE = "R";
257 public static final String APPROVE = "A";
258 public static final String DISAPPROVE = "D";
259 }
260
261 public static final class BATCH_JOB_ACTIONS {
262 public static final String BATCH_JOB_INITIATE = "BI";
263 public static final String BATCH_JOB_ROUTE = "BR";
264 public static final String BATCH_JOB_APPROVE = "BA";
265 }
266
267 public static final class ROUTE_STATUS {
268 public static final String INITIATED = DocumentStatus.INITIATED.getCode();
269 public static final String ENROUTE = DocumentStatus.ENROUTE.getCode();
270 public static final String FINAL = DocumentStatus.FINAL.getCode();
271 public static final String CANCEL = DocumentStatus.CANCELED.getCode();
272 public static final String SAVED = DocumentStatus.SAVED.getCode();
273 public static final String DISAPPROVED = DocumentStatus.DISAPPROVED.getCode();
274 public static final String EXCEPTION = DocumentStatus.EXCEPTION.getCode();
275 }
276
277 public static final Map<String, String> DOC_ROUTE_STATUS = new HashMap<String, String>(8);
278
279 static {
280 DOC_ROUTE_STATUS.put(KewApiConstants.ROUTE_HEADER_INITIATED_CD, KewApiConstants.ROUTE_HEADER_INITIATED_LABEL);
281 DOC_ROUTE_STATUS.put(KewApiConstants.ROUTE_HEADER_CANCEL_CD, KewApiConstants.ROUTE_HEADER_CANCEL_LABEL);
282 DOC_ROUTE_STATUS.put(KewApiConstants.ROUTE_HEADER_ENROUTE_CD, KewApiConstants.ROUTE_HEADER_ENROUTE_LABEL);
283 DOC_ROUTE_STATUS.put(KewApiConstants.ROUTE_HEADER_FINAL_CD, KewApiConstants.ROUTE_HEADER_FINAL_LABEL);
284 DOC_ROUTE_STATUS.put(KewApiConstants.ROUTE_HEADER_DISAPPROVED_CD, KewApiConstants.ROUTE_HEADER_DISAPPROVED_LABEL);
285 DOC_ROUTE_STATUS.put(KewApiConstants.ROUTE_HEADER_EXCEPTION_CD, KewApiConstants.ROUTE_HEADER_EXCEPTION_LABEL);
286 DOC_ROUTE_STATUS.put(KewApiConstants.ROUTE_HEADER_SAVED_CD, KewApiConstants.ROUTE_HEADER_SAVED_LABEL);
287 }
288
289 public static final class BATCH_JOB_ENTRY_STATUS {
290 public static final String SCHEDULED = "S";
291 public static final String RUNNING = "R";
292 public static final String FINISHED = "F";
293 public static final String EXCEPTION = "E";
294 }
295
296 public static final class BATCH_JOB_NAMES {
297 public static final String INITIATE = "Initiate";
298 public static final String APPROVE = "Approve";
299 public static final String PAY_PERIOD_END = "Pay Period End";
300 public static final String SUPERVISOR_APPROVAL = "Supervisor Approval";
301 public static final String BATCH_APPROVE_MISSED_PUNCH = "Batch Approve Missed Punch";
302 }
303
304 public static final String BATCH_JOB_USER_PRINCIPAL_ID = "admin";
305
306 public static final String ASSIGNMENT_KEY_DELIMITER = "_";
307 public static final String HOLIDAY_EARN_CODE = "HOL";
308
309 public static final String LUNCH_EARN_CODE = "LUN";
310
311
312 public static final String NEXT_TIMESHEET = "next";
313 public static final String PREV_TIMESHEET = "prev";
314
315
316 public static final String TIMESHEET_DOCUMENT_ID_REQUEST_NAME = "tdocid";
317
318 public static final String DOCUMENT_ID_REQUEST_NAME = "docid";
319
320 public static final Integer NUMBER_OF_HOURS_CLOCKED_IN_APPROVE_TAB_HIGHLIGHT = 12;
321
322 public static final List<String> TIME_ZONES = new ArrayList<String>();
323
324 static {
325 TIME_ZONES.add("America/Chicago");
326 TIME_ZONES.add("America/Denver");
327 TIME_ZONES.add("America/Detroit");
328 TIME_ZONES.add("America/Indiana/Indianapolis");
329 TIME_ZONES.add("America/Phoenix");
330 }
331
332 public String getLUNCH_EARN_CODE() {
333 return LUNCH_EARN_CODE;
334 }
335
336 public String getEARN_CODE_AMOUNT() {
337 return EARN_CODE_AMOUNT;
338 }
339
340 public String getHOLIDAY_EARN_CODE() {
341 return HOLIDAY_EARN_CODE;
342 }
343
344 public static final Map<String, String> DOCUMENT_STATUS = new HashMap<String, String>();
345
346 static {
347 DOCUMENT_STATUS.put("I", "Initiated");
348 DOCUMENT_STATUS.put("S", "Saved");
349 DOCUMENT_STATUS.put("R", "Enroute");
350 DOCUMENT_STATUS.put("F", "Final");
351 }
352
353 public static class ConfigSettings {
354 public static final String SESSION_TIMEOUT = "session.timeout";
355 public static final String KPME_SYSTEM_TIMEZONE = "kpme.system.timezone";
356 }
357
358 public static final Integer PAGE_SIZE = 20;
359 public static final String APPROVAL_TABLE_ID = "row";
360
361 public static final String IP_SEPERATOR = ".";
362 public static final String IP_WILDCARD_PATTERN = "(%|(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))";
363
364 public static final String TASK_DEFAULT_DESP = "Default";
365
366 public static final Map<String, String> ACCRUAL_EARN_INTERVAL = new LinkedHashMap<String, String>(6);
367
368 static {
369 ACCRUAL_EARN_INTERVAL.put("D", "Daily");
370 ACCRUAL_EARN_INTERVAL.put("W", "Weekly");
371 ACCRUAL_EARN_INTERVAL.put("S", "Semi-Monthly");
372 ACCRUAL_EARN_INTERVAL.put("M", "Monthly");
373 ACCRUAL_EARN_INTERVAL.put("Y", "Yearly");
374 ACCRUAL_EARN_INTERVAL.put("N", "No Accrual");
375 }
376
377 public static final Map<String, String> SERVICE_UNIT_OF_TIME = new LinkedHashMap<String, String>(3);
378
379 static {
380 SERVICE_UNIT_OF_TIME.put("Y", "Years");
381 SERVICE_UNIT_OF_TIME.put("M", "Months");
382
383 }
384
385 public static final Map<String, String> UNIT_OF_TIME = new LinkedHashMap<String, String>(2);
386
387 static {
388 UNIT_OF_TIME.put("D", "Days");
389 UNIT_OF_TIME.put("H", "Hours");
390 }
391
392 public static final Map<String, String> MAX_BAL_FLAG = new LinkedHashMap<String, String>(2);
393
394 static {
395 MAX_BAL_FLAG.put("Y", "Yes");
396 MAX_BAL_FLAG.put("N", "No");
397 }
398
399 public static final Map<String, String> MAX_BALANCE_ACTION_FREQUENCY = new LinkedHashMap<String, String>(3);
400
401 static {
402 MAX_BALANCE_ACTION_FREQUENCY.put("LA", "Leave Approve");
403 MAX_BALANCE_ACTION_FREQUENCY.put("YE", "Year End");
404
405 }
406
407 public static final Map<String, String> ACTION_AT_MAX_BALANCE = new LinkedHashMap<String, String>(3);
408
409 static {
410 ACTION_AT_MAX_BALANCE.put("T", "Transfer");
411 ACTION_AT_MAX_BALANCE.put("P", "Payout");
412 ACTION_AT_MAX_BALANCE.put("L", "Lose");
413
414 }
415
416 public static final Map<String, String> UNUSED_TIME = new LinkedHashMap<String, String>(3);
417
418 static {
419 UNUSED_TIME.put("NUTA", "No Unused Time Allowed");
420 UNUSED_TIME.put("T", "Transfer");
421 UNUSED_TIME.put("B", "Bank");
422 }
423
424 public static final Map<String, String> EMPLOYEE_OVERRIDE_TYPE = new LinkedHashMap<String, String>(5);
425
426 static {
427 EMPLOYEE_OVERRIDE_TYPE.put("MB", "Max Balance");
428 EMPLOYEE_OVERRIDE_TYPE.put("MTA", "Max Transfer Amount");
429 EMPLOYEE_OVERRIDE_TYPE.put("MPA", "Max Payout Amount");
430 EMPLOYEE_OVERRIDE_TYPE.put("MU", "Max Usage");
431 EMPLOYEE_OVERRIDE_TYPE.put("MAC", "Max Annual Carryover");
432 }
433
434 public static final String DAILY_OVT_CODE = "DOT";
435
436 public static final Map<String, Set<String>> CLASS_INQUIRY_KEY_MAP = new HashMap<String, Set<String>>(4);
437
438 static {
439 Set<String> keys = new HashSet<String>();
440 keys.add("accrualCategory");
441 keys.add("effectiveDate");
442 CLASS_INQUIRY_KEY_MAP.put(AccrualCategory.class.getName(), keys);
443
444 keys = new HashSet<String>();
445 keys.add("earnCode");
446 keys.add("effectiveDate");
447 CLASS_INQUIRY_KEY_MAP.put(EarnCode.class.getName(), keys);
448 }
449
450 public static final String FLSA_STATUS_NON_EXEMPT ="NE";
451 public static final String FLSA_STATUS_EXEMPT ="E";
452 }