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