Search in sources :

Example 11 with BusinessObject

use of org.kuali.rice.krad.bo.BusinessObject in project cu-kfs by CU-CommunityApps.

the class July1PositionFundingLookupableHelperServiceImpl method getInquiryUrl.

/**
 * @see org.kuali.kfs.kns.lookup.Lookupable#getInquiryUrl(org.kuali.kfs.kns.bo.BusinessObject, java.lang.String)
 */
@Override
public HtmlData getInquiryUrl(BusinessObject bo, String propertyName) {
    if (KFSPropertyConstants.POSITION_NUMBER.equals(propertyName)) {
        LedgerBalance balance = (LedgerBalance) bo;
        AbstractPositionDataDetailsInquirableImpl positionDataDetailsInquirable = new PositionDataDetailsInquirableImpl();
        Map<String, String> fieldValues = new HashMap<String, String>();
        fieldValues.put(propertyName, balance.getPositionNumber());
        BusinessObject positionData = positionDataDetailsInquirable.getBusinessObject(fieldValues);
        return positionData == null ? new AnchorHtmlData(KFSConstants.EMPTY_STRING, KFSConstants.EMPTY_STRING) : positionDataDetailsInquirable.getInquiryUrl(positionData, propertyName);
    }
    return (new July1PositionFundingInquirableImpl()).getInquiryUrl(bo, propertyName);
}
Also used : AbstractPositionDataDetailsInquirableImpl(org.kuali.kfs.integration.ld.businessobject.inquiry.AbstractPositionDataDetailsInquirableImpl) HashMap(java.util.HashMap) LedgerBalance(org.kuali.kfs.module.ld.businessobject.LedgerBalance) July1PositionFundingInquirableImpl(com.rsmart.kuali.kfs.module.ld.businessobject.inquiry.July1PositionFundingInquirableImpl) BusinessObject(org.kuali.rice.krad.bo.BusinessObject) AbstractPositionDataDetailsInquirableImpl(org.kuali.kfs.integration.ld.businessobject.inquiry.AbstractPositionDataDetailsInquirableImpl) PositionDataDetailsInquirableImpl(org.kuali.kfs.module.ld.businessobject.inquiry.PositionDataDetailsInquirableImpl) AnchorHtmlData(org.kuali.kfs.kns.lookup.HtmlData.AnchorHtmlData)

Example 12 with BusinessObject

use of org.kuali.rice.krad.bo.BusinessObject in project cu-kfs by CU-CommunityApps.

the class CurrentFundsLookupableHelperServiceImpl method getInquiryUrl.

/**
 * @see org.kuali.kfs.kns.lookup.Lookupable#getInquiryUrl(org.kuali.kfs.kns.bo.BusinessObject, java.lang.String)
 */
@Override
public HtmlData getInquiryUrl(BusinessObject bo, String propertyName) {
    if (KFSPropertyConstants.POSITION_NUMBER.equals(propertyName)) {
        LedgerBalance balance = (LedgerBalance) bo;
        AbstractPositionDataDetailsInquirableImpl positionDataDetailsInquirable = new PositionDataDetailsInquirableImpl();
        Map<String, String> fieldValues = new HashMap<String, String>();
        fieldValues.put(propertyName, balance.getPositionNumber());
        BusinessObject positionData = positionDataDetailsInquirable.getBusinessObject(fieldValues);
        return positionData == null ? new AnchorHtmlData(KFSConstants.EMPTY_STRING, KFSConstants.EMPTY_STRING) : positionDataDetailsInquirable.getInquiryUrl(positionData, propertyName);
    }
    return (new CurrentFundsInquirableImpl()).getInquiryUrl(bo, propertyName);
}
Also used : AbstractPositionDataDetailsInquirableImpl(org.kuali.kfs.integration.ld.businessobject.inquiry.AbstractPositionDataDetailsInquirableImpl) HashMap(java.util.HashMap) LedgerBalance(org.kuali.kfs.module.ld.businessobject.LedgerBalance) BusinessObject(org.kuali.rice.krad.bo.BusinessObject) PositionDataDetailsInquirableImpl(org.kuali.kfs.module.ld.businessobject.inquiry.PositionDataDetailsInquirableImpl) AbstractPositionDataDetailsInquirableImpl(org.kuali.kfs.integration.ld.businessobject.inquiry.AbstractPositionDataDetailsInquirableImpl) AnchorHtmlData(org.kuali.kfs.kns.lookup.HtmlData.AnchorHtmlData) CurrentFundsInquirableImpl(com.rsmart.kuali.kfs.module.ld.businessobject.inquiry.CurrentFundsInquirableImpl)

