001/*
002 * Copyright 2007 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 */
016package org.kuali.ole.sys.document.validation.impl;
017
018import org.apache.commons.lang.StringUtils;
019import org.kuali.ole.sys.OLEPropertyConstants;
020import org.kuali.ole.sys.businessobject.GeneralLedgerPendingEntry;
021import org.kuali.ole.sys.context.SpringContext;
022import org.kuali.rice.kns.service.DataDictionaryService;
023
024/**
025 * Holds common constants for all Transaction Processing eDoc rule classes.
026 */
027public interface AccountingDocumentRuleBaseConstants {
028
029    // Application parameter lookup constants to be used in conjunction with the grouping constants above
030    public static final class APPLICATION_PARAMETER {
031        public static final String RESTRICTED_OBJECT_CODES = "OBJECT_CODES";
032        public static final String RESTRICTED_OBJECT_TYPE_CODES = "OBJECT_TYPES";
033        public static final String RESTRICTED_OBJECT_SUB_TYPE_CODES = "OBJECT_SUB_TYPES";
034        public static final String RESTRICTED_OBJECT_LEVELS = "OBJECT_LEVELS";
035        public static final String RESTRICTED_OBJECT_CONSOLIDATIONS = "OBJECT_CONSOLIDATIONS";
036        public static final String RESTRICTED_FUND_GROUP_CODES = "FUND_GROUPS";
037        public static final String RESTRICTED_SUB_FUND_GROUP_CODES = "SUB_FUND_GROUPS";
038        public static final String MANDATORY_TRANSFER_SUBTYPE_CODES = "MANDATORY_TRANSFER_OBJECT_SUB_TYPES";
039        public static final String NONMANDATORY_TRANSFER_SUBTYPE_CODES = "NON_MANDATORY_TRANSFER_OBJECT_SUB_TYPES";
040        public static final String FUND_GROUP_BALANCING_SET = "FUND_GROUP_BALANCING_SET";
041        // doctype parameter
042        public static final String DOCTYPE_SALES_TAX_CHECK = "SALES_TAX_APPLICABLE_DOCUMENT_TYPES";
043
044        // combination object code and account parameter
045        public static final String SALES_TAX_APPLICABLE_ACCOUNTS_AND_OBJECT_CODES = "SALES_TAX_APPLICABLE_ACCOUNTS_AND_OBJECT_CODES";
046    }
047
048    /**
049     * Constant to statically define reusable error paths
050     */
051    public static final class ERROR_PATH {
052        public static final String DELIMITER = ".";
053        public static final String DOCUMENT_ERROR_PREFIX = "document" + DELIMITER;
054    }
055
056    // GLPE OLEConstants
057    public static final class GENERAL_LEDGER_PENDING_ENTRY_CODE {
058        public static final String NO = "N";
059        public static final String YES = "Y";
060        private static String BLANK_PROJECT_STRING = null; // Max length is 10 for this field
061        private static String BLANK_SUB_OBJECT_CODE = null; // Max length is 3 for this field
062        private static String BLANK_SUB_ACCOUNT_NUMBER = null; // Max length is 5 for this field
063        private static String BLANK_OBJECT_CODE = null; // Max length is 4 for this field
064        private static String BLANK_OBJECT_TYPE_CODE = null; // Max length is 4 for this field
065        public static final int GLPE_DESCRIPTION_MAX_LENGTH = 40;
066
067        public static String getBlankProjectCode() {
068            if (BLANK_PROJECT_STRING == null) {
069                BLANK_PROJECT_STRING = StringUtils.rightPad("", SpringContext.getBean(DataDictionaryService.class).getAttributeMaxLength(GeneralLedgerPendingEntry.class, OLEPropertyConstants.PROJECT_CODE), '-');
070            }
071            return BLANK_PROJECT_STRING;
072        }
073
074        public static String getBlankFinancialSubObjectCode() {
075            if (BLANK_SUB_OBJECT_CODE == null) {
076                BLANK_SUB_OBJECT_CODE = StringUtils.rightPad("", SpringContext.getBean(DataDictionaryService.class).getAttributeMaxLength(GeneralLedgerPendingEntry.class, OLEPropertyConstants.FINANCIAL_SUB_OBJECT_CODE), '-');
077            }
078            return BLANK_SUB_OBJECT_CODE;
079        }
080
081        public static String getBlankSubAccountNumber() {
082            if (BLANK_SUB_ACCOUNT_NUMBER == null) {
083                BLANK_SUB_ACCOUNT_NUMBER = StringUtils.rightPad("", SpringContext.getBean(DataDictionaryService.class).getAttributeMaxLength(GeneralLedgerPendingEntry.class, OLEPropertyConstants.SUB_ACCOUNT_NUMBER), '-');
084            }
085            return BLANK_SUB_ACCOUNT_NUMBER;
086        }
087
088        public static String getBlankFinancialObjectCode() {
089            if (BLANK_OBJECT_CODE == null) {
090                BLANK_OBJECT_CODE = StringUtils.rightPad("", SpringContext.getBean(DataDictionaryService.class).getAttributeMaxLength(GeneralLedgerPendingEntry.class, OLEPropertyConstants.FINANCIAL_OBJECT_CODE), '-');
091            }
092            return BLANK_OBJECT_CODE;
093        }
094
095        public static String getBlankFinancialObjectType() {
096            if (BLANK_OBJECT_TYPE_CODE == null) {
097                BLANK_OBJECT_TYPE_CODE = StringUtils.rightPad("", SpringContext.getBean(DataDictionaryService.class).getAttributeMaxLength(GeneralLedgerPendingEntry.class, OLEPropertyConstants.FINANCIAL_OBJECT_TYPE_CODE), '-');
098            }
099            return BLANK_OBJECT_TYPE_CODE;
100        }
101    }
102
103    // Object Type Code OLEConstants
104    public static final class OBJECT_TYPE_CODE {
105        public static final String DOCUMENT_TYPE_INTERNAL_BILLING = "OLE_IB";
106        public static final String DOCUMENT_TYPE_DISTRIBUTION_OF_INCOME_AND_EXPENSE = "OLE_DI";
107        public static final String DOCUMENT_TYPE_SERVICE_BILLING = "OLE_SB";
108        public static final String DOCUMENT_TYPE_NON_CHECK_DISBURSEMENT = "OLE_NC";
109        public static final String DOCUMENT_TYPE_INDIRECT_COST_ADJUSTMENT = "OLE_ICA";
110    }
111
112    // Object Sub-Type Code OLEConstants
113    public static final class OBJECT_SUB_TYPE_CODE {
114        public static final String NON_MANDATORY_TRANSFER = "TN";
115        public static final String MANDATORY_TRANSFER = "MT";
116        public static final String ART_AND_MUSEUM = "AM";
117        public static final String ASSESSMENT = "AS";
118        public static final String ACCOUNT_SUMMARY_OBJECT_CODE = "AC";
119        public static final String ACCOUNTS_RECEIVABLE = "AR";
120        public static final String BLDG = "BD";
121        public static final String BLDG_FED_FUNDED = "BF";
122        public static final String BUDGET_ONLY = "BU";
123        public static final String CASH = "CA";
124        public static final String COST_RECOVERY_EXPENSE = "CE";
125        public static final String CAP_MOVE_EQUIP_FED_FUND = "CF";
126        public static final String CAP_LEASE_PURCHASE = "CL";
127        public static final String CAP_MOVE_EQUIP = "CM";
128        public static final String CAP_MOVE_EQUIP_OTHER_OWN = "CO";
129        public static final String CONSTRUCTION_IN_PROG = "CP";
130        public static final String CAPITAL_LEASE = "C1";
131        public static final String DEPRECIATION = "DR";
132        public static final String EQUIP_STARTUP_COSTS = "ES";
133        public static final String SUBTYPE_FUND_BALANCE = "FB";
134        public static final String FRINGE_BEN = "FR";
135        public static final String HOURLY_WAGES = "HW";
136        public static final String INFRASTRUCTURE = "IF";
137        public static final String INVEST = "IV";
138        public static final String LAND = "LA";
139        public static final String LOSS_DISPOSAL_ASSETS = "LD";
140        public static final String LOSS_ON_DISPOSAL_OF_ASSETS = "LD";
141        public static final String LEASE_IMPROVEMENTS = "LE";
142        public static final String LIBRARY_ACQ = "LI";
143        public static final String LIBRARY_ACQ_FED_FUND = "LF";
144        public static final String LOSS_ON_RETIREMENT_OF_ASSETS = "LO";
145        public static final String NOT_APPLICABLE = "NA";
146        public static final String OTHER_PROVISIONS = "OP";
147        public static final String PLANT_INDEBT = "PI";
148        public static final String PLANT = "PL";
149        public static final String RESERVES = "RE";
150        public static final String SALARIES = "SA";
151        public static final String STATE_APP = "ST";
152        public static final String SALARIES_WAGES = "SW";
153        public static final String TRANSFER_OF_FUNDS = "TF";
154        public static final String UNIV_CONSTRUCTED = "UC";
155        public static final String UNIV_CONSTRUCTED_FED_FUND = "UF";
156        public static final String UNIV_CONSTRUCTED_FED_OWN = "UO";
157        public static final String VALUATIONS_AND_ADJUSTMENTS = "VA";
158        public static final String WRITE_OFF = "WO";
159        public static final String STUDENT_FEES = "SF";
160    }
161
162    // Object Level Code OLEConstants
163    public static final class OBJECT_LEVEL_CODE {
164        public static final String VALUATIONS_ADJUSTMENTS = "VADJ";
165        public static final String CONTRACT_GRANTS = "C&G";
166    }
167
168    // Fund Group Code OLEConstants
169    public static final class FUND_GROUP_CODE {
170        public static final String LOAN_FUND = "LF";
171    }
172
173    // Sub Fund Group Code OLEConstants
174    public static final class SUB_FUND_GROUP_CODE {
175        public static final String CONTINUE_EDUC = "DCEDU";
176        public static final String CODE_EXTAGY = "EXTAGY";
177        public static final String RENEWAL_AND_REPLACEMENT = "PFRR";
178        public static final String CODE_RETIRE_INDEBT = "PFRI";
179        public static final String CODE_INVESTMENT_PLANT = "PFIP";
180    }
181
182    // Consolidated Object Code OLEConstants
183    public static final class CONSOLIDATED_OBJECT_CODE {
184        public static final String ASSETS = "ASST";
185        public static final String LIABILITIES = "LIAB";
186        public static final String FUND_BALANCE = "FDBL";
187    }
188
189    // Object Code OLEConstants
190    public static final class OBJECT_CODE {
191        public static final String BURSAR_ACCOUNTS_RECEIVABLES = "8160";
192        public static final String PAYROLL_DEDUCTION_INTERNAL_BENEFITS_ACCOUNTS_RECEIVABLES = "8116";
193        public static final String NON_STUDENT_ACCOUNTS_RECEIVABLES = "8118";
194        public static final String UNAPPLIED_NON_STUDENT_ACCOUNTS_RECEIVABLES = "8015";
195        public static final String NIH_MODULAR_DIRECT_COSTS = "5019";
196    }
197
198    // account constants
199    public static final class ACCOUNT_NUMBER {
200        public static final String BUDGET_LEVEL_NO_BUDGET = "N";
201    }
202
203
204    public static final class EXCEPTIONS {
205        public static final String NULL_OBJECT_SUBTYPE_MESSAGE = "An illegal argument has been passed. Cannot allow (null) subtypes.";
206    }
207}