Search in sources :

Example 6 with DocumentService

use of org.kuali.kfs.krad.service.DocumentService in project cu-kfs by CU-CommunityApps.

the class CreateAccountingDocumentServiceImplTest method buildMockDocumentService.

private DocumentService buildMockDocumentService() throws Exception {
    DocumentService documentService = EasyMock.createMock(DocumentService.class);
    Capture<Document> documentArg = EasyMock.newCapture();
    EasyMock.expect(documentService.routeDocument(EasyMock.capture(documentArg), EasyMock.anyObject(), EasyMock.anyObject())).andStubAnswer(() -> recordAndReturnDocumentIfValid(documentArg.getValue()));
    EasyMock.replay(documentService);
    return documentService;
}
Also used : Document(org.kuali.kfs.krad.document.Document) AccountingDocument(org.kuali.kfs.sys.document.AccountingDocument) InternalBillingDocument(org.kuali.kfs.fp.document.InternalBillingDocument) DocumentService(org.kuali.kfs.krad.service.DocumentService)

Example 7 with DocumentService

use of org.kuali.kfs.krad.service.DocumentService in project cu-kfs by CU-CommunityApps.

the class CuElectronicInvoiceHelperServiceImpl method routePREQDocuments.

/**
 * @return
 */
protected boolean routePREQDocuments() {
    Collection<String> documentIdList = null;
    try {
        documentIdList = retrieveDocumentsToRoute(KewApiConstants.ROUTE_HEADER_SAVED_CD, PaymentRequestDocument.class);
    } catch (WorkflowException e1) {
        LOG.error("Error retrieving preq documents for routing: " + e1.getMessage(), e1);
        throw new RuntimeException(e1.getMessage(), e1);
    } catch (RemoteException re) {
        LOG.error("Error retrieving preq documents for routing: " + re.getMessage(), re);
        throw new RuntimeException(re.getMessage(), re);
    }
    // Collections.reverse(documentIdList);
    LOG.info("PREQs to Route: " + documentIdList);
    DocumentService documentService = SpringContext.getBean(DocumentService.class);
    WorkflowDocumentService workflowDocumentService = SpringContext.getBean(WorkflowDocumentService.class);
    for (String preqDocumentId : documentIdList) {
        try {
            LOG.info("Retrieving PREQ document # " + preqDocumentId + ".");
            PaymentRequestDocument preqDocument = (PaymentRequestDocument) documentService.getByDocumentHeaderId(preqDocumentId);
            LOG.info("Routing PREQ document # " + preqDocumentId + ".");
            if (preqDocument.getPaymentRequestElectronicInvoiceIndicator()) {
                documentService.prepareWorkflowDocument(preqDocument);
                LOG.info("PREQ document # " + preqDocumentId + " prepared for workflow.");
                // calling workflow service to bypass business rule checks
                workflowDocumentService.route(preqDocument.getDocumentHeader().getWorkflowDocument(), "Routed by electronic invoice batch job", null);
                LOG.info("PREQ document # " + preqDocumentId + " routed.");
            }
        } catch (WorkflowException e) {
            LOG.error("Error routing document # " + preqDocumentId + " " + e.getMessage());
            throw new RuntimeException(e.getMessage(), e);
        }
    }
    return true;
}
Also used : WorkflowException(org.kuali.rice.kew.api.exception.WorkflowException) CuPaymentRequestDocument(edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument) PaymentRequestDocument(org.kuali.kfs.module.purap.document.PaymentRequestDocument) WorkflowDocumentService(org.kuali.kfs.krad.workflow.service.WorkflowDocumentService) RemoteException(java.rmi.RemoteException) WorkflowDocumentService(org.kuali.kfs.krad.workflow.service.WorkflowDocumentService) DocumentService(org.kuali.kfs.krad.service.DocumentService) FinancialSystemDocumentService(org.kuali.kfs.sys.document.service.FinancialSystemDocumentService)

Example 8 with DocumentService

use of org.kuali.kfs.krad.service.DocumentService in project cu-kfs by CU-CommunityApps.

the class PayeeACHAccountExtractServiceImplTest method createMockDocumentService.

