Search in sources :

Example 1 with CollectionIncomplete

use of org.kuali.kfs.krad.lookup.CollectionIncomplete in project cu-kfs by CU-CommunityApps.

the class CurrentFundsLookupableHelperServiceImpl method getSearchResults.

/**
 * Gets a list with the fields that will be displayed on page
 *
 * @param fieldValues list of fields that are used as a key to filter out data
 * @see org.kuali.kfs.kns.lookup.Lookupable#getSearchResults(java.util.Map)
 */
@Override
public List getSearchResults(Map fieldValues) {
    LOG.info("getSearchResults() - Entry");
    boolean unbounded = false;
    Long actualCountIfTruncated = new Long(0);
    setBackLocation((String) fieldValues.get(KFSConstants.BACK_LOCATION));
    setDocFormKey((String) fieldValues.get(KFSConstants.DOC_FORM_KEY));
    // get the pending entry option. This method must be prior to the get search results
    String pendingEntryOption = laborInquiryOptionsService.getSelectedPendingEntryOption(fieldValues);
    // get the consolidation option
    boolean isConsolidated = laborInquiryOptionsService.isConsolidationSelected(fieldValues, (Collection<Row>) getRows());
    String searchObjectCodeVal = (String) fieldValues.get(KFSPropertyConstants.FINANCIAL_OBJECT_CODE);
    // Check for a valid labor object code for this inquiry
    if (StringUtils.isNotBlank(searchObjectCodeVal)) {
        Map objectCodeFieldValues = new HashMap();
        objectCodeFieldValues.put(KFSPropertyConstants.UNIVERSITY_FISCAL_YEAR, fieldValues.get(KFSPropertyConstants.UNIVERSITY_FISCAL_YEAR));
        objectCodeFieldValues.put(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE, fieldValues.get(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE));
        objectCodeFieldValues.put(KFSPropertyConstants.FINANCIAL_OBJECT_CODE, searchObjectCodeVal);
        LaborLedgerObject foundObjectCode = (LaborLedgerObject) businessObjectService.findByPrimaryKey(LaborObject.class, objectCodeFieldValues);
        if (foundObjectCode == null) {
            GlobalVariables.getMessageMap().putError(KFSPropertyConstants.FINANCIAL_OBJECT_CODE, LaborKeyConstants.ERROR_INVALID_LABOR_OBJECT_CODE, "2");
            return new CollectionIncomplete(new ArrayList(), actualCountIfTruncated);
        }
    }
    // Parse the map and call the DAO to process the inquiry
    Collection<AccountStatusCurrentFunds> searchResultsCollection = buildCurrentFundsCollection(toList(laborDao.getCurrentFunds(fieldValues, isConsolidated)), isConsolidated, pendingEntryOption);
    // update search results according to the selected pending entry option
    laborInquiryOptionsService.updateCurrentFundsByPendingLedgerEntry(searchResultsCollection, fieldValues, pendingEntryOption, isConsolidated);
    // gets the July1st budget amount column.
    Collection<July1PositionFunding> july1PositionFundings = laborDao.getJuly1(fieldValues);
    this.updateJuly1BalanceAmount(searchResultsCollection, july1PositionFundings, isConsolidated);
    // sort list if default sort column given
    List searchResults = (List) searchResultsCollection;
    List defaultSortColumns = getDefaultSortColumns();
    if (defaultSortColumns.size() > 0) {
        Collections.sort(searchResults, new BeanPropertyComparator(defaultSortColumns, true));
    }
    return new CollectionIncomplete(searchResults, actualCountIfTruncated);
}
Also used : CollectionIncomplete(org.kuali.kfs.krad.lookup.CollectionIncomplete) AccountStatusCurrentFunds(org.kuali.kfs.module.ld.businessobject.AccountStatusCurrentFunds) HashMap(java.util.HashMap) BeanPropertyComparator(org.kuali.kfs.krad.util.BeanPropertyComparator) ArrayList(java.util.ArrayList) LaborLedgerObject(org.kuali.kfs.integration.ld.LaborLedgerObject) LaborObject(org.kuali.kfs.module.ld.businessobject.LaborObject) July1PositionFunding(org.kuali.kfs.module.ld.businessobject.July1PositionFunding) ArrayList(java.util.ArrayList) IteratorUtils.toList(org.apache.commons.collections.IteratorUtils.toList) List(java.util.List) Row(org.kuali.kfs.kns.web.ui.Row) HashMap(java.util.HashMap) Map(java.util.Map)

