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.ar.businessobject.lookup;
017
018 import java.util.ArrayList;
019 import java.util.List;
020
021 import org.apache.commons.lang.StringUtils;
022 import org.kuali.kfs.module.ar.ArKeyConstants;
023 import org.kuali.kfs.module.ar.businessobject.Customer;
024 import org.kuali.kfs.sys.KFSConstants;
025 import org.kuali.rice.kns.bo.BusinessObject;
026 import org.kuali.rice.kns.lookup.HtmlData;
027 import org.kuali.rice.kns.lookup.KualiLookupableHelperServiceImpl;
028 import org.kuali.rice.kns.lookup.HtmlData.AnchorHtmlData;
029 import org.kuali.rice.kns.util.KNSConstants;
030
031 public class CustomerLookupableHelperServiceImpl extends KualiLookupableHelperServiceImpl {
032
033 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(CustomerLookupableHelperServiceImpl.class);
034
035 /***
036 * This method was overridden to remove the COPY link from the actions and to add in the REPORT link.
037 *
038 * @see org.kuali.rice.kns.lookup.AbstractLookupableHelperServiceImpl#getCustomActionUrls(org.kuali.rice.kns.bo.BusinessObject, java.util.List)
039 */
040 @Override
041 public List<HtmlData> getCustomActionUrls(BusinessObject businessObject, List pkNames){
042 List<HtmlData> htmlDataList = new ArrayList<HtmlData>();
043 if (StringUtils.isNotBlank(getMaintenanceDocumentTypeName()) && allowsMaintenanceEditAction(businessObject)) {
044 htmlDataList.add(getUrlData(businessObject, KNSConstants.MAINTENANCE_EDIT_METHOD_TO_CALL, pkNames));
045 }
046 htmlDataList.add(getCustomerOpenItemReportUrl(businessObject));
047 return htmlDataList;
048 }
049
050 /**
051 *
052 * This method...
053 * @param bo
054 * @return
055 */
056 private AnchorHtmlData getCustomerOpenItemReportUrl(BusinessObject bo) {
057 Customer customer = (Customer) bo;
058 String href="../arCustomerOpenItemReportLookup.do" +
059 "?businessObjectClassName=org.kuali.kfs.module.ar.businessobject.CustomerOpenItemReportDetail" +
060 "&returnLocation=&lookupableImplementaionServiceName=arCustomerOpenItemReportLookupable" +
061 "&methodToCall=search&customerNumber="+customer.getCustomerNumber()+
062 "&reportName=" + KFSConstants.CustomerOpenItemReport.HISTORY_REPORT_NAME +
063 "&customerName=" +customer.getCustomerName()+
064 "&reportName=Customer History Report&docFormKey=88888888";
065 return new AnchorHtmlData(href, KFSConstants.SEARCH_METHOD, ArKeyConstants.CustomerConstants.ACTIONS_REPORT);
066 }
067 }
068