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.endow.businessobject.lookup; 017 018 import java.util.ArrayList; 019 import java.util.HashMap; 020 import java.util.List; 021 import java.util.Map; 022 023 import org.kuali.kfs.module.endow.EndowPropertyConstants; 024 import org.kuali.kfs.module.endow.businessobject.CurrentTaxLotBalance; 025 import org.kuali.kfs.module.endow.businessobject.HoldingTaxLot; 026 import org.kuali.kfs.sys.context.SpringContext; 027 import org.kuali.rice.kns.bo.BusinessObject; 028 import org.kuali.rice.kns.lookup.HtmlData; 029 import org.kuali.rice.kns.lookup.KualiLookupableHelperServiceImpl; 030 import org.kuali.rice.kns.service.BusinessObjectService; 031 import org.kuali.rice.kns.util.KNSConstants; 032 import org.kuali.rice.kns.util.ObjectUtils; 033 034 public class CurrentTaxLotBalanceLookupableHelperService extends KualiLookupableHelperServiceImpl { 035 036 /** 037 * @see org.kuali.rice.kns.lookup.AbstractLookupableHelperServiceImpl#getCustomActionUrls(org.kuali.rice.kns.bo.BusinessObject, 038 * java.util.List) 039 */ 040 @Override 041 public List<HtmlData> getCustomActionUrls(BusinessObject businessObject, List pkNames) { 042 043 List<HtmlData> anchorHtmlDataList = new ArrayList<HtmlData>(); 044 CurrentTaxLotBalance currentTaxLotBalance = (CurrentTaxLotBalance) businessObject; 045 BusinessObjectService businessObjectService = SpringContext.getBean(BusinessObjectService.class); 046 047 Map primaryKeys = new HashMap(); 048 primaryKeys.put(EndowPropertyConstants.KEMID, currentTaxLotBalance.getKemid()); 049 primaryKeys.put(EndowPropertyConstants.HOLDING_TAX_LOT_SECURITY_ID, currentTaxLotBalance.getSecurityId()); 050 primaryKeys.put(EndowPropertyConstants.HOLDING_TAX_LOT_REGISTRATION_CODE, currentTaxLotBalance.getRegistrationCode()); 051 primaryKeys.put(EndowPropertyConstants.HOLDING_TAX_LOT_NUMBER, currentTaxLotBalance.getLotNumber()); 052 primaryKeys.put(EndowPropertyConstants.HOLDING_TAX_LOT_INCOME_PRINCIPAL_INDICATOR, currentTaxLotBalance.getIncomePrincipalIndicator()); 053 054 HoldingTaxLot holdingTaxLot = (HoldingTaxLot) businessObjectService.findByPrimaryKey(HoldingTaxLot.class, primaryKeys); 055 056 if (ObjectUtils.isNotNull(holdingTaxLot)) { 057 anchorHtmlDataList.add(getUrlData(holdingTaxLot, KNSConstants.MAINTENANCE_EDIT_METHOD_TO_CALL, pkNames)); 058 } 059 return anchorHtmlDataList; 060 } 061 062 /** 063 * @see org.kuali.rice.kns.lookup.AbstractLookupableHelperServiceImpl#allowsMaintenanceNewOrCopyAction() 064 */ 065 @Override 066 public boolean allowsMaintenanceNewOrCopyAction() { 067 068 return false; 069 } 070 071 }