Example 2 with CollectionIncomplete

use of org.kuali.kfs.krad.lookup.CollectionIncomplete in project cu-kfs by CU-CommunityApps.

the class BalanceInquiryLookupAction method search.

/**
 * search - sets the values of the data entered on the form on the jsp into a map and then searches for the results.
 * <p>
 * KRAD Conversion: Lookupable performs customization of the results if
 * balance inquiry. The result rows are added to a collection
 * based on field's actual size if truncated is > 7.
 * <p>
 * Fields are in data dictionary for bo Balance.
 */
public ActionForward search(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    BalanceInquiryLookupForm lookupForm = (BalanceInquiryLookupForm) form;
    Lookupable lookupable = lookupForm.getLookupable();
    if (lookupable == null) {
        LOG.error("Lookupable is null.");
        throw new RuntimeException("Lookupable is null.");
    }
    lookupable.validateSearchParameters(lookupForm.getFields());
    if (GlobalVariables.getMessageMap().getErrorCount() > 0) {
        return mapping.findForward(KFSConstants.MAPPING_BASIC);
    }
    List<ResultRow> resultTable = new ArrayList<ResultRow>();
    boolean bounded = true;
    Collection displayList = performMultipleValueLookup(lookupForm, resultTable, getMaxRowsPerPage(lookupForm), bounded);
    CollectionIncomplete incompleteDisplayList = (CollectionIncomplete) displayList;
    Long totalSize = incompleteDisplayList.getActualSizeIfTruncated();
    if (lookupable.isSearchUsingOnlyPrimaryKeyValues()) {
        lookupForm.setSearchUsingOnlyPrimaryKeyValues(true);
        lookupForm.setPrimaryKeyFieldLabels(lookupable.getPrimaryKeyFieldLabels());
    } else {
        lookupForm.setSearchUsingOnlyPrimaryKeyValues(false);
        lookupForm.setPrimaryKeyFieldLabels(KFSConstants.EMPTY_STRING);
    }
    // TODO: use inheritance instead of this if statement
    if (lookupable.getLookupableHelperService() instanceof AccountBalanceByConsolidationLookupableHelperServiceImpl) {
        Object[] resultTableAsArray = resultTable.toArray();
        Collection totalsTable = new ArrayList();
        int arrayIndex = 0;
        try {
            for (int listIndex = 0; listIndex < incompleteDisplayList.size(); listIndex++) {
                AccountBalance balance = (AccountBalance) incompleteDisplayList.get(listIndex);
                boolean ok = ObjectHelper.isOneOf(balance.getTitle(), getTotalTitles());
                if (ok) {
                    if (totalSize > 7) {
                        totalsTable.add(resultTableAsArray[arrayIndex]);
                    }
                    resultTable.remove(resultTableAsArray[arrayIndex]);
                    incompleteDisplayList.remove(balance);
                }
                arrayIndex++;
            }
            request.setAttribute(TOTALS_TABLE_KEY, totalsTable);
            GlobalVariables.getUserSession().addObject(TOTALS_TABLE_KEY, totalsTable);
        } catch (NumberFormatException e) {
            GlobalVariables.getMessageMap().putError(KFSPropertyConstants.UNIVERSITY_FISCAL_YEAR, KFSKeyConstants.ERROR_CUSTOM, new String[] { "Fiscal Year must be a four-digit number" });
        } catch (Exception e) {
            GlobalVariables.getMessageMap().putError(KFSConstants.DOCUMENT_ERRORS, KFSKeyConstants.ERROR_CUSTOM, new String[] { "Please report the server error." });
            LOG.error("Application Errors", e);
        }
    }
    request.setAttribute(KFSConstants.REQUEST_SEARCH_RESULTS_SIZE, totalSize);
    request.setAttribute(KFSConstants.REQUEST_SEARCH_RESULTS, resultTable);
    lookupForm.setResultsActualSize((int) totalSize.longValue());
    lookupForm.setResultsLimitedSize(resultTable.size());
    if (lookupForm.isSegmented()) {
        LOG.debug("I'm segmented");
        request.setAttribute(GeneralLedgerConstants.LookupableBeanKeys.SEGMENTED_LOOKUP_FLAG_NAME, Boolean.TRUE);
    }
    if (request.getParameter(KFSConstants.SEARCH_LIST_REQUEST_KEY) != null) {
        GlobalVariables.getUserSession().removeObject(request.getParameter(KFSConstants.SEARCH_LIST_REQUEST_KEY));
        request.setAttribute(KFSConstants.SEARCH_LIST_REQUEST_KEY, GlobalVariables.getUserSession().addObjectWithGeneratedKey(resultTable));
    }
    return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
Also used : ResultRow(org.kuali.kfs.kns.web.ui.ResultRow) Lookupable(org.kuali.kfs.kns.lookup.Lookupable) CollectionIncomplete(org.kuali.kfs.krad.lookup.CollectionIncomplete) ArrayList(java.util.ArrayList) AccountBalanceByConsolidationLookupableHelperServiceImpl(org.kuali.kfs.gl.businessobject.lookup.AccountBalanceByConsolidationLookupableHelperServiceImpl) AccountBalance(org.kuali.kfs.gl.businessobject.AccountBalance) Collection(java.util.Collection) SegmentedBusinessObject(org.kuali.kfs.integration.ld.SegmentedBusinessObject)

Example 3 with CollectionIncomplete

use of org.kuali.kfs.krad.lookup.CollectionIncomplete in project cu-kfs by CU-CommunityApps.

the class CuVendorDaoOjb method getSearchResults.

public List<BusinessObject> getSearchResults(Map<String, String> fieldValues) {
    List results = new ArrayList();
    Map<String, VendorDetail> nonDupResults = new HashMap<String, VendorDetail>();
    RemovalAwareCollection rac = new RemovalAwareCollection();
    Criteria header = new Criteria();
    Criteria detail = new Criteria();
    Criteria taxNum = new Criteria();
    Criteria name = new Criteria();
    Criteria alias = new Criteria();
    Criteria active = new Criteria();
    Criteria type = new Criteria();
    Criteria state = new Criteria();
    Criteria commodityCode = new Criteria();
    Criteria supplierDiversity = new Criteria();
    Criteria vendorOwnershipCode = new Criteria();
    Criteria vendorSupplierDiversityExpirationDate = new Criteria();
    String headerVal = fieldValues.get(VendorPropertyConstants.VENDOR_HEADER_GENERATED_ID);
    String detailVal = fieldValues.get(VendorPropertyConstants.VENDOR_DETAIL_ASSIGNED_ID);
    String taxNumVal = fieldValues.get(VendorPropertyConstants.VENDOR_TAX_NUMBER);
    String activeVal = fieldValues.get(ACTIVE_INDICATOR);
    String nameVal = fieldValues.get(VendorPropertyConstants.VENDOR_NAME);
    String typeVal = fieldValues.get(VendorPropertyConstants.VENDOR_TYPE_CODE);
    String stateVal = fieldValues.get(VendorPropertyConstants.VENDOR_ADDRESS + "." + VendorPropertyConstants.VENDOR_ADDRESS_STATE);
    String supplierDiversityVal = fieldValues.get(VendorPropertyConstants.VENDOR_HEADER_PREFIX + VendorPropertyConstants.VENDOR_SUPPLIER_DIVERSITY_CODE);
    String vendorOwnershipCodeVal = fieldValues.get(VendorPropertyConstants.VENDOR_OWNERSHIP_CODE);
    String commodityCodeVal = fieldValues.get(VendorPropertyConstants.VENDOR_COMMODITIES_CODE_PURCHASING_COMMODITY_CODE);
    String vendorSupplierDiversityExpirationDateVal = fieldValues.get(VendorPropertyConstants.VENDOR_HEADER_PREFIX + VendorPropertyConstants.VENDOR_SUPPLIER_DIVERSITIES + "." + CUVendorPropertyConstants.SUPPLIER_DIVERSITY_EXPRIATION);
    // KFSPTS-1891
    String defaultPaymentMethod = fieldValues.get("extension.defaultB2BPaymentMethodCode");
    if (StringUtils.isNotBlank(headerVal)) {
        // 
        header.addEqualTo("vendorHeaderGeneratedIdentifier", headerVal);
    }
    if (StringUtils.isNotBlank(detailVal)) {
        detail.addEqualTo("vendorDetailAssignedIdentifier", detailVal);
        header.addAndCriteria(detail);
    }
    if (StringUtils.isNotBlank(taxNumVal)) {
        // THIS IS ENCRYPTED IN THE DB, COMES OFF HDR TABLE
        taxNum.addEqualTo("vendorHeader.vendorTaxNumber", taxNumVal);
        header.addAndCriteria(taxNum);
    }
    if (StringUtils.isNotBlank(activeVal)) {
        // VNDR_DTL
        active.addEqualTo(ACTIVE_INDICATOR, activeVal);
        header.addAndCriteria(active);
    }
    if (StringUtils.isNotBlank(nameVal) && nameVal.contains("*")) {
        String upperVendorName = getDbPlatform().getUpperCaseFunction() + "( vendorName )";
        String upperNameVal = nameVal.toUpperCase();
        name.addLike(upperVendorName, upperNameVal);
        alias.addLike(getDbPlatform().getUpperCaseFunction() + "( " + VendorPropertyConstants.VENDOR_ALIAS_NAME_FULL_PATH + " )", upperNameVal);
        alias.addEqualTo(VendorPropertyConstants.VENDOR_ALIAS_ACTIVE, "Y");
        Criteria t = new Criteria();
        t.addOrCriteria(name);
        t.addOrCriteria(alias);
        header.addAndCriteria(t);
    }
    if (StringUtils.isNotBlank(nameVal) && !nameVal.contains("*")) {
        name.addEqualTo(VendorPropertyConstants.VENDOR_NAME, nameVal);
        alias.addEqualTo(VendorPropertyConstants.VENDOR_ALIAS_NAME_FULL_PATH, nameVal);
        alias.addEqualTo(VendorPropertyConstants.VENDOR_ALIAS_ACTIVE, "Y");
        Criteria t = new Criteria();
        t.addOrCriteria(name);
        t.addOrCriteria(alias);
        header.addAndCriteria(t);
    }
    if (StringUtils.isNotBlank(typeVal)) {
        // VNDR_HDR
        type.addEqualTo(VendorPropertyConstants.VENDOR_TYPE_CODE, typeVal);
        header.addAndCriteria(type);
    }
    if (StringUtils.isNotBlank(stateVal)) {
        // THIS COMES OUT OF PUR_VND_ADDR_T
        state.addEqualTo(VendorPropertyConstants.VENDOR_ADDRESS_STATE_CODE, stateVal);
        header.addAndCriteria(state);
    }
    if (StringUtils.isNotBlank(commodityCodeVal)) {
        // THIS COMES OUT OF PUR_VNDR_COMM_T
        commodityCode.addEqualTo(VendorPropertyConstants.VENDOR_COMMODITIES_CODE_PURCHASING_COMMODITY_CODE, commodityCodeVal);
        header.addAndCriteria(commodityCode);
    }
    if (StringUtils.isNotBlank(supplierDiversityVal)) {
        // THIS COMES OUT OF PUR_VNDR_SUPP_DVRST_T
        supplierDiversity.addEqualTo(CUVendorPropertyConstants.VENDOR_HEADER_SUPPLIER_DIVERSITY_CODE, supplierDiversityVal);
        header.addAndCriteria(supplierDiversity);
    }
    if (StringUtils.isNotBlank(vendorOwnershipCodeVal)) {
        // VNDR_HDR
        vendorOwnershipCode.addEqualTo(VendorPropertyConstants.VENDOR_OWNERSHIP_CODE, vendorOwnershipCodeVal);
        header.addAndCriteria(vendorOwnershipCode);
    }
    if (StringUtils.isNotBlank(vendorSupplierDiversityExpirationDateVal)) {
        try {
            Date date = new java.sql.Date(new SimpleDateFormat("MM/dd/yyyy").parse(vendorSupplierDiversityExpirationDateVal).getTime());
            vendorSupplierDiversityExpirationDate.addGreaterOrEqualThan(VendorPropertyConstants.VENDOR_HEADER_PREFIX + VendorPropertyConstants.VENDOR_SUPPLIER_DIVERSITIES + "." + CUVendorPropertyConstants.SUPPLIER_DIVERSITY_EXPRIATION, date);
            header.addAndCriteria(vendorSupplierDiversityExpirationDate);
        } catch (ParseException e) {
            LOG.error("unable to parse date");
        }
    }
    // KFSPTS-1891
    if (StringUtils.isNotBlank(defaultPaymentMethod)) {
        // 
        header.addEqualTo("extension.defaultB2BPaymentMethodCode", defaultPaymentMethod);
    }
    Long val = new Long(getPersistenceBrokerTemplate().getCount(QueryFactory.newQuery(VendorDetail.class, header)));
    Integer searchResultsLimit = LookupUtils.getSearchResultsLimit(VendorDetail.class);
    if (val.intValue() > searchResultsLimit.intValue()) {
        LookupUtils.applySearchResultsLimit(VendorDetail.class, header, getDbPlatform());
    }
    QueryByCriteria qbc = new QueryByCriteria(VendorDetail.class, header);
    rac = (RemovalAwareCollection) getPersistenceBrokerTemplate().getCollectionByQuery(qbc);
    Criteria children = new Criteria();
    Iterator it = rac.iterator();
    while (it.hasNext()) {
        VendorDetail vd = (VendorDetail) it.next();
        String key = vd.getVendorNumber();
        if (!nonDupResults.containsKey(key)) {
            Criteria c = new Criteria();
            c.addEqualTo("vendorHeaderGeneratedIdentifier", vd.getVendorHeaderGeneratedIdentifier());
            children.addOrCriteria(c);
            nonDupResults.put(key, vd);
            results.add(vd);
        }
    }
    // THE CHILDREN OF ANY MATCHING VENDOR DETAIL OBJECT MUST BE FOUND AND ADDED TO THE RESULTS LIST
    if (nonDupResults.size() > 0) {
        qbc = new QueryByCriteria(VendorDetail.class, children);
        rac = (RemovalAwareCollection) getPersistenceBrokerTemplate().getCollectionByQuery(qbc);
        it = rac.iterator();
        while (it.hasNext()) {
            VendorDetail vd = (VendorDetail) it.next();
            String key = vd.getVendorNumber();
            if (!nonDupResults.containsKey(key)) {
                nonDupResults.put(key, vd);
                results.add(vd);
            }
        }
    }
    CollectionIncomplete resultsTruncated = new CollectionIncomplete((Collection) results, new Long(results.size()));
    if (val.intValue() > searchResultsLimit.intValue()) {
        resultsTruncated.setActualSizeIfTruncated(new Long(-1));
    }
    return resultsTruncated;
}
Also used : CollectionIncomplete(org.kuali.kfs.krad.lookup.CollectionIncomplete) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) QueryByCriteria(org.apache.ojb.broker.query.QueryByCriteria) Criteria(org.apache.ojb.broker.query.Criteria) Date(java.sql.Date) VendorDetail(org.kuali.kfs.vnd.businessobject.VendorDetail) QueryByCriteria(org.apache.ojb.broker.query.QueryByCriteria) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) ParseException(java.text.ParseException) SimpleDateFormat(java.text.SimpleDateFormat) RemovalAwareCollection(org.apache.ojb.broker.util.collections.RemovalAwareCollection)