@SuppressWarnings("unchecked")
private DocumentService createMockDocumentService() throws Exception {
    DocumentService mockDocumentService = EasyMock.createMock(DocumentServiceImpl.class);
    EasyMock.expect(mockDocumentService.getNewDocument(CUPdpConstants.PAYEE_ACH_ACCOUNT_EXTRACT_MAINT_DOC_TYPE)).andStubAnswer(new IAnswer<Document>() {

        @Override
        public Document answer() throws Throwable {
            return createMockPAATDocument();
        }
    });
    EasyMock.expect(mockDocumentService.routeDocument(EasyMock.isA(MaintenanceDocument.class), EasyMock.or(EasyMock.isA(String.class), EasyMock.isNull(String.class)), EasyMock.or(EasyMock.isA(List.class), EasyMock.isNull(List.class)))).andStubAnswer(new IAnswer<Document>() {

        @Override
        public Document answer() throws Throwable {
            return (Document) EasyMock.getCurrentArguments()[0];
        }
    });
    EasyMock.replay(mockDocumentService);
    return mockDocumentService;
}
Also used : MaintenanceDocument(org.kuali.kfs.kns.document.MaintenanceDocument) MaintenanceDocument(org.kuali.kfs.kns.document.MaintenanceDocument) Document(org.kuali.kfs.krad.document.Document) DocumentService(org.kuali.kfs.krad.service.DocumentService)

Example 9 with DocumentService

use of org.kuali.kfs.krad.service.DocumentService in project cu-kfs by CU-CommunityApps.

the class CuRequisitionDocument method getRoutedByPrincipalId.

public String getRoutedByPrincipalId() {
    DocumentService documentService = SpringContext.getBean(DocumentService.class);
    RequisitionDocument document = null;
    String principalId = null;
    try {
        document = (RequisitionDocument) documentService.getByDocumentHeaderId(this.getDocumentNumber());
        principalId = document.getDocumentHeader().getWorkflowDocument().getRoutedByPrincipalId();
    } catch (WorkflowException we) {
    }
    return principalId;
}
Also used : RequisitionDocument(org.kuali.kfs.module.purap.document.RequisitionDocument) WorkflowException(org.kuali.rice.kew.api.exception.WorkflowException) DocumentService(org.kuali.kfs.krad.service.DocumentService)

Aggregations

DocumentService (org.kuali.kfs.krad.service.DocumentService)9 WorkflowException (org.kuali.rice.kew.api.exception.WorkflowException)7 Document (org.kuali.kfs.krad.document.Document)3 AccountingDocument (org.kuali.kfs.sys.document.AccountingDocument)3 CUFinancialSystemDocumentService (edu.cornell.kfs.sys.document.service.CUFinancialSystemDocumentService)2 RemoteException (java.rmi.RemoteException)2 MaintenanceDocument (org.kuali.kfs.kns.document.MaintenanceDocument)2 WorkflowDocumentService (org.kuali.kfs.krad.workflow.service.WorkflowDocumentService)2 FinancialSystemDocumentService (org.kuali.kfs.sys.document.service.FinancialSystemDocumentService)2 CheckReconciliation (com.rsmart.kuali.kfs.cr.businessobject.CheckReconciliation)1 CuElectronicInvoiceRejectDocument (edu.cornell.kfs.module.purap.document.CuElectronicInvoiceRejectDocument)1 CuPaymentRequestDocument (edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument)1 Date (java.sql.Date)1 RuntimeCacheException (org.apache.ojb.broker.cache.RuntimeCacheException)1 AccountGlobal (org.kuali.kfs.coa.businessobject.AccountGlobal)1 AccountGlobalDetail (org.kuali.kfs.coa.businessobject.AccountGlobalDetail)1 InternalBillingDocument (org.kuali.kfs.fp.document.InternalBillingDocument)1 LaborLedgerPostingDocumentForSearching (org.kuali.kfs.integration.ld.LaborLedgerPostingDocumentForSearching)1 DataDictionaryService (org.kuali.kfs.kns.service.DataDictionaryService)1 DocumentHeader (org.kuali.kfs.krad.bo.DocumentHeader)1