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.BudgetConstructionPositionSelect;
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 position select screen.
034     */
035    public class PositionSelectLookupableHelperServiceImpl 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            BudgetConstructionPositionSelect positionSelect = (BudgetConstructionPositionSelect) businessObject;
043    
044            Properties parameters = new Properties();
045            parameters.put(KFSConstants.DISPATCH_REQUEST_PARAMETER, BCConstants.POSITION_SALARY_SETTING_METHOD);
046    
047            parameters.put(KFSPropertyConstants.UNIVERSITY_FISCAL_YEAR, positionSelect.getUniversityFiscalYear().toString());
048            parameters.put(BCPropertyConstants.POSITION_NUMBER, positionSelect.getPositionNumber());
049            parameters.put(BCPropertyConstants.SINGLE_ACCOUNT_MODE, "false");
050            parameters.put(BCPropertyConstants.ADD_LINE, "false");
051    
052            String href = UrlFactory.parameterizeUrl(BCConstants.POSITION_SALARY_SETTING_ACTION, parameters);
053            List<HtmlData> anchorHtmlDataList = new ArrayList<HtmlData>();
054            AnchorHtmlData anchorHtmlData = new AnchorHtmlData(href, BCConstants.POSITION_SALARY_SETTING_METHOD, "Posn Salset");
055            anchorHtmlData.setTarget(KFSConstants.NEW_WINDOW_URL_TARGET);
056            anchorHtmlDataList.add(anchorHtmlData);
057            
058            return anchorHtmlDataList;
059        }
060    }