View Javadoc
1   /*
2    * Copyright 2007 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.ole.sys.document.validation.impl;
17  
18  import org.apache.commons.lang.StringUtils;
19  import org.kuali.ole.sys.OLEPropertyConstants;
20  import org.kuali.ole.sys.businessobject.GeneralLedgerPendingEntry;
21  import org.kuali.ole.sys.context.SpringContext;
22  import org.kuali.rice.kns.service.DataDictionaryService;
23  
24  /**
25   * Holds common constants for all Transaction Processing eDoc rule classes.
26   */
27  public interface AccountingDocumentRuleBaseConstants {
28  
29      // Application parameter lookup constants to be used in conjunction with the grouping constants above
30      public static final class APPLICATION_PARAMETER {
31          public static final String RESTRICTED_OBJECT_CODES = "OBJECT_CODES";
32          public static final String RESTRICTED_OBJECT_TYPE_CODES = "OBJECT_TYPES";
33          public static final String RESTRICTED_OBJECT_SUB_TYPE_CODES = "OBJECT_SUB_TYPES";
34          public static final String RESTRICTED_OBJECT_LEVELS = "OBJECT_LEVELS";
35          public static final String RESTRICTED_OBJECT_CONSOLIDATIONS = "OBJECT_CONSOLIDATIONS";
36          public static final String RESTRICTED_FUND_GROUP_CODES = "FUND_GROUPS";
37          public static final String RESTRICTED_SUB_FUND_GROUP_CODES = "SUB_FUND_GROUPS";
38          public static final String MANDATORY_TRANSFER_SUBTYPE_CODES = "MANDATORY_TRANSFER_OBJECT_SUB_TYPES";
39          public static final String NONMANDATORY_TRANSFER_SUBTYPE_CODES = "NON_MANDATORY_TRANSFER_OBJECT_SUB_TYPES";
40          public static final String FUND_GROUP_BALANCING_SET = "FUND_GROUP_BALANCING_SET";
41          // doctype parameter
42          public static final String DOCTYPE_SALES_TAX_CHECK = "SALES_TAX_APPLICABLE_DOCUMENT_TYPES";
43  
44          // combination object code and account parameter
45          public static final String SALES_TAX_APPLICABLE_ACCOUNTS_AND_OBJECT_CODES = "SALES_TAX_APPLICABLE_ACCOUNTS_AND_OBJECT_CODES";
46      }
47  
48      /**
49       * Constant to statically define reusable error paths
50       */
51      public static final class ERROR_PATH {
52          public static final String DELIMITER = ".";
53          public static final String DOCUMENT_ERROR_PREFIX = "document" + DELIMITER;
54      }
55  
56      // GLPE OLEConstants
57      public static final class GENERAL_LEDGER_PENDING_ENTRY_CODE {
58          public static final String NO = "N";
59          public static final String YES = "Y";
60          private static String BLANK_PROJECT_STRING = null; // Max length is 10 for this field
61          private static String BLANK_SUB_OBJECT_CODE = null; // Max length is 3 for this field
62          private static String BLANK_SUB_ACCOUNT_NUMBER = null; // Max length is 5 for this field
63          private static String BLANK_OBJECT_CODE = null; // Max length is 4 for this field
64          private static String BLANK_OBJECT_TYPE_CODE = null; // Max length is 4 for this field
65          public static final int GLPE_DESCRIPTION_MAX_LENGTH = 40;
66  
67          public static String getBlankProjectCode() {
68              if (BLANK_PROJECT_STRING == null) {
69                  BLANK_PROJECT_STRING = StringUtils.rightPad("", SpringContext.getBean(DataDictionaryService.class).getAttributeMaxLength(GeneralLedgerPendingEntry.class, OLEPropertyConstants.PROJECT_CODE), '-');
70              }
71              return BLANK_PROJECT_STRING;
72          }
73  
74          public static String getBlankFinancialSubObjectCode() {
75              if (BLANK_SUB_OBJECT_CODE == null) {
76                  BLANK_SUB_OBJECT_CODE = StringUtils.rightPad("", SpringContext.getBean(DataDictionaryService.class).getAttributeMaxLength(GeneralLedgerPendingEntry.class, OLEPropertyConstants.FINANCIAL_SUB_OBJECT_CODE), '-');
77              }
78              return BLANK_SUB_OBJECT_CODE;
79          }
80  
81          public static String getBlankSubAccountNumber() {
82              if (BLANK_SUB_ACCOUNT_NUMBER == null) {
83                  BLANK_SUB_ACCOUNT_NUMBER = StringUtils.rightPad("", SpringContext.getBean(DataDictionaryService.class).getAttributeMaxLength(GeneralLedgerPendingEntry.class, OLEPropertyConstants.SUB_ACCOUNT_NUMBER), '-');
84              }
85              return BLANK_SUB_ACCOUNT_NUMBER;
86          }
87  
88          public static String getBlankFinancialObjectCode() {
89              if (BLANK_OBJECT_CODE == null) {
90                  BLANK_OBJECT_CODE = StringUtils.rightPad("", SpringContext.getBean(DataDictionaryService.class).getAttributeMaxLength(GeneralLedgerPendingEntry.class, OLEPropertyConstants.FINANCIAL_OBJECT_CODE), '-');
91              }
92              return BLANK_OBJECT_CODE;
93          }
94  
95          public static String getBlankFinancialObjectType() {
96              if (BLANK_OBJECT_TYPE_CODE == null) {
97                  BLANK_OBJECT_TYPE_CODE = StringUtils.rightPad("", SpringContext.getBean(DataDictionaryService.class).getAttributeMaxLength(GeneralLedgerPendingEntry.class, OLEPropertyConstants.FINANCIAL_OBJECT_TYPE_CODE), '-');
98              }
99              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 }