Search in sources :

Example 1 with DocumentAttribute

use of org.kuali.kfs.kew.api.document.attribute.DocumentAttribute in project cu-kfs by CU-CommunityApps.

the class FinancialSystemSearchableAttribute method harvestLLPDocumentSearchableAttributes.

/**
 * Harvest LLPE document type as searchable attributes from a LL posting document
 *
 * @param LLPDoc the LLP document to pull values from
 * @return a List of searchable values
 */
protected List<DocumentAttribute> harvestLLPDocumentSearchableAttributes(LaborLedgerPostingDocumentForSearching LLPDoc) {
    List<DocumentAttribute> searchAttrValues = new ArrayList<>();
    for (Object llpeObj : LLPDoc.getLaborLedgerPendingEntriesForSearching()) {
        LaborLedgerPendingEntryForSearching llpe = (LaborLedgerPendingEntryForSearching) llpeObj;
        addSearchableAttributesForLLPE(searchAttrValues, llpe);
    }
    return searchAttrValues;
}
Also used : ArrayList(java.util.ArrayList) DocumentAttribute(org.kuali.kfs.kew.api.document.attribute.DocumentAttribute) BusinessObject(org.kuali.kfs.krad.bo.BusinessObject) LaborLedgerPendingEntryForSearching(org.kuali.kfs.integration.ld.LaborLedgerPendingEntryForSearching)

Example 2 with DocumentAttribute

use of org.kuali.kfs.kew.api.document.attribute.DocumentAttribute in project cu-kfs by CU-CommunityApps.

the class FinancialSystemSearchableAttribute method extractDocumentAttributes.

@Override
public List<DocumentAttribute> extractDocumentAttributes(RuleAttribute ruleAttribute, DocumentRouteHeaderValue document) {
    if (LOG.isDebugEnabled()) {
        LOG.debug("extractDocumentAttributes( " + ruleAttribute + ", " + document + " )");
    }
    List<DocumentAttribute> searchAttrValues = super.extractDocumentAttributes(ruleAttribute, document);
    String docId = document.getDocumentId();
    DocumentService docService = SpringContext.getBean(DocumentService.class);
    Document doc = null;
    try {
        doc = docService.getByDocumentHeaderId(docId);
    } catch (WorkflowException we) {
    // ignore
    }
    if (doc != null) {
        if (doc instanceof AmountTotaling && ((AmountTotaling) doc).getTotalDollarAmount() != null) {
            DocumentAttributeDecimal searchableAttributeValue = new DocumentAttributeDecimal(KFSPropertyConstants.FINANCIAL_DOCUMENT_TOTAL_AMOUNT, ((AmountTotaling) doc).getTotalDollarAmount().bigDecimalValue());
            searchAttrValues.add(searchableAttributeValue);
        }
        if (doc instanceof AccountingDocument) {
            AccountingDocument accountingDoc = (AccountingDocument) doc;
            searchAttrValues.addAll(harvestAccountingDocumentSearchableAttributes(accountingDoc));
        }
        boolean indexedLedgerDoc = false;
        if (doc instanceof LaborLedgerPostingDocumentForSearching) {
            LaborLedgerPostingDocumentForSearching LLPostingDoc = (LaborLedgerPostingDocumentForSearching) doc;
            searchAttrValues.addAll(harvestLLPDocumentSearchableAttributes(LLPostingDoc));
            indexedLedgerDoc = true;
        }
        if (doc instanceof GeneralLedgerPostingDocument && !indexedLedgerDoc) {
            GeneralLedgerPostingDocument GLPostingDoc = (GeneralLedgerPostingDocument) doc;
            searchAttrValues.addAll(harvestGLPDocumentSearchableAttributes(GLPostingDoc));
        }
        DocumentHeader docHeader = doc.getDocumentHeader();
        if (ObjectUtils.isNotNull(docHeader) && ObjectUtils.isNotNull(docHeader.getWorkflowDocument()) && CUKFSConstants.GACC_DOCUMENT_TYPE.equalsIgnoreCase(docHeader.getWorkflowDocument().getDocumentTypeName())) {
            for (AccountGlobalDetail detail : ((AccountGlobal) ((AccountGlobalMaintainableImpl) ((FinancialSystemMaintenanceDocument) doc).getNewMaintainableObject()).getBusinessObject()).getAccountGlobalDetails()) {
                if (!StringUtils.isBlank(detail.getAccountNumber())) {
                    DocumentAttributeString searchableAttributeValue = new DocumentAttributeString(KFSPropertyConstants.ACCOUNT_NUMBER, detail.getAccountNumber());
                    searchAttrValues.add(searchableAttributeValue);
                }
            }
        }
    }
    return searchAttrValues;
}
Also used : WorkflowException(org.kuali.kfs.kew.api.exception.WorkflowException) DocumentAttributeDecimal(org.kuali.kfs.kew.api.document.attribute.DocumentAttributeDecimal) DocumentAttributeString(org.kuali.kfs.kew.api.document.attribute.DocumentAttributeString) Document(org.kuali.kfs.krad.document.Document) GeneralLedgerPostingDocument(org.kuali.kfs.sys.document.GeneralLedgerPostingDocument) FinancialSystemMaintenanceDocument(org.kuali.kfs.sys.document.FinancialSystemMaintenanceDocument) AccountingDocument(org.kuali.kfs.sys.document.AccountingDocument) DocumentHeader(org.kuali.kfs.krad.bo.DocumentHeader) FinancialSystemDocumentHeader(org.kuali.kfs.sys.businessobject.FinancialSystemDocumentHeader) DocumentService(org.kuali.kfs.krad.service.DocumentService) LaborLedgerPostingDocumentForSearching(org.kuali.kfs.integration.ld.LaborLedgerPostingDocumentForSearching) FinancialSystemMaintenanceDocument(org.kuali.kfs.sys.document.FinancialSystemMaintenanceDocument) GeneralLedgerPostingDocument(org.kuali.kfs.sys.document.GeneralLedgerPostingDocument) AccountGlobal(org.kuali.kfs.coa.businessobject.AccountGlobal) DocumentAttribute(org.kuali.kfs.kew.api.document.attribute.DocumentAttribute) AccountingDocument(org.kuali.kfs.sys.document.AccountingDocument) AccountGlobalDetail(org.kuali.kfs.coa.businessobject.AccountGlobalDetail) DocumentAttributeString(org.kuali.kfs.kew.api.document.attribute.DocumentAttributeString) AmountTotaling(org.kuali.kfs.sys.document.AmountTotaling)

