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.leavepayout.service;
17  
18  
19  import java.util.ArrayList;
20  import java.util.List;
21  import java.util.Map;
22  import java.util.Properties;
23  
24  import org.kuali.hr.lm.balancetransfer.BalanceTransfer;
25  import org.kuali.hr.lm.leavepayout.LeavePayout;
26  import org.kuali.hr.time.HrEffectiveDateActiveLookupableHelper;
27  import org.kuali.rice.kns.lookup.HtmlData;
28  import org.kuali.rice.kns.lookup.HtmlData.AnchorHtmlData;
29  import org.kuali.rice.krad.bo.BusinessObject;
30  import org.kuali.rice.krad.util.KRADConstants;
31  import org.kuali.rice.krad.util.UrlFactory;
32  
33  public class LeavePayoutLookupableHelper extends
34          HrEffectiveDateActiveLookupableHelper {
35  
36      private static final long serialVersionUID = 1L;
37  
38      @SuppressWarnings("deprecation")
39      @Override
40      public List<HtmlData> getCustomActionUrls(BusinessObject businessObject,
41                                                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  		LeavePayout lp = (LeavePayout) businessObject;
52  		String lpId = lp.getLmLeavePayoutId();
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("lmLeavePayoutId", lpId);
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  }