View Javadoc

1   /**
2    * Copyright 2004-2013 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.kpme.core.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  
29  import org.joda.time.format.DateTimeFormat;
30  import org.joda.time.format.DateTimeFormatter;
31  import org.kuali.kpme.core.KPMEConstants;
32  import org.kuali.kpme.core.accrualcategory.AccrualCategory;
33  import org.kuali.kpme.core.earncode.EarnCode;
34  import org.kuali.kpme.core.earncode.security.EarnCodeType;
35  import org.kuali.kpme.core.leaveplan.LeavePlan;
36  import org.kuali.rice.kew.api.KewApiConstants;
37  import org.kuali.rice.kew.api.document.DocumentStatus;
38  
39  public class HrConstants {
40  	
41  	/**
42  	 * The following were moved up from TkConstants
43  	 * @author dgodfrey
44  	 *
45  	 */
46  	
47      public static final int DEFAULT_CACHE_TIME = 900;
48      public static final String TK_TARGET_USER_PERSON = "tkTargetPerson";
49  
50  	public static final class DOCUMENT_ACTIONS {
51  		public static final String ROUTE = "R";
52  		public static final String APPROVE = "A";
53  		public static final String DISAPPROVE = "D";
54  		public static final String REFRESH = "H";
55  	}
56  
57  	public static final class BATCH_JOB_ACTIONS {
58  		public static final String BATCH_JOB_INITIATE = "BI";
59  		public static final String BATCH_JOB_ROUTE = "BR";
60  		public static final String BATCH_JOB_APPROVE = "BA";
61  	}
62  
63  	public static final class ROUTE_STATUS {
64  		public static final String INITIATED = DocumentStatus.INITIATED.getCode();
65  		public static final String ENROUTE = DocumentStatus.ENROUTE.getCode();
66  		public static final String FINAL = DocumentStatus.FINAL.getCode();
67  		public static final String CANCEL = DocumentStatus.CANCELED.getCode();
68  		public static final String SAVED = DocumentStatus.SAVED.getCode();
69  		public static final String DISAPPROVED = DocumentStatus.DISAPPROVED.getCode();
70  		public static final String EXCEPTION = DocumentStatus.EXCEPTION.getCode();
71  	}
72  
73      // Pay Frequency Type
74      public static final class PAY_FREQUENCY {
75          public static final String PAY_FREQUENCY_WEEK = "W";
76          public static final String PAY_FREQUENCY_BI_WEEK = "BW";
77          public static final String PAY_FREQUENCY_SEMI_MONTH = "SM";
78          public static final String PAY_FREQUENCY_MONTH = "M";
79      }
80  
81  	public static final Map<String, String> DOC_ROUTE_STATUS = new HashMap<String, String>(8);
82  
83  	static {
84  		DOC_ROUTE_STATUS.put(KewApiConstants.ROUTE_HEADER_INITIATED_CD, KewApiConstants.ROUTE_HEADER_INITIATED_LABEL);
85  		DOC_ROUTE_STATUS.put(KewApiConstants.ROUTE_HEADER_CANCEL_CD, KewApiConstants.ROUTE_HEADER_CANCEL_LABEL);
86  		DOC_ROUTE_STATUS.put(KewApiConstants.ROUTE_HEADER_ENROUTE_CD, KewApiConstants.ROUTE_HEADER_ENROUTE_LABEL);
87  		DOC_ROUTE_STATUS.put(KewApiConstants.ROUTE_HEADER_FINAL_CD, KewApiConstants.ROUTE_HEADER_FINAL_LABEL);
88  		DOC_ROUTE_STATUS.put(KewApiConstants.ROUTE_HEADER_DISAPPROVED_CD, KewApiConstants.ROUTE_HEADER_DISAPPROVED_LABEL);
89  		DOC_ROUTE_STATUS.put(KewApiConstants.ROUTE_HEADER_EXCEPTION_CD, KewApiConstants.ROUTE_HEADER_EXCEPTION_LABEL);
90  		DOC_ROUTE_STATUS.put(KewApiConstants.ROUTE_HEADER_SAVED_CD, KewApiConstants.ROUTE_HEADER_SAVED_LABEL);
91  	}
92  
93  	public static final class BATCH_JOB_NAMES {
94  		public static final String INITIATE = "Initiate";
95  		public static final String END_PAY_PERIOD = "End Pay Period";
96  		public static final String END_REPORTING_PERIOD = "End Reporting Period";
97  		public static final String EMPLOYEE_APPROVAL = "Employee Approval";
98  		public static final String MISSED_PUNCH_APPROVAL = "Missed Punch Approval";
99  		public static final String SUPERVISOR_APPROVAL = "Supervisor Approval";
100 		public static final String PAYROLL_APPROVAL = "Payroll Approval";
101 		public static final String LEAVE_CALENDAR_DELINQUENCY = "Leave Calendar Delinquency";
102 	}
103 
104 	public static final List<String> TIME_ZONES = new ArrayList<String>();
105 
106 	static {
107 		TIME_ZONES.add("America/Chicago");
108 		TIME_ZONES.add("America/Denver");
109 		TIME_ZONES.add("America/Detroit");
110 		TIME_ZONES.add("America/Indiana/Indianapolis");
111 		TIME_ZONES.add("America/Phoenix");
112 	}
113 
114 	/**
115 	 * 
116 	 * Refactoring starts here from TkConstants...
117 	 * 
118 	 */
119 	public static final Map<String, String> SERVICE_UNIT_OF_TIME = new LinkedHashMap<String, String>(3);
120 
121 	static {
122 		SERVICE_UNIT_OF_TIME.put("Y", "Years");
123 		SERVICE_UNIT_OF_TIME.put("M", "Months");
124 		//SERVICE_UNIT_OF_TIME.put("H", "Hours");
125 	}
126 
127 	public static final Map<String, String> UNIT_OF_TIME = new LinkedHashMap<String, String>(2);
128 
129 	static {
130 		UNIT_OF_TIME.put("D", "Days");
131 		UNIT_OF_TIME.put("H", "Hours");
132 	}
133 
134 	public static final Map<String, String> MAX_BAL_FLAG = new LinkedHashMap<String, String>(2);
135 
136 	static {
137 		MAX_BAL_FLAG.put("Y", "Yes");
138 		MAX_BAL_FLAG.put("N", "No");
139 	}
140 
141 	public static final Map<String, String> MAX_BALANCE_ACTION_FREQUENCY = new LinkedHashMap<String, String>(3);
142 
143 	static {
144 		MAX_BALANCE_ACTION_FREQUENCY.put("LA", "Leave Approve");
145 		MAX_BALANCE_ACTION_FREQUENCY.put("YE", "Year End");
146 		MAX_BALANCE_ACTION_FREQUENCY.put("OD", "On Demand");
147 		//MAX_BALANCE_ACTION_FREQUENCY.put("NA", "Not Applicable");
148 	}
149 
150 	public static final String ASSIGNMENT_KEY_DELIMITER = "_";
151 	public static final String HOLIDAY_EARN_CODE = "HOL";
152 	// Special System earn code to represent lunch deductions.
153 	public static final String LUNCH_EARN_CODE = "LUN";
154 
155     /* these are quick hacks to allow these values to be checked in jsp/tag files */
156     public String getLUNCH_EARN_CODE() {
157         return LUNCH_EARN_CODE;
158     }
159 
160     public String getEARN_CODE_AMOUNT() {
161         return EARN_CODE_AMOUNT;
162     }
163 
164     public String getHOLIDAY_EARN_CODE() {
165         return HOLIDAY_EARN_CODE;
166     }
167     /* end hack */
168 
169 	public static final String TK_TARGET_USER_RETURN = "tkTargetReturn";
170 
171 	public static final String WILDCARD_CHARACTER = "%";
172 	public static final Long WILDCARD_LONG = -1L;
173 
174 	public static final DateTimeFormatter DT_BASIC_DATE_FORMAT = DateTimeFormat.forPattern("MM/dd/yyyy");
175 
176 	public static final String FLSA_STATUS_NON_EXEMPT ="NE";
177     public static final String FLSA_STATUS_EXEMPT ="E";
178 
179 	// Timesheet document ID request parameter name
180 	public static final String TIMESHEET_DOCUMENT_ID_REQUEST_NAME = "tdocid";
181 
182 	// earn code type
183 	public static final String EARN_CODE_HOUR = "H";
184 	public static final String EARN_CODE_TIME = "T";
185 	public static final String EARN_CODE_AMOUNT = "A";
186 	public static final String EARN_CODE_OVT = "OVT";
187 
188 	public static final String EARN_CODE_DAY = "D";
189 
190     public static final String EFFECTIVE_DATE_FIELD = "effectiveDate";
191 
192 	public static final Map<String, Set<String>> CLASS_INQUIRY_KEY_MAP = new HashMap<String, Set<String>>(4);
193 
194 	static {
195 		Set<String> keys = new HashSet<String>();
196 		keys.add("leavePlan");
197 		keys.add("effectiveDate");
198 		CLASS_INQUIRY_KEY_MAP.put(LeavePlan.class.getName(), keys);
199 
200 		keys = new HashSet<String>();
201 		keys.add("accrualCategory");
202 		keys.add("effectiveDate");
203 		CLASS_INQUIRY_KEY_MAP.put(AccrualCategory.class.getName(), keys);
204 
205 		keys = new HashSet<String>();
206 		keys.add("earnCode");
207 		keys.add("effectiveDate");
208 		CLASS_INQUIRY_KEY_MAP.put(EarnCode.class.getName(), keys);
209 	}
210 
211 	public static final Map<String, String> EARN_CODE_SECURITY_TYPE = new HashMap<String, String>();
212 	
213 	static {
214 		EARN_CODE_SECURITY_TYPE.put(EarnCodeType.LEAVE.getCode(), "Leave");
215 		EARN_CODE_SECURITY_TYPE.put(EarnCodeType.TIME.getCode(), "Time");
216 		EARN_CODE_SECURITY_TYPE.put(EarnCodeType.BOTH.getCode(), "Time and Leave");
217 	}
218 	/**
219 	 * 
220 	 * The following were moved up from LMConstants
221 	 * 
222 	 * @author dgodfrey
223 	 *
224 	 */
225 
226 	public static final String SERVICE_TIME_YEAR = "year";
227 	public static final String SERVICE_TIME_MONTHS = "month";
228 
229 
230 	// Action history
231 	public static final class ACTION {
232 		public static final String DELETE = "D";
233 		public static final String ADD = "A";
234 		public static final String MODIFIED = "M";
235 	}
236 
237 	public static final class ACTION_AT_MAX_BALANCE {
238 		public static final String LOSE = "L";
239 		public static final String TRANSFER = "T";
240 		public static final String PAYOUT = "P";
241 	}
242 
243 	public static final Map<String, String> ACTION_AT_MAX_BALANCE_MAP = new LinkedHashMap<String, String>(3);
244 
245 	static {
246 		ACTION_AT_MAX_BALANCE_MAP.put(ACTION_AT_MAX_BALANCE.TRANSFER, "Transfer");
247 		ACTION_AT_MAX_BALANCE_MAP.put(ACTION_AT_MAX_BALANCE.PAYOUT, "Payout");
248 		ACTION_AT_MAX_BALANCE_MAP.put(ACTION_AT_MAX_BALANCE.LOSE, "Lose");
249 		//ACTION_AT_MAX_BALANCE.put("NA", "Not Applicable");
250 	}
251 
252 	public static final class MAX_BAL_ACTION_FREQ {
253 		public static final String LEAVE_APPROVE = "LA";
254 		public static final String YEAR_END = "YE";
255 		public static final String ON_DEMAND = "OD";
256 	}
257 
258 	// Request status
259 	public static final class REQUEST_STATUS{
260 		public static final String PLANNED="P";
261 		public static final String REQUESTED="R";
262 		public static final String APPROVED="A";
263 		public static final String DISAPPROVED = "D";
264 		public static final String DEFERRED="F";
265 		public static final String USAGE = "U";
266 	}
267 
268 	public static final Map<String, String> ROUND_OPTION_MAP = new HashMap<String, String>(2);
269 	static {
270 		ROUND_OPTION_MAP.put("T", "Traditional");
271 		ROUND_OPTION_MAP.put("R", "Truncate");
272 	}
273 
274 
275 	public static final Map<String, String> REQUEST_STATUS_STRINGS = new HashMap<String, String>(6);
276 
277 	static {
278 		REQUEST_STATUS_STRINGS.put(HrConstants.REQUEST_STATUS.PLANNED, "Planned");
279 		REQUEST_STATUS_STRINGS.put(HrConstants.REQUEST_STATUS.REQUESTED, "Requested");
280 		REQUEST_STATUS_STRINGS.put(HrConstants.REQUEST_STATUS.APPROVED, "Approved"); 
281 		REQUEST_STATUS_STRINGS.put(HrConstants.REQUEST_STATUS.DISAPPROVED, "Disapproved");
282 		REQUEST_STATUS_STRINGS.put(HrConstants.REQUEST_STATUS.DEFERRED, "Deferred");
283 		REQUEST_STATUS_STRINGS.put(HrConstants.REQUEST_STATUS.USAGE, "Usage");
284 	}
285 
286 	public static final class RECORD_METHOD {
287 		public static final String TIME = "T";
288 		public static final String HOUR = "H";
289 		public static final String AMOUNT = "A";
290 		public static final String DAY = "D";
291 	}
292 
293 	public static final Map<String, String> RECORD_METHOD_MAP = new HashMap<String, String>(2);
294 	static {
295 		RECORD_METHOD_MAP.put(RECORD_METHOD.TIME, "Time");
296 		RECORD_METHOD_MAP.put(RECORD_METHOD.HOUR, "Hours");
297 		RECORD_METHOD_MAP.put(RECORD_METHOD.AMOUNT, "Amount");
298 		RECORD_METHOD_MAP.put(RECORD_METHOD.DAY, "Days");
299 	}
300 
301 	public static final Map<String, String> ACCRUAL_BALANCE_ACTION_MAP = new LinkedHashMap<String, String>(2);
302 	static {
303 		ACCRUAL_BALANCE_ACTION_MAP.put(ACCRUAL_BALANCE_ACTION.NONE, "None");
304 		ACCRUAL_BALANCE_ACTION_MAP.put(ACCRUAL_BALANCE_ACTION.USAGE, "Usage");
305 		ACCRUAL_BALANCE_ACTION_MAP.put(ACCRUAL_BALANCE_ACTION.ADJUSTMENT, "Adjustment");
306 	}
307 
308 	//No occurrences found in workspace
309 	public static final class ACCRUAL_BALANCE_ACTION {
310 		public static final String NONE = "N";
311 		public static final String USAGE = "U";
312 		public static final String ADJUSTMENT = "A";
313 	}
314 
315 	public static final Map<String, String> EARN_CODE_USAGE_LIMIT_MAP = new LinkedHashMap<String, String>(2);
316 	static {
317 		EARN_CODE_USAGE_LIMIT_MAP.put("I", "Include");
318 		EARN_CODE_USAGE_LIMIT_MAP.put("E", "Exclude");
319 	}
320 
321 	public static final String LEAVE_CALENDAR_TYPE = "leaveCalendar";
322 	public static final String PAY_CALENDAR_TYPE = "payCalendar";
323 	public static final Integer PAGE_SIZE = 20;
324 	public static final String APPROVAL_TABLE_ID = "row";
325 	public static final String TASK_DEFAULT_DESP = "Default";
326 	public static final int BIG_DECIMAL_SCALE = 2;
327 	public static final RoundingMode BIG_DECIMAL_SCALE_ROUNDING = RoundingMode.HALF_EVEN;
328 	public static final BigDecimal BIG_DECIMAL_SCALED_ZERO = BigDecimal.ZERO.setScale(HrConstants.BIG_DECIMAL_SCALE, HrConstants.BIG_DECIMAL_SCALE_ROUNDING);
329     public static final MathContext MATH_CONTEXT = new MathContext(5, BIG_DECIMAL_SCALE_ROUNDING);
330 
331     public static final BigDecimal BIG_DECIMAL_NEGATIVE_ONE = new BigDecimal("-1");
332     public static final BigDecimal BIG_DECIMAL_1000 = BigDecimal.TEN.multiply(BigDecimal.TEN).multiply(BigDecimal.TEN);
333     public static final BigDecimal BIG_DECIMAL_60 = BigDecimal.TEN.multiply(new BigDecimal("6"));
334     public static final BigDecimal BIG_DECIMAL_MS_IN_H = BIG_DECIMAL_1000.multiply(BIG_DECIMAL_60).multiply(BIG_DECIMAL_60);
335     public static final BigDecimal BIG_DECIMAL_MS_IN_M = BIG_DECIMAL_1000.multiply(BIG_DECIMAL_60);
336     public static final BigDecimal BIG_DECIMAL_HRS_IN_DAY = new BigDecimal(24);
337 
338     public static final class CacheNamespace {
339         public static final String MODULE_NAME = "core";
340         public static final String NAMESPACE_PREFIX = KPMEConstants.CacheNamespace.ROOT_NAMESPACE_PREFIX + "/"
341                 + MODULE_NAME + "/";
342         public static final String KPME_GLOBAL_CACHE_NAME = NAMESPACE_PREFIX + "Global";
343     }
344 }