View Javadoc

1   /**
2    * Copyright 2004-2013 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.hr.lm.balancetransfer.service;
17  
18  import java.util.ArrayList;
19  import java.util.List;
20  import java.util.Map;
21  import java.util.Properties;
22  
23  import org.kuali.hr.lm.balancetransfer.BalanceTransfer;
24  import org.kuali.hr.time.HrEffectiveDateActiveLookupableHelper;
25  import org.kuali.rice.kns.lookup.HtmlData;
26  import org.kuali.rice.kns.lookup.HtmlData.AnchorHtmlData;
27  import org.kuali.rice.krad.bo.BusinessObject;
28  import org.kuali.rice.krad.util.KRADConstants;
29  import org.kuali.rice.krad.util.UrlFactory;
30  
31  public class BalanceTransferLookupableHelper extends
32  		HrEffectiveDateActiveLookupableHelper {
33  
34  	/**
35  	 * 
36  	 */
37  	private static final long serialVersionUID = -6910172165048825489L;
38  
39  	@SuppressWarnings("deprecation")
40  	@Override
41  	public List<HtmlData> getCustomActionUrls(BusinessObject businessObject, List pkNames) {
42  		List<HtmlData> customActionUrls = super.getCustomActionUrls(businessObject, pkNames);
43  		
44  		List<HtmlData> copyOfUrls = new ArrayList<HtmlData>();
45  		copyOfUrls.addAll(customActionUrls);
46  		for(HtmlData aData : copyOfUrls) {
47  			if(aData.getMethodToCall().equals(KRADConstants.MAINTENANCE_EDIT_METHOD_TO_CALL)) {
48  				customActionUrls.remove(aData);
49  			}
50  		}
51  		BalanceTransfer bt = (BalanceTransfer) businessObject;
52  		String btId = bt.getBalanceTransferId();
53  		
54  		Properties params = new Properties();
55  		params.put(KRADConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, getBusinessObjectClass().getName());
56  		params.put(KRADConstants.DISPATCH_REQUEST_PARAMETER, KRADConstants.MAINTENANCE_NEW_METHOD_TO_CALL);
57  		params.put("balanceTransferId", btId);
58  		AnchorHtmlData viewUrl = new AnchorHtmlData(UrlFactory.parameterizeUrl(KRADConstants.INQUIRY_ACTION, params), "view");
59  		viewUrl.setDisplayText("view");
60  		viewUrl.setTarget(AnchorHtmlData.TARGET_BLANK);
61  		customActionUrls.add(viewUrl);
62  		
63  		return customActionUrls;
64  	}
65  
66  	@Override
67  	public List<? extends BusinessObject> getSearchResults(
68  			Map<String, String> fieldValues) {
69  		// TODO Auto-generated method stub
70  		return super.getSearchResults(fieldValues);
71  	}
72  
73  }