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;
}
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();
}
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;
}
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;
}
Aggregations