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