use of org.kuali.rice.krad.bo.BusinessObject in project cu-kfs by CU-CommunityApps.
the class FinancialSystemSearchableAttribute method getSearchingRows.
@Override
protected List<Row> getSearchingRows(String documentTypeName) {
if (LOG.isDebugEnabled()) {
LOG.debug("getSearchingRows( " + documentTypeName + " )");
if (LOG.isTraceEnabled()) {
LOG.trace("Stack Trace at point of call", new Throwable());
}
}
DataDictionaryService ddService = SpringContext.getBean(DataDictionaryService.class);
List<Row> docSearchRows = super.getSearchingRows(documentTypeName);
// add account number search field when selected document type is COA
if (StringUtils.isNotEmpty(documentTypeName)) {
if (CUKFSConstants.COA_DOCUMENT_TYPE.equalsIgnoreCase(documentTypeName)) {
Field accountField = FieldUtils.getPropertyField(Account.class, KFSPropertyConstants.ACCOUNT_NUMBER, true);
accountField.setFieldDataType(SearchableAttributeConstants.DATA_TYPE_STRING);
accountField.setColumnVisible(true);
docSearchRows.add(new Row(Collections.singletonList(accountField)));
}
}
DocumentEntry entry = ddService.getDataDictionary().getDocumentEntry(documentTypeName);
if (entry != null) {
Class<? extends Document> docClass = entry.getDocumentClass();
if (AccountingDocument.class.isAssignableFrom(docClass)) {
Map<String, AccountingLineGroupDefinition> alGroups = ((FinancialSystemTransactionalDocumentEntry) entry).getAccountingLineGroups();
Class alClass = SourceAccountingLine.class;
if (ObjectUtils.isNotNull(alGroups)) {
if (alGroups.containsKey("source")) {
alClass = alGroups.get("source").getAccountingLineClass();
}
}
BusinessObject alBusinessObject = null;
try {
alBusinessObject = (BusinessObject) alClass.newInstance();
} catch (Exception cnfe) {
throw new RuntimeException("Unable to instantiate accounting line class: " + alClass, cnfe);
}
Field chartField = FieldUtils.getPropertyField(alClass, KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE, true);
chartField.setFieldDataType(SearchableAttributeConstants.DATA_TYPE_STRING);
chartField.setColumnVisible(true);
LookupUtils.setFieldQuickfinder(alBusinessObject, KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE, chartField, Collections.singletonList(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE));
docSearchRows.add(new Row(Collections.singletonList(chartField)));
Field orgField = FieldUtils.getPropertyField(Organization.class, KFSPropertyConstants.ORGANIZATION_CODE, true);
orgField.setFieldDataType(SearchableAttributeConstants.DATA_TYPE_STRING);
orgField.setColumnVisible(true);
LookupUtils.setFieldQuickfinder(new Account(), KFSPropertyConstants.ORGANIZATION_CODE, orgField, Collections.singletonList(KFSPropertyConstants.ORGANIZATION_CODE));
docSearchRows.add(new Row(Collections.singletonList(orgField)));
Field accountField = FieldUtils.getPropertyField(alClass, KFSPropertyConstants.ACCOUNT_NUMBER, true);
accountField.setFieldDataType(SearchableAttributeConstants.DATA_TYPE_STRING);
accountField.setColumnVisible(true);
LookupUtils.setFieldQuickfinder(alBusinessObject, KFSPropertyConstants.ACCOUNT_NUMBER, accountField, Collections.singletonList(KFSPropertyConstants.ACCOUNT_NUMBER));
docSearchRows.add(new Row(Collections.singletonList(accountField)));
}
boolean displayedLedgerPostingDoc = false;
if (LaborLedgerPostingDocumentForSearching.class.isAssignableFrom(docClass)) {
Field searchField = FieldUtils.getPropertyField(GeneralLedgerPendingEntry.class, KFSPropertyConstants.FINANCIAL_DOCUMENT_TYPE_CODE, true);
searchField.setFieldDataType(SearchableAttributeConstants.DATA_TYPE_STRING);
LookupUtils.setFieldQuickfinder(new GeneralLedgerPendingEntry(), KFSPropertyConstants.FINANCIAL_DOCUMENT_TYPE_CODE, searchField, Collections.singletonList(KFSPropertyConstants.FINANCIAL_DOCUMENT_TYPE_CODE));
docSearchRows.add(new Row(Collections.singletonList(searchField)));
displayedLedgerPostingDoc = true;
}
if (GeneralLedgerPostingDocument.class.isAssignableFrom(docClass) && !displayedLedgerPostingDoc) {
Field searchField = FieldUtils.getPropertyField(GeneralLedgerPendingEntry.class, KFSPropertyConstants.FINANCIAL_DOCUMENT_TYPE_CODE, true);
searchField.setFieldDataType(SearchableAttributeConstants.DATA_TYPE_STRING);
LookupUtils.setFieldQuickfinder(new GeneralLedgerPendingEntry(), KFSPropertyConstants.FINANCIAL_DOCUMENT_TYPE_CODE, searchField, Collections.singletonList(KFSPropertyConstants.FINANCIAL_DOCUMENT_TYPE_CODE));
docSearchRows.add(new Row(Collections.singletonList(searchField)));
}
if (AmountTotaling.class.isAssignableFrom(docClass)) {
Field searchField = FieldUtils.getPropertyField(FinancialSystemDocumentHeader.class, KFSPropertyConstants.FINANCIAL_DOCUMENT_TOTAL_AMOUNT, true);
searchField.setFieldDataType(SearchableAttributeConstants.DATA_TYPE_FLOAT);
docSearchRows.add(new Row(Collections.singletonList(searchField)));
}
}
Row resultType = createSearchResultDisplayTypeRow();
docSearchRows.add(resultType);
if (LOG.isDebugEnabled()) {
LOG.debug("Returning Rows: " + docSearchRows);
}
return docSearchRows;
}
use of org.kuali.rice.krad.bo.BusinessObject in project cu-kfs by CU-CommunityApps.
the class LaborCalculatedSalaryFoundationTrackerLookupableHelperServiceImpl method getInquiryUrl.
/**
* @see org.kuali.kfs.kns.lookup.AbstractLookupableHelperServiceImpl#getInquiryUrl(org.kuali.kfs.kns.bo.BusinessObject,
* java.lang.String)
*/
@Override
public HtmlData getInquiryUrl(BusinessObject bo, String propertyName) {
if (KFSPropertyConstants.POSITION_NUMBER.equals(propertyName)) {
LaborCalculatedSalaryFoundationTracker CSFTracker = (LaborCalculatedSalaryFoundationTracker) bo;
AbstractPositionDataDetailsInquirableImpl positionDataDetailsInquirable = new PositionDataDetailsInquirableImpl();
// KUALI-1321 Gets the Person object via the employee ID and populates the name property.
Person person = SpringContext.getBean(PersonService.class).getPersonByEmployeeId(CSFTracker.getEmplid());
if (person != null) {
// CSFTracker.setName(person.getLastName() + ", " + person.getFirstName());
}
Map<String, String> fieldValues = new HashMap<String, String>();
fieldValues.put(propertyName, CSFTracker.getPositionNumber());
BusinessObject positionData = positionDataDetailsInquirable.getBusinessObject(fieldValues);
return positionData == null ? new AnchorHtmlData(KFSConstants.EMPTY_STRING, KFSConstants.EMPTY_STRING) : positionDataDetailsInquirable.getInquiryUrl(positionData, propertyName);
}
return (new LaborCalculatedSalaryFoundationTrackerInquirableImpl()).getInquiryUrl(bo, propertyName);
}
use of org.kuali.rice.krad.bo.BusinessObject in project cu-kfs by CU-CommunityApps.
the class LedgerBalanceLookupableHelperServiceImpl 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 LedgerBalanceInquirableImpl()).getInquiryUrl(bo, propertyName);
}
use of org.kuali.rice.krad.bo.BusinessObject in project cu-kfs by CU-CommunityApps.
the class PositionFundingLookupableHelperServiceImpl method getInquiryUrl.
/**
* @see org.kuali.kfs.kns.lookup.Lookupable#getInquiryUrl(org.kuali.kfs.kns.bo.BusinessObject, java.lang.String)
*/
@Override
public HtmlData getInquiryUrl(BusinessObject businessObject, String propertyName) {
if (KFSPropertyConstants.POSITION_NUMBER.equals(propertyName)) {
LaborCalculatedSalaryFoundationTracker CSFTracker = (LaborCalculatedSalaryFoundationTracker) businessObject;
AbstractPositionDataDetailsInquirableImpl positionDataDetailsInquirable = new PositionDataDetailsInquirableImpl();
Map<String, String> fieldValues = new HashMap<String, String>();
fieldValues.put(propertyName, CSFTracker.getPositionNumber());
BusinessObject positionData = positionDataDetailsInquirable.getBusinessObject(fieldValues);
return positionData == null ? new AnchorHtmlData(KFSConstants.EMPTY_STRING, KFSConstants.EMPTY_STRING) : positionDataDetailsInquirable.getInquiryUrl(positionData, propertyName);
}
return (new PositionFundingInquirableImpl()).getInquiryUrl(businessObject, propertyName);
}
use of org.kuali.rice.krad.bo.BusinessObject in project cu-kfs by CU-CommunityApps.
the class CuDisbursementPayeeLookupableHelperServiceImpl method getVendorsAsPayees.
protected List<DisbursementPayee> getVendorsAsPayees(Map<String, String> fieldValues) {
List<DisbursementPayee> payeeList = new ArrayList<DisbursementPayee>();
Map<String, String> fieldsForLookup = this.getVendorFieldValues(fieldValues);
vendorLookupable.setBusinessObjectClass(VendorDetail.class);
vendorLookupable.validateSearchParameters(fieldsForLookup);
List<? extends BusinessObject> vendorList = vendorLookupable.getSearchResults(fieldsForLookup);
for (BusinessObject vendor : vendorList) {
VendorDetail vendorDetail = (VendorDetail) vendor;
CuDisbursementPayee payee = getPayeeFromVendor(vendorDetail, fieldValues);
payeeList.add(payee);
}
return payeeList;
}
Aggregations