Example 13 with BusinessObject

use of org.kuali.rice.krad.bo.BusinessObject in project cu-kfs by CU-CommunityApps.

the class EmployeeFundingLookupableHelperServiceImpl method getInquiryUrl.

/**
 * @see org.kuali.kfs.kns.lookup.Lookupable#getInquiryUrl(org.kuali.kfs.kns.bo.BusinessObject, java.lang.String)
 */
@Override
public HtmlData getInquiryUrl(BusinessObject bo, String propertyName) {
    if (KFSPropertyConstants.POSITION_NUMBER.equals(propertyName)) {
        EmployeeFunding employeeFunding = (EmployeeFunding) bo;
        AbstractPositionDataDetailsInquirableImpl positionDataDetailsInquirable = new PositionDataDetailsInquirableImpl();
        Map<String, String> fieldValues = new HashMap<String, String>();
        fieldValues.put(propertyName, employeeFunding.getPositionNumber());
        BusinessObject positionData = positionDataDetailsInquirable.getBusinessObject(fieldValues);
        return positionData == null ? new AnchorHtmlData(KFSConstants.EMPTY_STRING, KFSConstants.EMPTY_STRING) : positionDataDetailsInquirable.getInquiryUrl(positionData, propertyName);
    }
    return (new EmployeeFundingInquirableImpl()).getInquiryUrl(bo, propertyName);
}
Also used : AbstractPositionDataDetailsInquirableImpl(org.kuali.kfs.integration.ld.businessobject.inquiry.AbstractPositionDataDetailsInquirableImpl) HashMap(java.util.HashMap) EmployeeFunding(org.kuali.kfs.module.ld.businessobject.EmployeeFunding) BusinessObject(org.kuali.rice.krad.bo.BusinessObject) AbstractPositionDataDetailsInquirableImpl(org.kuali.kfs.integration.ld.businessobject.inquiry.AbstractPositionDataDetailsInquirableImpl) PositionDataDetailsInquirableImpl(org.kuali.kfs.module.ld.businessobject.inquiry.PositionDataDetailsInquirableImpl) AnchorHtmlData(org.kuali.kfs.kns.lookup.HtmlData.AnchorHtmlData) EmployeeFundingInquirableImpl(com.rsmart.kuali.kfs.module.ld.businessobject.inquiry.EmployeeFundingInquirableImpl)

Example 14 with BusinessObject

use of org.kuali.rice.krad.bo.BusinessObject in project cu-kfs by CU-CommunityApps.

the class DataObjectRestServiceController method getSearchResults.

protected List<? extends BusinessObject> getSearchResults(HttpServletRequest request, FinancialSystemBusinessObjectEntry boe) {
    Map<String, String> fieldValues = new HashMap<String, String>();
    for (Object o : request.getParameterMap().keySet()) {
        String[] value = (String[]) request.getParameterMap().get(o);
        fieldValues.put(o.toString(), value[0]);
    }
    LookupableHelperService lookupableHelperService = getLookupableHelperService(boe.getLookupDefinition().getLookupableID());
    lookupableHelperService.setBusinessObjectClass(boe.getBusinessObjectClass());
    String limitByParameter = fieldValues.remove(LIMIT_BY_PARAMETER);
    String maxObjectsToReturn = fieldValues.remove(MAX_OBJECTS_TO_RETURN);
    List<? extends BusinessObject> searchResults;
    if (StringUtils.isEmpty(limitByParameter) || limitByParameter.equalsIgnoreCase("Y")) {
        searchResults = lookupableHelperService.getSearchResults(fieldValues);
    } else {
        try {
            searchResults = lookupableHelperService.getSearchResultsUnbounded(fieldValues);
        } catch (UnsupportedOperationException e) {
            LOG.warn("lookupableHelperService.getSearchResultsUnbounded failed. Retrying the lookup using the default search.", e);
            searchResults = lookupableHelperService.getSearchResults(fieldValues);
        }
    }
    if (StringUtils.isNotEmpty(maxObjectsToReturn)) {
        int searchLimit = Integer.parseInt(maxObjectsToReturn);
        if (searchLimit > 0) {
            return searchResults.subList(0, Math.min(searchResults.size(), searchLimit));
        }
    }
    return searchResults;
}
Also used : LookupableHelperService(org.kuali.kfs.kns.lookup.LookupableHelperService) HashMap(java.util.HashMap) BusinessObject(org.kuali.rice.krad.bo.BusinessObject)

