View Javadoc
1   /*
2    * Copyright 2006 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.fp.document;
17  
18  import java.util.ArrayList;
19  import java.util.Arrays;
20  import java.util.List;
21  
22  import org.apache.commons.beanutils.PropertyUtils;
23  import org.kuali.ole.sys.OLEKeyConstants;
24  import org.kuali.ole.sys.OLEPropertyConstants;
25  import org.kuali.ole.sys.context.SpringContext;
26  import org.kuali.rice.core.api.parameter.ParameterEvaluatorService;
27  import org.kuali.rice.coreservice.framework.parameter.ParameterService;
28  import org.kuali.rice.kim.api.KimConstants;
29  
30  /**
31   * Holds constants for disbursement voucher and payee documents.
32   */
33  // TODO: after DisbursementVoucherDocumentRule is remove, it is good to change this interface into a class
34  public interface DisbursementVoucherConstants {
35      public static final String DOCUMENT_TYPE_CODE = "DV";
36  
37      // Text limits
38      public static final int MAX_NOTE_LINE_SIZE = 90;
39      
40      // payment methods
41      public static String PAYMENT_METHOD_CHECK = "P";
42      public static String PAYMENT_METHOD_WIRE = "W";
43      public static String PAYMENT_METHOD_DRAFT = "F";
44  
45      // payee types
46      public static final String DV_PAYEE_TYPE_EMPLOYEE = "E";
47      public static final String DV_PAYEE_TYPE_EMPLOYEE_DESC = "Employee";
48      
49      public static final String DV_PAYEE_TYPE_VENDOR = "V";
50      public static final String DV_PAYEE_TYPE_SUBJECT_PAYMENT_VENDOR = "VSP";
51      public static final String DV_PAYEE_TYPE_REVOLVING_FUND_VENDOR = "VRF";
52      
53      public static final List<String> VENDOR_PAYEE_TYPE_CODES = Arrays.asList(DV_PAYEE_TYPE_VENDOR, DV_PAYEE_TYPE_SUBJECT_PAYMENT_VENDOR, DV_PAYEE_TYPE_REVOLVING_FUND_VENDOR);
54  
55      // document location
56      public static final String NO_DOCUMENTATION_LOCATION = "N";
57  
58      public static final String TAX_CONTROL_CODE_ALLOWS_EMPLOYEES = "A";
59      public static final String TAX_CONTROL_CODE_BEGIN_WITHHOLDING = "B";
60      public static final String TAX_CONTROL_CODE_HOLD_PAYMENT = "H";
61  
62      public static class DocumentStatusCodes {
63          public static final String APPROVED = "A";
64          public static final String EXTRACTED = "E";
65      }
66  
67    
68       public static class DvPdpExtractGroup {
69          public static final String DV_PDP_ORG_CODE = "PRE_DISBURSEMENT_EXTRACT_ORGANIZATION";
70          public static final String DV_PDP_SBUNT_CODE = "PRE_DISBURSEMENT_EXTRACT_SUB_UNIT";
71      }
72      
73      public static class TabKey {
74          public static final String NON_EMPLOYEE_TRAVEL_EXPENSE = "NonEmployeeTravelExpense";
75          public static final String PRE_PAID_TRAVEL_EXPENSES = "PrePaidTravelExpenses";
76      }
77      
78      public enum TabByReasonCode{
79          NON_EMPLOYEE_TRAVEL_TAB(NONEMPLOYEE_TRAVEL_PAY_REASONS_PARM_NM, TabKey.NON_EMPLOYEE_TRAVEL_EXPENSE, OLEPropertyConstants.DV_NON_EMPLOYEE_TRAVEL, 
80                  OLEPropertyConstants.DISB_VCHR_NON_EMP_TRAVELER_NAME,OLEKeyConstants.WARNING_DV_NON_EMPLOYEE_TRAVEL_TAB),
81          PREPAID_TRAVEL_TAB(PREPAID_TRAVEL_PAYMENT_REASONS_PARM_NM, TabKey.PRE_PAID_TRAVEL_EXPENSES, OLEPropertyConstants.DV_PRE_CONFERENCE_DETAIL, 
82                  OLEPropertyConstants.DV_CONFERENCE_DESTINATION_NAME,OLEKeyConstants.WARNING_DV_PREPAID_TRAVEL_TAB);
83          
84          public String paymentReasonParameterName;
85          public String tabKey;
86          public String propertyName;
87          public String reprentingFieldName;
88          public String messageKey;
89  
90          private TabByReasonCode(String paymentReasonParameterName, String tabKey, String propertyName, String reprentingFieldName, String messageKey) {
91              this.paymentReasonParameterName = paymentReasonParameterName;
92              this.tabKey = tabKey;
93              this.propertyName = propertyName;
94              this.reprentingFieldName = reprentingFieldName;
95              this.messageKey = messageKey;
96          }
97          
98          private static ParameterService parameterService;
99          private static ParameterService getParameterService() {
100             if (parameterService == null) {
101                 parameterService = SpringContext.getBean(ParameterService.class);
102             }
103             return parameterService;
104         }
105         
106         public static TabByReasonCode getTabByReasonCode(String paymentReasonCode) {
107             for(TabByReasonCode tab : TabByReasonCode.values()) {
108                 if(/*REFACTORME*/SpringContext.getBean(ParameterEvaluatorService.class).getParameterEvaluator(DisbursementVoucherDocument.class, tab.paymentReasonParameterName, paymentReasonCode).evaluationSucceeds()){
109                     return tab;
110                 }
111             }            
112             return null;
113         }
114         
115         public static List<String> getAllTabKeys() {
116             List<String> tabKeys = new ArrayList<String>();
117             for(TabByReasonCode tab : TabByReasonCode.values()) {
118                 tabKeys.add(tab.tabKey);
119             }
120             return tabKeys;
121         } 
122         
123         public static List<String> getAllDocumentPropertyKeys(){
124             List<String> documentPropertyKeys = new ArrayList<String>();
125             
126             for(TabByReasonCode tab : TabByReasonCode.values()) {
127                 String propertyKey = tab.getDocumentPropertyKey();
128                 documentPropertyKeys.add(propertyKey);
129             }
130             
131             return documentPropertyKeys;
132         }
133         
134         public String getDocumentPropertyKey() {
135             return OLEPropertyConstants.DOCUMENT + PropertyUtils.NESTED_DELIM + this.propertyName + PropertyUtils.NESTED_DELIM + this.reprentingFieldName;
136         }
137     }
138 
139     // system parameter parameter constants
140     public static final String OBJECT_TYPE_GLOBAL_RESTRICTION_PARM_NM = "OBJECT_TYPES";
141     public static final String OBJECT_LEVEL_GLOBAL_RESTRICTION_PARM_NM = "OBJECT_LEVELS";
142     public static final String OBJECT_SUB_TYPE_GLOBAL_RESTRICTION_PARM_NM = "OBJECT_SUB_TYPES";
143     public static final String SUB_FUND_GLOBAL_RESTRICTION_PARM_NM = "SUB_FUND_GROUPS";
144     public static final String FUNCTION_CODE_GLOBAL_RESTRICTION_PARM_NM = "HIGHER_ED_FUNCTIONS";
145 
146     public static final String VALID_DOC_LOC_BY_PAYMENT_REASON_PARM = "VALID_DOCUMENTATION_LOCATIONS_BY_PAYMENT_REASON";
147     public static final String VALID_DOC_LOC_BY_CAMPUS_PARM = "VALID_DOCUMENTATION_LOCATIONS_BY_CAMPUS";
148     public static final String VALID_OBJ_LEVEL_BY_PAYMENT_REASON_PARM = "VALID_OBJECT_LEVELS_BY_PAYMENT_REASON";
149     public static final String VALID_OBJ_CODE_BY_PAYMENT_REASON_PARM = "VALID_OBJECT_CODES_BY_PAYMENT_REASON";
150     public static final String VALID_OBJECT_SUB_TYPES_BY_SUB_FUND_GROUP_PARM = "VALID_OBJECT_SUB_TYPES_BY_SUB_FUND_GROUP";
151     public static final String VALID_SUB_FUND_GROUPS_BY_PAYMENT_REASON_PARM = "VALID_SUB_FUND_GROUPS_BY_PAYMENT_REASON";
152     public static final String VALID_PAYEE_TYPES_BY_PAYMENT_REASON_PARM = "VALID_PAYEE_TYPES_BY_PAYMENT_REASON";
153     public static final String VALID_VENDOR_OWNERSHIP_TYPES_BY_PAYMENT_REASON = "VALID_VENDOR_OWNERSHIP_TYPES_BY_PAYMENT_REASON";
154 
155     public static final String INVALID_DOC_LOC_BY_PAYMENT_REASON_PARM = "INVALID_DOCUMENTATION_LOCATIONS_BY_PAYMENT_REASON";
156     public static final String INVALID_DOC_LOC_BY_CAMPUS_PARM = "INVALID_DOCUMENTATION_LOCATIONS_BY_CAMPUS";
157     public static final String INVALID_OBJ_LEVEL_BY_PAYMENT_REASON_PARM = "INVALID_OBJECT_LEVELS_BY_PAYMENT_REASON";
158     public static final String INVALID_OBJ_CODE_BY_PAYMENT_REASON_PARM = "INVALID_OBJECT_CODES_BY_PAYMENT_REASON";
159     public static final String INVALID_OBJECT_SUB_TYPES_BY_SUB_FUND_GROUP_PARM = "INVALID_OBJECT_SUB_TYPES_BY_SUB_FUND_GROUP";
160     public static final String INVALID_SUB_FUND_GROUPS_BY_PAYMENT_REASON_PARM = "INVALID_SUB_FUND_GROUPS_BY_PAYMENT_REASON";
161     public static final String INVALID_PAYEE_TYPES_BY_PAYMENT_REASON_PARM = "INVALID_PAYEE_TYPES_BY_PAYMENT_REASON";
162 
163     public static final String FEDERAL_TAX_PARM_PREFIX = "NON_RESIDENT_ALIEN_TAX_FEDERAL_";
164     public static final String STATE_TAX_PARM_PREFIX = "NON_RESIDENT_ALIEN_TAX_STATE_";
165     public static final String TAX_PARM_ACCOUNT_SUFFIX = "ACCOUNT";
166     public static final String TAX_PARM_CHART_SUFFIX = "CHART";
167     public static final String TAX_PARM_OBJECT_BY_INCOME_CLASS_SUFFIX = "OBJECT_CODE_BY_INCOME_CLASS";
168     public static final String ALIEN_INDICATOR_CHECKED_PARM_NM = "NON_RESIDENT_ALIEN_DOCUMENTATION_LOCATIONS";
169     public static final String ALIEN_PAYMENT_REASONS_PARM_NM = "NON_RESIDENT_ALIEN_PAYMENT_REASONS";
170     public static final String TRAVEL_PER_DIEM_MESSAGE_PARM_NM = "TRAVEL_PER_DIEM_LINK_PAGE_MESSAGE";
171     public static final String DEFAULT_DOC_LOCATION_PARM_NM = "DEFAULT_DOCUMENTATION_LOCATION";
172     public static final String ALLOW_OBJECT_CODE_EDITS = "ALLOW_ENROUTE_EDIT_OBJECT_CODES_IND";
173     public static final String TAX_DOCUMENTATION_LOCATION_CODE_PARM_NM = "TAX_DOCUMENTATION_LOCATION";
174     public static final String NONEMPLOYEE_TRAVEL_PAY_REASONS_PARM_NM = "NONEMPLOYEE_TRAVEL_PAYMENT_REASONS";
175     public static final String NONEMPLOYEE_TRAVEL_ACTUAL_MILEAGE_LIMIT_PARM_NM = "NONEMPLOYEE_TRAVEL_ACTUAL_MILEAGE_LIMIT_IND";
176     public static final String PREPAID_TRAVEL_PAYMENT_REASONS_PARM_NM = "PREPAID_TRAVEL_PAYMENT_REASONS";
177     public static final String REVOLVING_FUND_PAYMENT_REASONS_PARM_NM = "REVOLVING_FUND_PAYMENT_REASONS";
178     public static final String RESEARCH_PAYMENT_REASONS_PARM_NM = "RESEARCH_PAYMENT_REASONS";
179     public static final String RESEARCH_NON_VENDOR_PAY_LIMIT_AMOUNT_PARM_NM = "RESEARCH_NON_VENDOR_PAY_LIMIT_AMOUNT";
180     public static final String PERFORM_PREPAID_EMPL_PARM_NM = "CHECK_PREPAID_ACTIVE_EMPLOYEE_IND";
181     public static final String CHECK_EMPLOYEE_PAID_OUTSIDE_PAYROLL_PARM_NM = "CHECK_EMPLOYEE_PAID_OUTSIDE_PAYROLL_IND";
182     public static final String MOVING_PAYMENT_REASONS_PARM_NM = "MOVING_PAYMENT_REASONS";
183     public static final String DECEDENT_COMPENSATION_PAYMENT_REASONS_PARM_NM = "DECEDENT_COMPENSATION_PAYMENT_REASONS";
184     
185     public static final String NON_VENDOR_EMPLOYEE_PAYEE_TYPE_LABEL_PARM_NM = "NON_VENDOR_EMPLOYEE_PAYEE_TYPE_LABEL";
186     public static final String PO_AND_DV_PAYEE_TYPE_LABEL_PARM_NM = "PO_AND_DV_PAYEE_TYPE_LABEL";
187     public static final String INDIVIDUAL_OWNERSHIP_TYPES_PARM_NM = "INDIVIDUAL_OWNERSHIP_TYPES";
188     public static final String PAYMENT_REASONS_REQUIRING_TAX_REVIEW_PARM_NM = "PAYMENT_REASONS_REQUIRING_TAX_REVIEW";
189     public static final String CAMPUSES_TAXED_FOR_MOVING_REIMBURSEMENTS_PARM_NM = "CAMPUSES_TAXED_FOR_MOVING_REIMBURSEMENTS";
190 
191     public static final String IMMEDIATE_EXTRACT_FROM_ADDRESS_PARM_NM = "IMMEDIATE_EXTRACT_NOTIFICATION_FROM_EMAIL_ADDRESS";
192     public static final String IMMEDIATE_EXTRACT_TO_ADDRESSES_PARM_NM = "IMMEDIATE_EXTRACT_NOTIFICATION_TO_EMAIL_ADDRESSES";
193 
194     public static final String TAX_TYPE_SSN = "1";
195     public static final String TAX_TYPE_FEIN = "0";
196     
197     public static final String TAX_ID_TYPE_SSN = KimConstants.PersonExternalIdentifierTypes.TAX;
198     //public static final String TAX_ID_TYPE_FEIN = "F";
199 
200     public static final String NRA_TAX_INCOME_CLASS_FELLOWSHIP = "F";
201     public static final String NRA_TAX_INCOME_CLASS_INDEPENDENT_CONTRACTOR = "I";
202     public static final String NRA_TAX_INCOME_CLASS_ROYALTIES = "R";
203     public static final String NRA_TAX_INCOME_CLASS_NON_REPORTABLE = "N";
204 
205     public static final String FEDERAL_TAX_TYPE_CODE = "F";
206     public static final String STATE_TAX_TYPE_CODE = "S";
207 
208     public static final String DOCUMENT_TYPE_CHECKACH = "OLE_DVCA";
209     public static final String DOCUMENT_TYPE_WTFD = "OLE_DVWF";
210     
211     public static final String DV_COVER_SHEET_TEMPLATE_LINES_PARM_NM = "COVER_SHEET_TEMPLATE_LINES";
212     public static final String DV_COVER_SHEET_TEMPLATE_RLINES_PARM_NM = "COVER_SHEET_TEMPLATE_RLINES";
213     public static final String DV_COVER_SHEET_TEMPLATE_ALIEN_PARM_NM = "COVER_SHEET_TEMPLATE_NON_RESIDENT_ALIEN";
214     public static final String DV_COVER_SHEET_TEMPLATE_ATTACHMENT_PARM_NM = "COVER_SHEET_TEMPLATE_ATTACHMENT";
215     public static final String DV_COVER_SHEET_TEMPLATE_HANDLING_PARM_NM = "COVER_SHEET_TEMPLATE_HANDLING";
216     public static final String DV_COVER_SHEET_TEMPLATE_BAR_PARM_NM = "COVER_SHEET_TEMPLATE_BAR";
217     public static final String DV_COVER_SHEET_TEMPLATE_NM = "disbursementVoucherCoverSheetTemplate.pdf";
218     
219     public static final String PAYMENT_REASON_CODE_ROYALTIES_PARM_NM = "PAYMENT_REASON_CODE_ROYALTIES";
220     public static final String PAYMENT_REASON_CODE_RENTAL_PAYMENT_PARM_NM = "PAYMENT_REASON_CODE_RENTAL_PAYMENT";
221     public static final String PAYMENT_REASON_CODE_TRAVEL_HONORARIUM_PARM_NM = "PAYMENT_REASON_CODE_TRAVEL_HONORARIUM";
222    
223     
224     public static class RouteLevelNames {
225         public static final String PURCHASING = "Purchasing";
226         public static final String ACCOUNT = "Account";
227         public static final String ACCOUNTING_ORGANIZATION_HIERARCHY = "AccountingOrganizationHierarchy";
228         public static final String TAX = "Tax";
229         public static final String AWARD = "Award";
230         public static final String TRAVEL = "Travel";
231         public static final String CAMPUS = "Campus";
232         public static final String PAYMENT_METHOD = "PaymentMethod";
233     }
234 }