Search in sources :

Example 1 with AccountStatusCurrentFunds

use of org.kuali.kfs.module.ld.businessobject.AccountStatusCurrentFunds 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 AccountStatusCurrentFunds

use of org.kuali.kfs.module.ld.businessobject.AccountStatusCurrentFunds in project cu-kfs by CU-CommunityApps.

the class CurrentFundsLookupableHelperServiceImpl method buildCosolidatedCurrentFundsCollection.

/**
 * Builds the current funds collection with consolidation option from an iterator
 *
 * @param iterator
 * @param pendingEntryOption the selected pending entry option
 * @return the consolidated current funds collection
 */
private Collection<AccountStatusCurrentFunds> buildCosolidatedCurrentFundsCollection(Collection collection, String pendingEntryOption) {
    Collection<AccountStatusCurrentFunds> retval = new ArrayList<AccountStatusCurrentFunds>();
    for (Object collectionEntry : collection) {
        if (collectionEntry.getClass().isArray()) {
            int i = 0;
            Object[] array = (Object[]) collectionEntry;
            AccountStatusCurrentFunds cf = new AccountStatusCurrentFunds();
            LOG.debug("element length " + array.length);
            for (Object element : array) {
                LOG.debug("I found this element " + element);
            }
            if (AccountStatusCurrentFunds.class.isAssignableFrom(getBusinessObjectClass())) {
                try {
                    cf = (AccountStatusCurrentFunds) getBusinessObjectClass().newInstance();
                } catch (Exception e) {
                    LOG.warn("Using " + AccountStatusCurrentFunds.class + " for results because I couldn't instantiate the " + getBusinessObjectClass());
                }
            } else {
                LOG.warn("Using " + AccountStatusCurrentFunds.class + " for results because I couldn't instantiate the " + getBusinessObjectClass());
            }
            cf.setUniversityFiscalYear(new Integer(array[i++].toString()));
            cf.setChartOfAccountsCode(array[i++].toString());
            cf.setAccountNumber(array[i++].toString());
            String subAccountNumber = Constant.CONSOLIDATED_SUB_ACCOUNT_NUMBER;
            cf.setSubAccountNumber(subAccountNumber);
            cf.setBalanceTypeCode(array[i++].toString());
            cf.setFinancialObjectCode(array[i++].toString());
            cf.setEmplid(array[i++].toString());
            cf.setPositionNumber(array[i++].toString());
            cf.setFinancialSubObjectCode(Constant.CONSOLIDATED_SUB_OBJECT_CODE);
            cf.setObjectTypeCode(Constant.CONSOLIDATED_OBJECT_TYPE_CODE);
            cf.setAccountLineAnnualBalanceAmount(new KualiDecimal(array[i++].toString()));
            cf.setBeginningBalanceLineAmount(new KualiDecimal(array[i++].toString()));
            cf.setContractsGrantsBeginningBalanceAmount(new KualiDecimal(array[i++].toString()));
            cf.setMonth1Amount(new KualiDecimal(array[i++].toString()));
            cf.setDummyBusinessObject(new TransientBalanceInquiryAttributes());
            cf.getDummyBusinessObject().setPendingEntryOption(pendingEntryOption);
            cf.setOutstandingEncum(getOutstandingEncum(cf));
            cf.getDummyBusinessObject().setPendingEntryOption(pendingEntryOption);
            cf.getDummyBusinessObject().setConsolidationOption(Constant.CONSOLIDATION);
            retval.add(cf);
        }
    }
    return retval;
}
Also used : AccountStatusCurrentFunds(org.kuali.kfs.module.ld.businessobject.AccountStatusCurrentFunds) TransientBalanceInquiryAttributes(org.kuali.kfs.gl.businessobject.TransientBalanceInquiryAttributes) ArrayList(java.util.ArrayList) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) BusinessObject(org.kuali.rice.krad.bo.BusinessObject) LaborLedgerObject(org.kuali.kfs.integration.ld.LaborLedgerObject) LaborObject(org.kuali.kfs.module.ld.businessobject.LaborObject)

Example 3 with AccountStatusCurrentFunds

use of org.kuali.kfs.module.ld.businessobject.AccountStatusCurrentFunds in project cu-kfs by CU-CommunityApps.

the class CurrentFundsLookupableHelperServiceImpl method buildDetailedCurrentFundsCollection.

/**
 * Builds the current funds collection with detail option from an iterator
 *
 * @param iterator the current funds iterator
 * @param pendingEntryOption the selected pending entry option
 * @return the detailed balance collection
 */
private Collection<AccountStatusCurrentFunds> buildDetailedCurrentFundsCollection(Collection collection, String pendingEntryOption) {
    Collection<AccountStatusCurrentFunds> retval = new ArrayList<AccountStatusCurrentFunds>();
    for (LedgerBalance balance : ((Collection<LedgerBalance>) collection)) {
        AccountStatusCurrentFunds cf = new AccountStatusCurrentFunds();
        ObjectUtil.buildObject(cf, balance);
        cf.setDummyBusinessObject(new TransientBalanceInquiryAttributes());
        cf.getDummyBusinessObject().setPendingEntryOption(pendingEntryOption);
        cf.setOutstandingEncum(getOutstandingEncum(cf));
        cf.getDummyBusinessObject().setPendingEntryOption(pendingEntryOption);
        cf.getDummyBusinessObject().setConsolidationOption(Constant.DETAIL);
        retval.add(cf);
    }
    return retval;
}
Also used : AccountStatusCurrentFunds(org.kuali.kfs.module.ld.businessobject.AccountStatusCurrentFunds) TransientBalanceInquiryAttributes(org.kuali.kfs.gl.businessobject.TransientBalanceInquiryAttributes) LedgerBalance(org.kuali.kfs.module.ld.businessobject.LedgerBalance) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)3 AccountStatusCurrentFunds (org.kuali.kfs.module.ld.businessobject.AccountStatusCurrentFunds)3 TransientBalanceInquiryAttributes (org.kuali.kfs.gl.businessobject.TransientBalanceInquiryAttributes)2 LaborLedgerObject (org.kuali.kfs.integration.ld.LaborLedgerObject)2 LaborObject (org.kuali.kfs.module.ld.businessobject.LaborObject)2 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 IteratorUtils.toList (org.apache.commons.collections.IteratorUtils.toList)1 Row (org.kuali.kfs.kns.web.ui.Row)1 CollectionIncomplete (org.kuali.kfs.krad.lookup.CollectionIncomplete)1 BeanPropertyComparator (org.kuali.kfs.krad.util.BeanPropertyComparator)1 July1PositionFunding (org.kuali.kfs.module.ld.businessobject.July1PositionFunding)1 LedgerBalance (org.kuali.kfs.module.ld.businessobject.LedgerBalance)1 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)1 BusinessObject (org.kuali.rice.krad.bo.BusinessObject)1