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