Search in sources :

Example 1 with BusinessObject

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;
}
Also used : Account(org.kuali.kfs.coa.businessobject.Account) GeneralLedgerPendingEntry(org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntry) DocumentAttributeString(org.kuali.rice.kew.api.document.attribute.DocumentAttributeString) SourceAccountingLine(org.kuali.kfs.sys.businessobject.SourceAccountingLine) BusinessObject(org.kuali.rice.krad.bo.BusinessObject) DataDictionaryService(org.kuali.kfs.kns.service.DataDictionaryService) WorkflowException(org.kuali.rice.kew.api.exception.WorkflowException) Field(org.kuali.kfs.kns.web.ui.Field) AccountingLineGroupDefinition(org.kuali.kfs.sys.document.datadictionary.AccountingLineGroupDefinition) FinancialSystemTransactionalDocumentEntry(org.kuali.kfs.sys.document.datadictionary.FinancialSystemTransactionalDocumentEntry) GeneralLedgerPostingDocument(org.kuali.kfs.sys.document.GeneralLedgerPostingDocument) FinancialSystemTransactionalDocumentEntry(org.kuali.kfs.sys.document.datadictionary.FinancialSystemTransactionalDocumentEntry) DocumentEntry(org.kuali.kfs.krad.datadictionary.DocumentEntry) Row(org.kuali.kfs.kns.web.ui.Row)

Example 2 with BusinessObject

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);
}
Also used : AbstractPositionDataDetailsInquirableImpl(org.kuali.kfs.integration.ld.businessobject.inquiry.AbstractPositionDataDetailsInquirableImpl) HashMap(java.util.HashMap) PersonService(org.kuali.rice.kim.api.identity.PersonService) LaborCalculatedSalaryFoundationTracker(org.kuali.kfs.module.ld.businessobject.LaborCalculatedSalaryFoundationTracker) Person(org.kuali.rice.kim.api.identity.Person) 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) LaborCalculatedSalaryFoundationTrackerInquirableImpl(com.rsmart.kuali.kfs.module.ld.businessobject.inquiry.LaborCalculatedSalaryFoundationTrackerInquirableImpl)

Example 3 with BusinessObject

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);
}
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) LedgerBalanceInquirableImpl(com.rsmart.kuali.kfs.module.ld.businessobject.inquiry.LedgerBalanceInquirableImpl) 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 4 with BusinessObject

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);
}
Also used : AbstractPositionDataDetailsInquirableImpl(org.kuali.kfs.integration.ld.businessobject.inquiry.AbstractPositionDataDetailsInquirableImpl) HashMap(java.util.HashMap) PositionFundingInquirableImpl(com.rsmart.kuali.kfs.module.ld.businessobject.inquiry.PositionFundingInquirableImpl) LaborCalculatedSalaryFoundationTracker(org.kuali.kfs.module.ld.businessobject.LaborCalculatedSalaryFoundationTracker) 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 5 with BusinessObject

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;
}
Also used : VendorDetail(org.kuali.kfs.vnd.businessobject.VendorDetail) CuDisbursementPayee(edu.cornell.kfs.fp.businessobject.CuDisbursementPayee) ArrayList(java.util.ArrayList) CuDisbursementPayee(edu.cornell.kfs.fp.businessobject.CuDisbursementPayee) DisbursementPayee(org.kuali.kfs.fp.businessobject.DisbursementPayee) 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