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.bc.util; 017 018 import java.math.BigDecimal; 019 import java.util.List; 020 021 import org.apache.commons.lang.StringUtils; 022 import org.kuali.kfs.module.bc.BCParameterKeyConstants; 023 import org.kuali.kfs.module.bc.businessobject.BudgetConstructionIntendedIncumbent; 024 import org.kuali.kfs.module.bc.businessobject.BudgetConstructionPayRateHolding; 025 import org.kuali.kfs.module.bc.businessobject.BudgetConstructionPosition; 026 import org.kuali.kfs.module.bc.document.BudgetConstructionDocument; 027 import org.kuali.kfs.module.bc.batch.GenesisBatchStep; 028 import org.kuali.kfs.sys.context.SpringContext; 029 import org.kuali.rice.kns.service.ParameterService; 030 031 /** 032 * A convenient utility that can delegate the calling client to retrieve system parameters of budget construction module. 033 */ 034 public class BudgetParameterFinder { 035 private static ParameterService parameterService = SpringContext.getBean(ParameterService.class); 036 037 /** 038 * get the biweekly pay type codes setup in system parameters 039 * 040 * @return the biweekly pay type codes setup in system parameters 041 */ 042 public static List<String> getBiweeklyPayTypeCodes() { 043 return parameterService.getParameterValues(BudgetConstructionDocument.class, BCParameterKeyConstants.BIWEEKLY_PAY_TYPE_CODES); 044 } 045 046 /** 047 * get the annual working hours setup in system paremters for extract process 048 * 049 * @return the annual working hours setup in system paremters 050 */ 051 public static Integer getAnnualWorkingHours() { 052 String annualWorkingHours = parameterService.getParameterValue(BudgetConstructionDocument.class, BCParameterKeyConstants.ANNUAL_WORKING_HOURS); 053 054 return Integer.valueOf(StringUtils.trim(annualWorkingHours)); 055 } 056 057 /** 058 * get the weekly working hours setup in system paremters for extract process 059 * 060 * @return the weekly working hours setup in system paremters 061 */ 062 public static Integer getWeeklyWorkingHours() { 063 String weeklyWorkingHours = parameterService.getParameterValue(BudgetConstructionDocument.class, BCParameterKeyConstants.WEEKLY_WORKING_HOURS); 064 065 return Integer.valueOf(StringUtils.trim(weeklyWorkingHours)); 066 } 067 068 /** 069 * get the weekly working hours setup in system paremters for extract process 070 * 071 * @return the weekly working hours setup in system paremters 072 */ 073 public static BigDecimal getWeeklyWorkingHoursAsDecimal() { 074 Integer weeklyWorkingHours = getWeeklyWorkingHours(); 075 076 return BigDecimal.valueOf(weeklyWorkingHours); 077 } 078 079 /** 080 * get the sub fund group codes not allowed 2plg generation setup in system parameters 081 * 082 * @return the sub fund group codes not allowed 2plg generation setup in system parameters 083 */ 084 public static List<String> getNotGenerate2PlgSubFundGroupCodes() { 085 return parameterService.getParameterValues(BudgetConstructionDocument.class, BCParameterKeyConstants.GENERATE_2PLG_SUB_FUND_GROUPS); 086 } 087 088 /** 089 * get the biweekly pay object codes setup in system parameters 090 * 091 * @return the biweekly pay object codes setup in system parameters 092 */ 093 public static List<String> getBiweeklyPayObjectCodes() { 094 return parameterService.getParameterValues(BudgetConstructionPayRateHolding.class, BCParameterKeyConstants.BIWEEKLY_PAY_OBJECT_CODES); 095 } 096 097 /** 098 * get the revenue object types allowed in budget setup in system parameters 099 * 100 * @return the revenue object types allowed in budget setup in system parameters 101 */ 102 public static List<String> getRevenueObjectTypes() { 103 return parameterService.getParameterValues(BudgetConstructionDocument.class, BCParameterKeyConstants.REVENUE_OBJECT_TYPES); 104 } 105 106 /** 107 * get the expenditure object types allowed in budget setup in system parameters 108 * 109 * @return the expenditure object types allowed in budget setup in system parameters 110 */ 111 public static List<String> getExpenditureObjectTypes() { 112 return parameterService.getParameterValues(BudgetConstructionDocument.class, BCParameterKeyConstants.EXPENDITURE_OBJECT_TYPES); 113 } 114 115 /** 116 * get the budget aggregation codes setup in system parameters 117 * 118 * @return the budget aggregation codes setup in system parameters 119 */ 120 public static List<String> getBudgetAggregationCodes() { 121 return parameterService.getParameterValues(BudgetConstructionDocument.class, BCParameterKeyConstants.BUDGET_AGGREGATION_CODES); 122 } 123 124 /** 125 * get the fringe benefit designator codes setup in system parameters 126 * 127 * @return the fringe benefit designator codes setup in system parameters 128 */ 129 public static List<String> getFringeBenefitDesignatorCodes() { 130 return parameterService.getParameterValues(BudgetConstructionDocument.class, BCParameterKeyConstants.FRINGE_BENEFIT_DESIGNATOR_CODES); 131 } 132 133 /** 134 * get the salary setting fund groups setup in system parameters 135 * 136 * @return the salary setting fund groups setup in system parameters 137 */ 138 public static List<String> getSalarySettingFundGroups() { 139 return parameterService.getParameterValues(BudgetConstructionDocument.class, BCParameterKeyConstants.SALARY_SETTING_FUND_GROUPS); 140 } 141 142 /** 143 * get the salary setting sub fund groups setup in system parameters 144 * 145 * @return the salary setting sub fund groups setup in system parameters 146 */ 147 public static List<String> getSalarySettingSubFundGroups() { 148 return parameterService.getParameterValues(BudgetConstructionDocument.class, BCParameterKeyConstants.SALARY_SETTING_SUB_FUND_GROUPS); 149 } 150 151 /** 152 * indicates whether the data for the budget construction intended incumbent table is populated from an external system or is 153 * maintained within the KFS. 154 */ 155 public static boolean getPayrollIncumbentFeedIndictor() { 156 return parameterService.getIndicatorParameter(BudgetConstructionIntendedIncumbent.class, BCParameterKeyConstants.EXTERNAL_INCUMBENT_FEED_IND); 157 } 158 159 /** 160 * Indicates whether the data for the budget construction position table is populated from an external system or is maintained 161 * within the KFS. 162 */ 163 public static boolean getPayrollPositionFeedIndicator() { 164 return parameterService.getIndicatorParameter(BudgetConstructionPosition.class, BCParameterKeyConstants.EXTERNAL_POSITION_FEED_IND); 165 } 166 167 /** 168 * returns the base fiscal year to use to initialize budget construction 169 */ 170 171 public static Integer getBaseFiscalYear() 172 { 173 String yearValue = parameterService.getParameterValue(GenesisBatchStep.class, BCParameterKeyConstants.SOURCE_FISCAL_YEAR); 174 return (Integer.valueOf(StringUtils.trim(yearValue))); 175 } 176 }