Search in sources :

Example 16 with BusinessObject

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

the class DisbursementVoucherDocumentBatchServiceImpl method getDisbursementVoucherBatchDefault.

/**
 * Retrieves the setup batch default record for the unit code
 *
 * @param unitCode unit code on batch default record to retrieve
 * @return DisbursementVoucherBatchDefault containing default values for DV
 */
protected DisbursementVoucherBatchDefault getDisbursementVoucherBatchDefault(String unitCode) {
    Map<String, String> pkValues = new HashMap<String, String>();
    pkValues.put(FPPropertyConstants.UNIT_CODE, unitCode);
    BusinessObject batchDefaults = businessObjectService.findByPrimaryKey(DisbursementVoucherBatchDefault.class, pkValues);
    return (DisbursementVoucherBatchDefault) batchDefaults;
}
Also used : HashMap(java.util.HashMap) DisbursementVoucherBatchDefault(com.rsmart.kuali.kfs.fp.businessobject.DisbursementVoucherBatchDefault) BusinessObject(org.kuali.kfs.krad.bo.BusinessObject)

Example 17 with BusinessObject

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

the class BusinessObjectFlatFileSerializerServiceBase method writeToFile.

protected void writeToFile(BufferedWriter writer, BusinessObject objectToSerialize) throws IOException {
    BusinessObject header = getHeader(objectToSerialize);
    List<? extends BusinessObject> lineItems = getLineItems(objectToSerialize);
    BusinessObject footer = getFooter(objectToSerialize);
    if (ObjectUtils.isNotNull(header)) {
        writeLines(writer, headerSerializerUtils, Collections.singletonList(header));
    }
    writeLines(writer, lineItemSerializerUtils, lineItems);
    if (ObjectUtils.isNotNull(footer)) {
        writeLines(writer, footerSerializerUtils, Collections.singletonList(footer));
    }
    writer.flush();
}
Also used : BusinessObject(org.kuali.kfs.krad.bo.BusinessObject)

Example 18 with BusinessObject

use of org.kuali.kfs.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.kfs.krad.bo.BusinessObject)

Example 19 with BusinessObject

use of org.kuali.kfs.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.kfs.krad.bo.BusinessObject) HashMap(java.util.HashMap) Map(java.util.Map) BusinessObject(org.kuali.kfs.krad.bo.BusinessObject)

Aggregations

BusinessObject (org.kuali.kfs.krad.bo.BusinessObject)19 InquiryForm (org.kuali.kfs.kns.web.struts.form.InquiryForm)8 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 Inquirable (org.kuali.kfs.kns.inquiry.Inquirable)2 DisbursementVoucherBatchDefault (com.rsmart.kuali.kfs.fp.businessobject.DisbursementVoucherBatchDefault)1 CuDisbursementPayee (edu.cornell.kfs.fp.businessobject.CuDisbursementPayee)1 Method (java.lang.reflect.Method)1 Map (java.util.Map)1 Account (org.kuali.kfs.coa.businessobject.Account)1 DocumentDictionaryService (org.kuali.kfs.datadictionary.legacy.DocumentDictionaryService)1 DisbursementPayee (org.kuali.kfs.fp.businessobject.DisbursementPayee)1 DocumentAttributeString (org.kuali.kfs.kew.api.document.attribute.DocumentAttributeString)1 WorkflowException (org.kuali.kfs.kew.api.exception.WorkflowException)1 BusinessObjectEntry (org.kuali.kfs.kns.datadictionary.BusinessObjectEntry)1 DocumentEntry (org.kuali.kfs.kns.datadictionary.DocumentEntry)1 LookupableHelperService (org.kuali.kfs.kns.lookup.LookupableHelperService)1 Field (org.kuali.kfs.kns.web.ui.Field)1 Row (org.kuali.kfs.kns.web.ui.Row)1 Exporter (org.kuali.kfs.krad.bo.Exporter)1