Search in sources :

Example 6 with DisbursementPayee

use of org.kuali.kfs.fp.businessobject.DisbursementPayee 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

DisbursementPayee (org.kuali.kfs.fp.businessobject.DisbursementPayee)6 CuDisbursementPayee (edu.cornell.kfs.fp.businessobject.CuDisbursementPayee)5 ArrayList (java.util.ArrayList)3 Person (org.kuali.rice.kim.api.identity.Person)2 CuDisbursementVoucherDocument (edu.cornell.kfs.fp.document.CuDisbursementVoucherDocument)1 CuDisbursementVoucherPayeeService (edu.cornell.kfs.fp.document.service.CuDisbursementVoucherPayeeService)1 List (java.util.List)1 ParameterService (org.kuali.kfs.coreservice.framework.parameter.ParameterService)1 CollectionIncomplete (org.kuali.kfs.krad.lookup.CollectionIncomplete)1 BeanPropertyComparator (org.kuali.kfs.krad.util.BeanPropertyComparator)1 VendorDetail (org.kuali.kfs.vnd.businessobject.VendorDetail)1 PersonService (org.kuali.rice.kim.api.identity.PersonService)1 EntityAffiliationContract (org.kuali.rice.kim.api.identity.affiliation.EntityAffiliationContract)1 PersonImpl (org.kuali.rice.kim.impl.identity.PersonImpl)1 BusinessObject (org.kuali.rice.krad.bo.BusinessObject)1