Example 4 with CollectionIncomplete

use of org.kuali.kfs.krad.lookup.CollectionIncomplete in project cu-kfs by CU-CommunityApps.

the class CuAssetLookupableHelperServiceImplTest method testGetSearchResultsHelper.

public void testGetSearchResultsHelper() {
    try {
        // argument types for getSearchResultsHelper
        Class[] args_getSearchResultsHelper = new Class[2];
        args_getSearchResultsHelper[0] = Map.class;
        args_getSearchResultsHelper[1] = boolean.class;
        // values to use as method parameters for getSearchResultsHelper
        Object[] vals_getSearchResultsHelper = new Object[2];
        HashMap<String, String> hm = new HashMap<String, String>();
        hm.put("createDate", ">=01/01/2013");
        Boolean unbounded = new Boolean(false);
        Boolean bounded = new Boolean(true);
        vals_getSearchResultsHelper[0] = hm;
        vals_getSearchResultsHelper[1] = bounded;
        Method m_getSearchResultsHelper = cuAssetLookupableHelperServiceImplClass.getDeclaredMethod("getSearchResultsHelper", args_getSearchResultsHelper);
        Object result = m_getSearchResultsHelper.invoke(cuAssetLookupableHelperServiceImpl, vals_getSearchResultsHelper);
        CollectionIncomplete resultArray = (CollectionIncomplete) result;
        assertTrue("size of array should be greater than zero", 0 != resultArray.size());
        LOG.info("Array size (bounded = true): " + resultArray.size());
        vals_getSearchResultsHelper[1] = unbounded;
        result = m_getSearchResultsHelper.invoke(cuAssetLookupableHelperServiceImpl, vals_getSearchResultsHelper);
        resultArray = (CollectionIncomplete) result;
        LOG.info("Array size (bounded = false): " + resultArray.size());
        assertTrue("size of array should be greater than zero", 0 != resultArray.size());
        hm.clear();
        hm.put("createDate", ">=01/01/2014");
        vals_getSearchResultsHelper[0] = hm;
        vals_getSearchResultsHelper[1] = unbounded;
        Object unfilteredResult = m_getSearchResultsHelper.invoke(cuAssetLookupableHelperServiceImpl, vals_getSearchResultsHelper);
        CollectionIncomplete unfilteredArray = (CollectionIncomplete) unfilteredResult;
        // using this value in the search criteria results in the excludeBlankOffCampusLocations method being invoked
        hm.put("assetLocations.assetLocationTypeCode", "O");
        vals_getSearchResultsHelper[0] = hm;
        vals_getSearchResultsHelper[1] = unbounded;
        Object filteredResult = m_getSearchResultsHelper.invoke(cuAssetLookupableHelperServiceImpl, vals_getSearchResultsHelper);
        ArrayList filteredArray = (ArrayList) filteredResult;
        LOG.info("unfiltered array size: " + unfilteredArray.size());
        LOG.info("filtered array size: " + filteredArray.size());
        assertTrue("Array of results excluding blank off campus locations is smaller than the array not excluding them", filteredArray.size() < unfilteredArray.size());
    } catch (NoSuchMethodException nmse) {
        nmse.printStackTrace();
    } catch (InvocationTargetException ite) {
        ite.printStackTrace();
    } catch (IllegalAccessException iae) {
        iae.printStackTrace();
    }
}
Also used : CollectionIncomplete(org.kuali.kfs.krad.lookup.CollectionIncomplete) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Method(java.lang.reflect.Method) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 5 with CollectionIncomplete

