001 /*
002 * Copyright 2011 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.kfs.module.ld;
017
018 import java.util.ArrayList;
019 import java.util.HashMap;
020 import java.util.List;
021 import java.util.Map;
022
023 import org.apache.commons.lang.StringUtils;
024 import org.kuali.kfs.gl.businessobject.OriginEntryFull;
025 import org.kuali.kfs.module.ld.businessobject.LaborOriginEntry;
026 import org.kuali.kfs.sys.KFSConstants;
027 import org.kuali.kfs.sys.KFSPropertyConstants;
028 import org.kuali.kfs.sys.context.SpringContext;
029 import org.kuali.kfs.sys.service.impl.KfsParameterConstants;
030 import org.kuali.rice.kns.datadictionary.AttributeDefinition;
031 import org.kuali.rice.kns.service.DataDictionaryService;
032 import org.kuali.rice.kns.service.ParameterService;
033
034 /**
035 * Global constancts for labor distribution.
036 */
037 public class LaborConstants {
038 public static class BalanceInquiries {
039 public static final String ANNUAL_BALANCE = "ACLN_ANNL_BAL_AMT";
040 public static final String BALANCE_TYPE_AC_AND_A21 = "AC&A2";
041 public static final String CONTRACT_GRANT_BB_AMOUNT = "CONTR_GR_BB_AC_AMT";
042 public static final String EMPLOYEE_FUNDING_EXPENSE_OBJECT_TYPE_CODE = "ES";
043 public static final String EMPLOYEE_FUNDING_NORMAL_OP_EXPENSE_OBJECT_TYPE_CODE = "EX";
044 public static final int laborHighValueObjectCode = 5000;
045 public static final int laborLowValueObjectCode = 2000;
046 public static final String LEDGER_ENTRY_LOOKUPABLE_FOR_EXPENSE_TRANSFER = "laborLedgerEntryForExpenseTransferLookupable";
047 public static final String UnknownPersonName = "* Unknown Name *";
048 }
049
050 public static class ColumnNames {
051 public static final String UNIVERSITY_FISCAL_YEAR = "UNIV_FISCAL_YR";
052 public static final String TRANSACTION_LEDGER_ENTRY_AMOUNT = "TRN_LDGR_ENTR_AMT";
053 public static final String POSITION_NUMBER = "POSITION_NBR";
054 public static final String EMPLOYEE_IDENTIFIER = "EMPLID";
055 }
056
057 public static class BenefitExpenseTransfer {
058 public static final String LABOR_LEDGER_BENEFIT_CODE = "F";
059 }
060
061 public static class DestinationNames {
062 public static final String LABOR_GL_ENTRY = "LD_LBR_GL_ENTRY_T";
063 public static final String LEDGER_BALANCE = "LD_LDGR_BAL_T";
064 public static final String LEDGER_ENRTY = "LD_LDGR_ENTR_T";
065 public static final String ORIGN_ENTRY = "LD_LBR_ORIGIN_ENTRY_T";
066 }
067
068 public enum JournalVoucherOffsetType {
069 ACCRUAL("LJVA", "Accrual", "LLJV ACCRUALS OFFSET"), CASH("LJVC", "Cash", "LLJV CASH OFFSET"), ENCUMBRANCE("LJVE", "Encumbrance", "LLJV ENCUMBRANCE OFFSET"), NO_OFFSET("LLJV", "No Offset", "LABOR LEDGER JOUNAL VOUCHER");
070
071 public String description;
072 public String longDescription;
073 public String typeCode;
074
075 private JournalVoucherOffsetType(String typeCode, String description, String longDescription) {
076 this.typeCode = typeCode;
077 this.description = description;
078 this.longDescription = longDescription;
079 }
080 }
081
082 public static class LookupableBeanKeys {
083 static final public String CSF_TRACKER = "laborCalculatedSalaryFoundationTrackerLookupable";
084 static final public String PENDING_ENTRY = "laborPendingEntryLookupable";
085 }
086
087 public static class ParameterGroups {
088 public static final String PAYROLL_ACCRUAL = "Labor.PayrollAccrual";
089 public static final String POSTER = "Labor.Poster";
090 public static final String YEAR_END = "Labor.YearEnd";
091 }
092
093 public static class Poster {
094 public static final String BALANCE_TYPES_NOT_PROCESSED = "SENT_TO_GL_BALANCE_TYPES";
095 public static final String PERIOD_CODES_NOT_PROCESSED = "SENT_TO_GL_PERIOD_CODES";
096 }
097
098 public static class Balancing {
099 public static final String NUMBER_OF_PAST_FISCAL_YEARS_TO_INCLUDE = "NUMBER_OF_PAST_FISCAL_YEARS_TO_INCLUDE";
100 public static final String NUMBER_OF_COMPARISON_FAILURES_TO_PRINT_PER_REPORT = "NUMBER_OF_COMPARISON_FAILURES_TO_PRINT_PER_REPORT";
101 }
102
103 public static class SalaryExpenseTransfer {
104 public static final String BENEFIT_CLEARING_ACCOUNT_PARM_NM = "BENEFIT_CLEARING_ACCOUNT_NUMBER";
105 public static final String BENEFIT_CLEARING_CHART_PARM_NM = "BENEFIT_CLEARING_CHART_OF_ACCOUNTS";
106 public static final String LABOR_LEDGER_SALARY_CODE = "S";
107 public static final String EFFORT_VALIDATION_OVERRIDE_QUESTION = "EffortValidationOverrideQuestion";
108 public static final String VALIDATE_AGAINST_EFFORT_PARM_NM = "VALIDATE_AGAINST_EFFORT_CERTIFICATION_IND";
109 }
110
111 public static class Scrubber {
112 public static final String ACCOUNT_FRINGE_EXCLUSION_PARAMETER = "ACCOUNTS_NOT_ACCEPTING_FRINGES_IND";
113 public static final String CONTINUATION_ACCOUNT_LOGIC_PARAMETER = "CONTINUATION_ACCOUNT_LOGIC_IND";
114 public static final String SUBFUND_WAGE_EXCLUSION_PARAMETER = "SUB_FUND_GROUPS_NOT_ACCEPTING_WAGES_IND";
115 public static final String SUSPENSE_ACCOUNT_LOGIC_PARAMETER = "SUSPENSE_ACCOUNT_LOGIC_IND";
116 public static final String SUSPENSE_ACCOUNT = "SUSPENSE_ACCOUNT";
117 public static final String SUSPENSE_CHART = "SUSPENSE_CHART";
118 public static final String SUSPENSE_SUB_ACCOUNT = "SUSPENSE_SUB_ACCOUNT";
119 public static final String CLOSED_FISCAL_PERIOD_BYPASS_BALANCE_TYPES = "CLOSED_FISCAL_PERIOD_BYPASS_BALANCE_TYPES";
120 public static final String CONTINUATION_ACCOUNT_BYPASS_ORIGINATION_CODES = "CONTINUATION_ACCOUNT_BYPASS_ORIGINATIONS";
121 public static final String CONTINUATION_ACCOUNT_BYPASS_DOCUMENT_TYPE_CODES = "CONTINUATION_ACCOUNT_BYPASS_DOCUMENT_TYPES";
122 public static final String NON_FRINGE_ACCOUNT_BYPASS_ORIGINATIONS = "NON_FRINGE_ACCOUNT_BYPASS_ORIGINATIONS";
123 public static final String NON_WAGE_SUB_FUND_BYPASS_ORIGINATIONS = "NON_WAGE_SUB_FUND_BYPASS_ORIGINATIONS";
124 }
125
126 public static class BatchFileSystem {
127 static final public String EXTENSION = ".data";
128 static final public String DONE_FILE_EXTENSION = ".done";
129
130 static final public String NIGHTLY_OUT_FILE = "ld_labentry_kfs";
131 static final public String BACKUP_FILE = "ld_ldbackup";
132 static final public String PRE_SCRUBBER_FILE = "ld_prescrub";
133 static final public String SCRUBBER_INPUT_FILE = "ld_sortscrb";
134
135 static final public String SCRUBBER_VALID_OUTPUT_FILE = "ld_scrbout1";
136 static final public String SCRUBBER_ERROR_OUTPUT_FILE = "ld_scrberr1";
137 static final public String SCRUBBER_EXPIRED_OUTPUT_FILE = "ld_expaccts";
138
139 static final public String SCRUBBER_ERROR_SORTED_FILE = "ld_sorterr1";
140 static final public String DEMERGER_VAILD_OUTPUT_FILE = "ld_scrbout2";
141 static final public String DEMERGER_ERROR_OUTPUT_FILE = "ld_scrberr2";
142
143 static final public String POSTER_INPUT_FILE = "ld_sortpost";
144 static final public String POSTER_VALID_OUTPUT_FILE = "ld_postout";
145 static final public String POSTER_ERROR_OUTPUT_FILE = "ld_posterrs";
146
147 static final public String LABOR_GL_ENTRY_FILE = "gl_glentry_lab";
148 static final public String BALANCE_FORWARDS_FILE = "ld_balance_forwards";
149 static final public String LABOR_ENTERPRISE_FEED = "ld_ldentry_entp";
150 }
151
152 public static class TransactionGeneratorNames {
153 public static final String BENEFIT_ACCRUAL = "BENEFIT ACCRUAL";
154 public static final String BENEFIT_REVERSAL = "BENEFIT REVERSAL";
155 public static final String DISENCUMBRANCE = "DISENCUMBRANCE";
156 public static final String ENCUMBRANCE = "ENCUMBRANCE";
157 public static final String SALARY_ACCRUAL = "SALARY ACCRUAL";
158 public static final String SALARY_REVERSAL = "SALARY REVERSAL";
159 }
160
161 public static class YearEnd {
162 public static final String FUND_GROUP_PROCESSED = "FUND_GROUPS";
163 public static final String OLD_FISCAL_YEAR = "FISCAL_YEAR_SELECTION";
164 public static final String ORIGINATION_CODE = "ORIGINATION";
165 public static final String SUB_FUND_GROUP_PROCESSED = "SUB_FUND_GROUPS";
166 }
167
168 public static class PurgeJob {
169 public static final String PURGE_LEDGER_BALANCE_YEAR = "PRIOR_TO_YEAR";
170 public static final String PURGE_LEDGER_ENTRY_YEAR = "PRIOR_TO_YEAR";
171 }
172
173 public static final String BASE_FUNDS_LOOKUP_HELPER_SRVICE_NAME = "BaseFundsLookupableHelperService";
174
175 public static final String CSF_TRACKER_LOOKUP_HELPER_SRVICE_NAME = "laborCalculatedSalaryFoundationTrackerLookupableHelperService";
176
177 public static final String CURRENT_FUNDS_LOOKUP_HELPER_SRVICE_NAME = "CurrentFundsLookupableHelperService";
178 public static final String DASHES_DELETE_CODE = "-";
179
180 public static final String DOCUMENT_EMPLOYEE_ID_ERRORS = "document.emplid";
181 public static final String EMPLOYEE_LOOKUP_ERRORS = "document.employeeLookups";
182 public static final String EXPENSE_TRANSFER_ACCOUNTING_LINE_SERVIOCE_NAME = "expenseTransferAccountingLineService";
183 public static final String LABOR_INQUIRY_OPTIONS_SERVICE = "laborInquiryOptionsService";
184 public static final int LLCP_MAX_LENGTH = 294;
185 public static final String LONG_ROW_TABLE_INRUIRY_ACTION = "laborLongRowTableInquiry.do";
186 public static final Map<String, String> periodCodeMapping = new HashMap<String, String>();
187 private static String SPACE_TRANSACTION_DATE = null;
188
189 static {
190 periodCodeMapping.put(KFSPropertyConstants.MONTH1_AMOUNT, KFSConstants.MONTH1);
191 periodCodeMapping.put(KFSPropertyConstants.MONTH2_AMOUNT, KFSConstants.MONTH2);
192 periodCodeMapping.put(KFSPropertyConstants.MONTH3_AMOUNT, KFSConstants.MONTH3);
193 periodCodeMapping.put(KFSPropertyConstants.MONTH4_AMOUNT, KFSConstants.MONTH4);
194 periodCodeMapping.put(KFSPropertyConstants.MONTH5_AMOUNT, KFSConstants.MONTH5);
195 periodCodeMapping.put(KFSPropertyConstants.MONTH6_AMOUNT, KFSConstants.MONTH6);
196 periodCodeMapping.put(KFSPropertyConstants.MONTH7_AMOUNT, KFSConstants.MONTH7);
197 periodCodeMapping.put(KFSPropertyConstants.MONTH8_AMOUNT, KFSConstants.MONTH8);
198 periodCodeMapping.put(KFSPropertyConstants.MONTH9_AMOUNT, KFSConstants.MONTH9);
199 periodCodeMapping.put(KFSPropertyConstants.MONTH10_AMOUNT, KFSConstants.MONTH10);
200 periodCodeMapping.put(KFSPropertyConstants.MONTH11_AMOUNT, KFSConstants.MONTH11);
201 periodCodeMapping.put(KFSPropertyConstants.MONTH12_AMOUNT, KFSConstants.MONTH12);
202 periodCodeMapping.put(KFSPropertyConstants.MONTH13_AMOUNT, KFSConstants.MONTH13);
203 }
204
205 public static List<String> consolidationAttributesOfOriginEntry() {
206 List<String> consolidationAttributes = new ArrayList<String>();
207
208 consolidationAttributes.add(KFSPropertyConstants.UNIVERSITY_FISCAL_YEAR);
209 consolidationAttributes.add(KFSPropertyConstants.UNIVERSITY_FISCAL_PERIOD_CODE);
210
211 consolidationAttributes.add(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE);
212 consolidationAttributes.add(KFSPropertyConstants.ACCOUNT_NUMBER);
213 consolidationAttributes.add(KFSPropertyConstants.SUB_ACCOUNT_NUMBER);
214
215 consolidationAttributes.add(KFSPropertyConstants.FINANCIAL_BALANCE_TYPE_CODE);
216 consolidationAttributes.add(KFSPropertyConstants.FINANCIAL_OBJECT_CODE);
217 consolidationAttributes.add(KFSPropertyConstants.FINANCIAL_SUB_OBJECT_CODE);
218 consolidationAttributes.add(KFSPropertyConstants.FINANCIAL_OBJECT_TYPE_CODE);
219
220 consolidationAttributes.add(KFSPropertyConstants.FINANCIAL_DOCUMENT_TYPE_CODE);
221 consolidationAttributes.add(KFSPropertyConstants.DOCUMENT_NUMBER);
222 consolidationAttributes.add(KFSPropertyConstants.ORGANIZATION_DOCUMENT_NUMBER);
223
224 consolidationAttributes.add(KFSPropertyConstants.FINANCIAL_SYSTEM_ORIGINATION_CODE);
225 consolidationAttributes.add(KFSPropertyConstants.PROJECT_CODE);
226 consolidationAttributes.add(KFSPropertyConstants.ORGANIZATION_REFERENCE_ID);
227 consolidationAttributes.add(KFSPropertyConstants.TRANSACTION_LEDGER_ENTRY_DESC);
228
229 // Reference Document Type, Reference Origin Code, Reference Document Number, Reversal Date, and Encumbrance Update Code.
230 consolidationAttributes.add(KFSPropertyConstants.REFERENCE_FINANCIAL_DOCUMENT_TYPE_CODE);
231 consolidationAttributes.add(KFSPropertyConstants.REFERENCE_FINANCIAL_SYSTEM_ORIGINATION_CODE);
232 consolidationAttributes.add(KFSPropertyConstants.REFERENCE_FINANCIAL_DOCUMENT_NUMBER);
233 consolidationAttributes.add(KFSPropertyConstants.FINANCIAL_DOCUMENT_REVERSAL_DATE);
234 consolidationAttributes.add(KFSPropertyConstants.TRANSACTION_ENCUMBRANCE_UPDT_CD);
235
236 consolidationAttributes.add(KFSPropertyConstants.TRANSACTION_DEBIT_CREDIT_CODE);
237 consolidationAttributes.add(KFSPropertyConstants.TRANSACTION_LEDGER_ENTRY_AMOUNT);
238
239 return consolidationAttributes;
240 }
241
242 public static String getSpaceTransactionDate() {
243 if (SPACE_TRANSACTION_DATE == null) {
244 SPACE_TRANSACTION_DATE = StringUtils.rightPad("", SpringContext.getBean(DataDictionaryService.class).getAttributeSize(OriginEntryFull.class, KFSPropertyConstants.TRANSACTION_DATE), ' ');
245 }
246 return SPACE_TRANSACTION_DATE;
247 }
248
249 public static final String ANNUAL_CLOSING_DOCUMENT_TYPE_CODE = getAnnualClosingDocumentType();
250
251 private static String getAnnualClosingDocumentType() {
252 return SpringContext.getBean(ParameterService.class).getParameterValue(KfsParameterConstants.GENERAL_LEDGER_BATCH.class, KFSConstants.SystemGroupParameterNames.GL_ANNUAL_CLOSING_DOC_TYPE);
253 }
254
255 public static final String[] ACCOUNT_FIELDS = { KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE, KFSPropertyConstants.ACCOUNT_NUMBER };
256
257 public static final String LABOR_OBJECT_SALARY_CODE = "S";
258
259 private static String DASH_POSITION_NUMBER = null;
260
261 public static String getDashPositionNumber() {
262 if (DASH_POSITION_NUMBER == null) {
263 DASH_POSITION_NUMBER = StringUtils.rightPad("", SpringContext.getBean(DataDictionaryService.class).getAttributeMaxLength(LaborOriginEntry.class, KFSPropertyConstants.POSITION_NUMBER), '-');
264 }
265 return DASH_POSITION_NUMBER;
266 }
267
268 private static String DASH_EMPLID = null;
269
270 public static String getDashEmplId() {
271 if (DASH_EMPLID == null) {
272 DASH_EMPLID = StringUtils.rightPad("", SpringContext.getBean(DataDictionaryService.class).getAttributeMaxLength(LaborOriginEntry.class, KFSPropertyConstants.EMPLID), '-');
273 }
274 return DASH_EMPLID;
275 }
276
277 public static String getSpaceAllLaborOriginEntryFields() {
278
279 List<AttributeDefinition> attributes = SpringContext.getBean(DataDictionaryService.class).getDataDictionary().getBusinessObjectEntry(LaborOriginEntry.class.getName()).getAttributes();
280 int totalLength = 0;
281 for (AttributeDefinition attributeDefinition : attributes) {
282 if (!(KFSPropertyConstants.ENTRY_GROUP_ID.equals(attributeDefinition.getName()) || KFSPropertyConstants.ENTRY_ID.equals(attributeDefinition.getName()))) {
283 totalLength += attributeDefinition.getMaxLength();
284 }
285 }
286
287 return StringUtils.rightPad("", totalLength, ' ');
288 }
289
290
291 public static final String LABOR_MODULE_CODE = "KFS-LD";
292
293 public static class PermissionNames {
294 public static final String OVERRIDE_TRANSFER_IMPACTING_EFFORT_CERTIFICATION = "Override Transfer Impacting Open Effort Certification";
295 }
296 }