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.businessobject.lookup;
017    
018    import java.util.ArrayList;
019    import java.util.List;
020    import java.util.Properties;
021    
022    import org.kuali.kfs.module.bc.BCConstants;
023    import org.kuali.kfs.module.bc.BCPropertyConstants;
024    import org.kuali.kfs.module.bc.businessobject.BudgetConstructionIntendedIncumbentSelect;
025    import org.kuali.kfs.sys.KFSConstants;
026    import org.kuali.kfs.sys.KFSPropertyConstants;
027    import org.kuali.rice.kns.bo.BusinessObject;
028    import org.kuali.rice.kns.lookup.HtmlData;
029    import org.kuali.rice.kns.lookup.HtmlData.AnchorHtmlData;
030    import org.kuali.rice.kns.util.UrlFactory;
031    
032    /**
033     * Lookupable helper service implementation for the intended incumbent select screen.
034     */
035    public class IntendedIncumbentSelectLookupableHelperServiceImpl extends SelectLookupableHelperServiceImpl {
036    
037        /**
038         * @see org.kuali.rice.kns.lookup.LookupableHelperService#getCustomActionUrls(org.kuali.rice.kns.bo.BusinessObject, java.util.List, java.util.List pkNames)
039         */
040        @Override
041        public List<HtmlData> getCustomActionUrls(BusinessObject businessObject, List pkNames) {
042            BudgetConstructionIntendedIncumbentSelect intendedIncumbentSelect = (BudgetConstructionIntendedIncumbentSelect) businessObject;
043    
044            Properties parameters = new Properties();
045            parameters.put(KFSConstants.DISPATCH_REQUEST_PARAMETER, BCConstants.INCUMBENT_SALARY_SETTING_METHOD);
046    
047            String[] universityFiscalYear = (String[]) super.getParameters().get(KFSPropertyConstants.UNIVERSITY_FISCAL_YEAR);
048            parameters.put(KFSPropertyConstants.UNIVERSITY_FISCAL_YEAR, universityFiscalYear[0]);
049    
050            parameters.put(KFSPropertyConstants.EMPLID, intendedIncumbentSelect.getEmplid());
051            parameters.put(BCPropertyConstants.SINGLE_ACCOUNT_MODE, "false");
052            parameters.put(BCPropertyConstants.ADD_LINE, "false");
053    
054            String href = UrlFactory.parameterizeUrl(BCConstants.INCUMBENT_SALARY_SETTING_ACTION, parameters);
055            List<HtmlData> anchorHtmlDataList = new ArrayList<HtmlData>();
056            AnchorHtmlData anchorHtmlData = new AnchorHtmlData(href, BCConstants.INCUMBENT_SALARY_SETTING_METHOD, "Incmbnt Salset");
057            anchorHtmlData.setTarget(KFSConstants.NEW_WINDOW_URL_TARGET);
058            anchorHtmlDataList.add(anchorHtmlData);
059            
060            return anchorHtmlDataList;
061        }
062    
063    }