use of org.kuali.kfs.krad.lookup.CollectionIncomplete in project cu-kfs by CU-CommunityApps.

the class CuACHPayeeLookupableHelperServiceImpl method getSearchResults.

/**
 * Overridden to only search for employee or entity payees when principal name is specified.
 *
 * @see org.kuali.kfs.pdp.businessobject.lookup.ACHPayeeLookupableHelperServiceImpl#getSearchResults(java.util.Map)
 */
@SuppressWarnings({ "deprecation", "rawtypes", "unchecked" })
@Override
public List<? extends BusinessObject> getSearchResults(Map<String, String> fieldValues) {
    /*
         * This is mostly a copy of the superclass's method, but has been tweaked to account for principal name
         * and to conform to our line formatting standards.
         */
    List<DisbursementPayee> searchResults = new ArrayList<DisbursementPayee>();
    String payeeTypeCode = fieldValues.get(KFSPropertyConstants.PAYEE_TYPE_CODE);
    if (StringUtils.isBlank(payeeTypeCode)) {
        GlobalVariables.getMessageMap().putInfo(KFSPropertyConstants.PAYEE_TYPE_CODE, PdpKeyConstants.MESSAGE_PDP_ACH_PAYEE_LOOKUP_NO_PAYEE_TYPE);
    }
    // CU Customization: Updated "else if" to restrict results to people if principal name is given.
    if (StringUtils.isNotBlank(fieldValues.get(KFSPropertyConstants.VENDOR_NUMBER)) || StringUtils.isNotBlank(fieldValues.get(KFSPropertyConstants.VENDOR_NAME)) || (StringUtils.isNotBlank(payeeTypeCode) && PdpConstants.PayeeIdTypeCodes.VENDOR_ID.equals(payeeTypeCode))) {
        searchResults.addAll(this.getVendorsAsPayees(fieldValues));
    } else if (StringUtils.isNotBlank(fieldValues.get(KIMPropertyConstants.Person.EMPLOYEE_ID)) || StringUtils.isNotBlank(fieldValues.get(KIMPropertyConstants.Person.ENTITY_ID)) || StringUtils.isNotBlank(fieldValues.get(KIMPropertyConstants.Person.PRINCIPAL_NAME)) || (StringUtils.isNotBlank(payeeTypeCode) && (PdpConstants.PayeeIdTypeCodes.EMPLOYEE.equals(payeeTypeCode) || PdpConstants.PayeeIdTypeCodes.ENTITY.equals(payeeTypeCode)))) {
        searchResults.addAll(this.getPersonAsPayees(fieldValues));
    } else {
        searchResults.addAll(this.getVendorsAsPayees(fieldValues));
        searchResults.addAll(this.getPersonAsPayees(fieldValues));
    }
    CollectionIncomplete results = new CollectionIncomplete(searchResults, Long.valueOf(searchResults.size()));
    // sort list if default sort column given
    List<String> defaultSortColumns = getDefaultSortColumns();
    if (defaultSortColumns.size() > 0) {
        Collections.sort(results, new BeanPropertyComparator(getDefaultSortColumns(), true));
    }
    return results;
}
Also used : CollectionIncomplete(org.kuali.kfs.krad.lookup.CollectionIncomplete) BeanPropertyComparator(org.kuali.kfs.krad.util.BeanPropertyComparator) ArrayList(java.util.ArrayList) DisbursementPayee(org.kuali.kfs.fp.businessobject.DisbursementPayee)

Aggregations

ArrayList (java.util.ArrayList)5 CollectionIncomplete (org.kuali.kfs.krad.lookup.CollectionIncomplete)5 HashMap (java.util.HashMap)3 List (java.util.List)2 BeanPropertyComparator (org.kuali.kfs.krad.util.BeanPropertyComparator)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Method (java.lang.reflect.Method)1 Date (java.sql.Date)1 ParseException (java.text.ParseException)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Collection (java.util.Collection)1 Iterator (java.util.Iterator)1 Map (java.util.Map)1 IteratorUtils.toList (org.apache.commons.collections.IteratorUtils.toList)1 Criteria (org.apache.ojb.broker.query.Criteria)1 QueryByCriteria (org.apache.ojb.broker.query.QueryByCriteria)1 RemovalAwareCollection (org.apache.ojb.broker.util.collections.RemovalAwareCollection)1 DisbursementPayee (org.kuali.kfs.fp.businessobject.DisbursementPayee)1 AccountBalance (org.kuali.kfs.gl.businessobject.AccountBalance)1 AccountBalanceByConsolidationLookupableHelperServiceImpl (org.kuali.kfs.gl.businessobject.lookup.AccountBalanceByConsolidationLookupableHelperServiceImpl)1