Example 15 with BusinessObject

use of org.kuali.rice.krad.bo.BusinessObject in project cu-kfs by CU-CommunityApps.

the class DataObjectRestServiceController method generateResultMap.

protected List<Map<String, String>> generateResultMap(HttpServletRequest request, FinancialSystemBusinessObjectEntry boe) {
    List<? extends BusinessObject> results = getSearchResults(request, boe);
    List<String> inquiryFields = getInquiryFields(boe);
    List<Map<String, String>> resultMap = new ArrayList<Map<String, String>>();
    for (BusinessObject bo : results) {
        Map<String, String> objectMap = new HashMap<String, String>();
        Object object = ObjectUtils.createNewObjectFromClass(boe.getBusinessObjectClass());
        for (String propertyName : inquiryFields) {
            Object propertyValue;
            try {
                propertyValue = ObjectUtils.getPropertyValue(bo, propertyName);
            } catch (RuntimeException e) {
                continue;
            }
            Class<?> propertyType = ObjectUtils.getPropertyType(bo, propertyName, getPersistenceStructureService());
            if (isPropertyTypeValid(propertyType)) {
                objectMap.put(propertyName, propertyValue + "");
            }
        }
        resultMap.add(objectMap);
    }
    return resultMap;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) BusinessObject(org.kuali.rice.krad.bo.BusinessObject) HashMap(java.util.HashMap) Map(java.util.Map) BusinessObject(org.kuali.rice.krad.bo.BusinessObject)

Aggregations

BusinessObject (org.kuali.rice.krad.bo.BusinessObject)15 HashMap (java.util.HashMap)9 AbstractPositionDataDetailsInquirableImpl (org.kuali.kfs.integration.ld.businessobject.inquiry.AbstractPositionDataDetailsInquirableImpl)6 AnchorHtmlData (org.kuali.kfs.kns.lookup.HtmlData.AnchorHtmlData)6 PositionDataDetailsInquirableImpl (org.kuali.kfs.module.ld.businessobject.inquiry.PositionDataDetailsInquirableImpl)6 ArrayList (java.util.ArrayList)3 LedgerBalance (org.kuali.kfs.module.ld.businessobject.LedgerBalance)3 LaborCalculatedSalaryFoundationTracker (org.kuali.kfs.module.ld.businessobject.LaborCalculatedSalaryFoundationTracker)2 DisbursementVoucherBatchDefault (com.rsmart.kuali.kfs.fp.businessobject.DisbursementVoucherBatchDefault)1 CurrentFundsInquirableImpl (com.rsmart.kuali.kfs.module.ld.businessobject.inquiry.CurrentFundsInquirableImpl)1 EmployeeFundingInquirableImpl (com.rsmart.kuali.kfs.module.ld.businessobject.inquiry.EmployeeFundingInquirableImpl)1 July1PositionFundingInquirableImpl (com.rsmart.kuali.kfs.module.ld.businessobject.inquiry.July1PositionFundingInquirableImpl)1 LaborCalculatedSalaryFoundationTrackerInquirableImpl (com.rsmart.kuali.kfs.module.ld.businessobject.inquiry.LaborCalculatedSalaryFoundationTrackerInquirableImpl)1 LedgerBalanceInquirableImpl (com.rsmart.kuali.kfs.module.ld.businessobject.inquiry.LedgerBalanceInquirableImpl)1 PositionFundingInquirableImpl (com.rsmart.kuali.kfs.module.ld.businessobject.inquiry.PositionFundingInquirableImpl)1 CuDisbursementPayee (edu.cornell.kfs.fp.businessobject.CuDisbursementPayee)1 Map (java.util.Map)1 Account (org.kuali.kfs.coa.businessobject.Account)1 DisbursementPayee (org.kuali.kfs.fp.businessobject.DisbursementPayee)1 LookupableHelperService (org.kuali.kfs.kns.lookup.LookupableHelperService)1