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