Aggregations

DocumentAttribute (org.kuali.kfs.kew.api.document.attribute.DocumentAttribute)2 ArrayList (java.util.ArrayList)1 AccountGlobal (org.kuali.kfs.coa.businessobject.AccountGlobal)1 AccountGlobalDetail (org.kuali.kfs.coa.businessobject.AccountGlobalDetail)1 LaborLedgerPendingEntryForSearching (org.kuali.kfs.integration.ld.LaborLedgerPendingEntryForSearching)1 LaborLedgerPostingDocumentForSearching (org.kuali.kfs.integration.ld.LaborLedgerPostingDocumentForSearching)1 DocumentAttributeDecimal (org.kuali.kfs.kew.api.document.attribute.DocumentAttributeDecimal)1 DocumentAttributeString (org.kuali.kfs.kew.api.document.attribute.DocumentAttributeString)1 WorkflowException (org.kuali.kfs.kew.api.exception.WorkflowException)1 BusinessObject (org.kuali.kfs.krad.bo.BusinessObject)1 DocumentHeader (org.kuali.kfs.krad.bo.DocumentHeader)1 Document (org.kuali.kfs.krad.document.Document)1 DocumentService (org.kuali.kfs.krad.service.DocumentService)1 FinancialSystemDocumentHeader (org.kuali.kfs.sys.businessobject.FinancialSystemDocumentHeader)1 AccountingDocument (org.kuali.kfs.sys.document.AccountingDocument)1 AmountTotaling (org.kuali.kfs.sys.document.AmountTotaling)1 FinancialSystemMaintenanceDocument (org.kuali.kfs.sys.document.FinancialSystemMaintenanceDocument)1 GeneralLedgerPostingDocument (org.kuali.kfs.sys.document.GeneralLedgerPostingDocument)1