@SuppressWarnings("unchecked") public List<HtmlData> getCustomActionUrls(BusinessObject businessObject, List pkNames) { List<HtmlData> htmlDataList = new ArrayList<HtmlData>(); htmlDataList = super.getCustomActionUrls(businessObject, pkNames); List<HtmlData> returnHtmlDataList = new ArrayList<HtmlData>(); for (HtmlData htmlData : htmlDataList) { if (!(htmlData.getDisplayText().equals("copy") || htmlData.getDisplayText().equals("edit"))) { returnHtmlDataList.add(htmlData); } } return returnHtmlDataList; }
protected void removeEditLink(List<HtmlData> htmlDataList) { int editLinkIndex = -1; int currentIndex = 0; for (HtmlData htmlData : htmlDataList) { if (KRADConstants.MAINTENANCE_EDIT_METHOD_TO_CALL.equals(htmlData.getMethodToCall())) { editLinkIndex = currentIndex; break; } currentIndex++; } if (editLinkIndex != -1) { htmlDataList.remove(editLinkIndex); } }
/** * This method performs the lookup and returns a collection of lookup items * * @param lookupForm * @param kualiLookupable * @param resultTable * @param bounded * @return */ @Override public Collection performLookup(LookupForm lookupForm, Collection resultTable, boolean bounded) { Collection<BusinessObject> displayList; // Call search method to get results - always use unbounded to get the entire set of results. displayList = (Collection<BusinessObject>) getSearchResultsUnbounded(lookupForm.getFieldsForLookup()); List pkNames = getBusinessObjectMetaDataService().listPrimaryKeyFieldNames(getBusinessObjectClass()); List returnKeys = getReturnKeys(); Person user = GlobalVariables.getUserSession().getPerson(); // Iterate through result list and wrap rows with return url and action urls for (BusinessObject element : displayList) { LOG.debug("Doing lookup for " + element.getClass()); ReferralToCollectionsLookupResult result = ((ReferralToCollectionsLookupResult) element); List<String> invoiceAttributesForDisplay = result.getInvoiceAttributesForDisplay(); BusinessObjectRestrictions businessObjectRestrictions = getBusinessObjectAuthorizationService().getLookupResultRestrictions(result, user); // add list of awards to sub Result rows List<ResultRow> subResultRows = new ArrayList<ResultRow>(); for (ContractsGrantsInvoiceDocument invoice : result.getInvoices()) { List<Column> subResultColumns = new ArrayList<Column>(); InvoiceAccountDetail firstInvoiceAccountDetail = new InvoiceAccountDetail(); // Set first invoice account detail if (CollectionUtils.isNotEmpty(invoice.getAccountDetails())) { firstInvoiceAccountDetail = invoice.getAccountDetails().get(0); } for (String propertyName : invoiceAttributesForDisplay) { if (propertyName.equalsIgnoreCase(KFSPropertyConstants.ACCOUNT_NUMBER)) { Account account = SpringContext.getBean(AccountService.class) .getByPrimaryId( firstInvoiceAccountDetail.getChartOfAccountsCode(), firstInvoiceAccountDetail.getAccountNumber()); subResultColumns.add( setupResultsColumn(account, propertyName, businessObjectRestrictions)); } else { subResultColumns.add( setupResultsColumn(invoice, propertyName, businessObjectRestrictions)); } } ResultRow subResultRow = new ResultRow(subResultColumns, "", ""); subResultRow.setObjectId(((PersistableBusinessObjectBase) invoice).getObjectId()); subResultRows.add(subResultRow); } // Create main customer header row Collection<Column> columns = getColumns(element, businessObjectRestrictions); HtmlData returnUrl = getReturnUrl(element, lookupForm, returnKeys, businessObjectRestrictions); ReferralToCollectionsResultRow row = new ReferralToCollectionsResultRow( (List<Column>) columns, subResultRows, returnUrl.constructCompleteHtmlTag(), getActionUrls(element, pkNames, businessObjectRestrictions)); resultTable.add(row); } return displayList; }