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.BudgetConstructionAccountSelect; 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 account selection screens. 034 */ 035 public class AccountSelectLookupableHelperServiceImpl 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 BudgetConstructionAccountSelect accountSelect = (BudgetConstructionAccountSelect) businessObject; 043 044 Properties parameters = new Properties(); 045 parameters.put(KFSConstants.DISPATCH_REQUEST_PARAMETER, BCConstants.BC_DOCUMENT_METHOD); 046 047 parameters.put(KFSPropertyConstants.UNIVERSITY_FISCAL_YEAR, accountSelect.getUniversityFiscalYear().toString()); 048 parameters.put(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE, accountSelect.getChartOfAccountsCode()); 049 parameters.put(KFSPropertyConstants.ACCOUNT_NUMBER, accountSelect.getAccountNumber()); 050 parameters.put(KFSPropertyConstants.SUB_ACCOUNT_NUMBER, accountSelect.getSubAccountNumber()); 051 parameters.put(BCConstants.PICK_LIST_MODE, "true"); 052 parameters.put(BCPropertyConstants.MAIN_WINDOW, "false"); 053 054 String href = UrlFactory.parameterizeUrl(BCConstants.BC_DOCUMENT_ACTION, parameters); 055 List<HtmlData> anchorHtmlDataList = new ArrayList<HtmlData>(); 056 AnchorHtmlData anchorHtmlData = new AnchorHtmlData(href, BCConstants.BC_DOCUMENT_METHOD, "Load Document"); 057 anchorHtmlData.setTarget(KFSConstants.NEW_WINDOW_URL_TARGET); 058 anchorHtmlDataList.add(anchorHtmlData); 059 return anchorHtmlDataList; 060 } 061 062 }