use of org.kuali.kfs.module.ld.businessobject.July1PositionFunding 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);
}
Aggregations