use of de.metas.ui.web.process.json.JSONProcessInstanceResult in project metasfresh-webui-api by metasfresh.
the class ProcessRestController method startProcess.
@RequestMapping(value = "/{processId}/{pinstanceId}/start", method = RequestMethod.GET)
public JSONProcessInstanceResult startProcess(//
@PathVariable("processId") final String processIdStr, //
@PathVariable("pinstanceId") final String pinstanceIdStr) {
userSession.assertLoggedIn();
final ProcessId processId = ProcessId.fromJson(processIdStr);
final DocumentId pinstanceId = DocumentId.of(pinstanceIdStr);
final IProcessInstancesRepository instancesRepository = getRepository(processId);
return Execution.prepareNewExecution().outOfTransaction().execute(() -> {
return instancesRepository.forProcessInstanceWritable(pinstanceId, NullDocumentChangesCollector.instance, processInstance -> {
final ProcessInstanceResult result = processInstance.startProcess(ProcessExecutionContext.builder().ctx(Env.getCtx()).adLanguage(userSession.getAD_Language()).viewsRepo(viewsRepo).documentsCollection(documentsCollection).build());
return JSONProcessInstanceResult.of(result);
});
});
}
Aggregations