Search in sources :

Example 1 with ProcessExecutionResult

use of de.metas.process.ProcessExecutionResult in project metasfresh-webui-api by metasfresh.

the class ViewBasedProcessTemplate method setViewInfos.

private final void setViewInfos(@NonNull final ViewAsPreconditionsContext viewContext) {
    _view = viewContext.getView();
    _viewRowIdsSelection = viewContext.getViewRowIdsSelection();
    _parentViewRowIdsSelection = viewContext.getParentViewRowIdsSelection();
    _childViewRowIdsSelection = viewContext.getChildViewRowIdsSelection();
    // Update result from view
    // Do this only when view is not null to avoid reseting previous set info (shall not happen)
    final ProcessExecutionResult result = getResultOrNull();
    if (// might be null when preconditions are checked (for example)
    result != null && _view != null) {
        result.setWebuiViewId(_view.getViewId().getViewId());
    }
}
Also used : ProcessExecutionResult(de.metas.process.ProcessExecutionResult)

Example 2 with ProcessExecutionResult

use of de.metas.process.ProcessExecutionResult in project metasfresh-webui-api by metasfresh.

the class DocumentCollection method createDocumentPrint.

public DocumentPrint createDocumentPrint(final DocumentPath documentPath) {
    final Document document = getDocumentReadonly(documentPath);
    final int windowNo = document.getWindowNo();
    final DocumentEntityDescriptor entityDescriptor = document.getEntityDescriptor();
    final int printProcessId = entityDescriptor.getPrintProcessId();
    final TableRecordReference recordRef = getTableRecordReference(documentPath);
    final ProcessExecutionResult processExecutionResult = ProcessInfo.builder().setCtx(Env.getCtx()).setAD_Process_ID(printProcessId).setWindowNo(// important: required for ProcessInfo.findReportingLanguage
    windowNo).setRecord(recordRef).setPrintPreview(true).setJRDesiredOutputType(OutputType.PDF).buildAndPrepareExecution().onErrorThrowException().switchContextWhenRunning().executeSync().getResult();
    return DocumentPrint.builder().filename(processExecutionResult.getReportFilename()).reportContentType(processExecutionResult.getReportContentType()).reportData(processExecutionResult.getReportData()).build();
}
Also used : TableRecordReference(org.adempiere.util.lang.impl.TableRecordReference) DocumentEntityDescriptor(de.metas.ui.web.window.descriptor.DocumentEntityDescriptor) SourceDocument(de.metas.letters.model.MADBoilerPlate.SourceDocument) ProcessExecutionResult(de.metas.process.ProcessExecutionResult)

Example 3 with ProcessExecutionResult

use of de.metas.process.ProcessExecutionResult in project metasfresh-webui-api by metasfresh.

the class ADProcessPostProcessService method postProcess.

public ProcessInstanceResult postProcess(@NonNull final ADProcessPostProcessRequest request) {
    final ProcessInfo processInfo = request.getProcessInfo();
    final ProcessExecutionResult processExecutionResult = request.getProcessExecutionResult();
    invalidateDocumentsAndViews(request.getViewId(), processExecutionResult);
    return ProcessInstanceResult.builder(extractInstanceId(request)).summary(extractSummary(processExecutionResult)).error(processExecutionResult.isError()).action(createResultAction(processInfo, processExecutionResult)).build();
}
Also used : ProcessInfo(de.metas.process.ProcessInfo) ProcessExecutionResult(de.metas.process.ProcessExecutionResult)

Aggregations

ProcessExecutionResult (de.metas.process.ProcessExecutionResult)3 SourceDocument (de.metas.letters.model.MADBoilerPlate.SourceDocument)1 ProcessInfo (de.metas.process.ProcessInfo)1 DocumentEntityDescriptor (de.metas.ui.web.window.descriptor.DocumentEntityDescriptor)1 TableRecordReference (org.adempiere.util.lang.impl.TableRecordReference)1