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.ec.util;
017    
018    import java.util.ArrayList;
019    import java.util.List;
020    
021    import org.kuali.kfs.module.ec.EffortConstants.SystemParameters;
022    import org.kuali.kfs.module.ec.batch.EffortCertificationCreateStep;
023    import org.kuali.kfs.module.ec.batch.EffortCertificationExtractStep;
024    import org.kuali.kfs.module.ec.document.EffortCertificationDocument;
025    import org.kuali.kfs.sys.context.SpringContext;
026    import org.kuali.rice.kns.service.ParameterService;
027    
028    /**
029     * A convenient utility that can delegate the calling client to retrieve system parameters of effort certification module.
030     */
031    public class EffortCertificationParameterFinder {
032        private static ParameterService parameterService = SpringContext.getBean(ParameterService.class);
033    
034        /**
035         * get the run indicator setup in system paremters
036         * 
037         * @return the run indicator setup in system paremters
038         */
039        public static boolean getRunIndicator() {
040            return parameterService.getIndicatorParameter(EffortCertificationExtractStep.class, SystemParameters.RUN_IND);
041        }
042    
043        /**
044         * get the federal agency type codes setup in system parameters
045         * 
046         * @return the federal agency type codes setup in system parameters
047         */
048        public static List<String> getFederalAgencyTypeCodes() {
049            return parameterService.getParameterValues(EffortCertificationExtractStep.class, SystemParameters.FEDERAL_AGENCY_TYPE_CODE);
050        }
051    
052        /**
053         * get the federal only balance indicator
054         * 
055         * @return the federal only balance indicator
056         */
057        public static boolean getFederalOnlyBalanceIndicator() {
058            return parameterService.getIndicatorParameter(EffortCertificationExtractStep.class, SystemParameters.FEDERAL_ONLY_BALANCE_IND);
059        }
060        
061        /**
062         * get the federal only route indicator
063         * 
064         * @return the federal only balance indicator
065         */
066        public static boolean getFederalOnlyRouteIndicator() {
067            return parameterService.getIndicatorParameter(EffortCertificationDocument.class, SystemParameters.FEDERAL_ONLY_ROUTE_IND);
068        }
069    
070        /**
071         * get the fedeal only balance indicatior
072         * 
073         * @return the fedeal only balance indicatior
074         */
075        public static List<String> getFederalOnlyBalanceIndicatorAsString() {
076            List<String> indicatorList = new ArrayList<String>();
077            indicatorList.add(Boolean.toString(getFederalOnlyBalanceIndicator()));
078            return indicatorList;
079        }
080    
081        /**
082         * get the account type codes setup in system parameters
083         * 
084         * @return the account type codes setup in system parameters
085         */
086        public static List<String> getAccountTypeCodes() {
087            return parameterService.getParameterValues(EffortCertificationExtractStep.class, SystemParameters.ACCOUNT_TYPE_CODE_BALANCE_SELECT);
088        }
089    
090        /**
091         * get the report fiscal year setup in system paremters for extract process
092         * 
093         * @return the report fiscal year setup in system paremters
094         */
095        public static Integer getExtractReportFiscalYear() {
096            return Integer.valueOf(parameterService.getParameterValue(EffortCertificationExtractStep.class, SystemParameters.RUN_FISCAL_YEAR));
097        }
098    
099        /**
100         * get the report number setup in system paremters for extract process
101         * 
102         * @return the report number setup in system paremters
103         */
104        public static String getExtractReportNumber() {
105            return parameterService.getParameterValue(EffortCertificationExtractStep.class, SystemParameters.RUN_REPORT_NUMBER);
106        }
107    
108        /**
109         * get the report fiscal year setup in system paremters for create process
110         * 
111         * @return the report fiscal year setup in system paremters
112         */
113        public static Integer getCreateReportFiscalYear() {
114            return Integer.valueOf(parameterService.getParameterValue(EffortCertificationCreateStep.class, SystemParameters.CREATE_FISCAL_YEAR));
115        }
116    
117        /**
118         * get the report number setup in system paremters for create process
119         * 
120         * @return the report number setup in system paremters
121         */
122        public static String getCreateReportNumber() {
123            return parameterService.getParameterValue(EffortCertificationCreateStep.class, SystemParameters.CREATE_REPORT_NUMBER);
124        }
125    }