001 /** 002 * Copyright 2004-2013 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.hr.lm.leavepayout.service; 017 018 019 import java.util.ArrayList; 020 import java.util.List; 021 import java.util.Map; 022 import java.util.Properties; 023 024 import org.kuali.hr.lm.balancetransfer.BalanceTransfer; 025 import org.kuali.hr.lm.leavepayout.LeavePayout; 026 import org.kuali.hr.time.HrEffectiveDateActiveLookupableHelper; 027 import org.kuali.rice.kns.lookup.HtmlData; 028 import org.kuali.rice.kns.lookup.HtmlData.AnchorHtmlData; 029 import org.kuali.rice.krad.bo.BusinessObject; 030 import org.kuali.rice.krad.util.KRADConstants; 031 import org.kuali.rice.krad.util.UrlFactory; 032 033 public class LeavePayoutLookupableHelper extends 034 HrEffectiveDateActiveLookupableHelper { 035 036 private static final long serialVersionUID = 1L; 037 038 @SuppressWarnings("deprecation") 039 @Override 040 public List<HtmlData> getCustomActionUrls(BusinessObject businessObject, 041 List pkNames) { 042 List<HtmlData> customActionUrls = super.getCustomActionUrls(businessObject, pkNames); 043 044 List<HtmlData> copyOfUrls = new ArrayList<HtmlData>(); 045 copyOfUrls.addAll(customActionUrls); 046 for(HtmlData aData : copyOfUrls) { 047 if(aData.getMethodToCall().equals(KRADConstants.MAINTENANCE_EDIT_METHOD_TO_CALL)) { 048 customActionUrls.remove(aData); 049 } 050 } 051 LeavePayout lp = (LeavePayout) businessObject; 052 String lpId = lp.getLmLeavePayoutId(); 053 054 Properties params = new Properties(); 055 params.put(KRADConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, getBusinessObjectClass().getName()); 056 params.put(KRADConstants.DISPATCH_REQUEST_PARAMETER, KRADConstants.MAINTENANCE_NEW_METHOD_TO_CALL); 057 params.put("lmLeavePayoutId", lpId); 058 AnchorHtmlData viewUrl = new AnchorHtmlData(UrlFactory.parameterizeUrl(KRADConstants.INQUIRY_ACTION, params), "view"); 059 viewUrl.setDisplayText("view"); 060 viewUrl.setTarget(AnchorHtmlData.TARGET_BLANK); 061 customActionUrls.add(viewUrl); 062 063 return customActionUrls; 064 } 065 066 @Override 067 public List<? extends BusinessObject> getSearchResults( 068 Map<String, String> fieldValues) { 069 // TODO Auto-generated method stub 070 return super.getSearchResults(fieldValues); 071 } 072 073 }