use of de.metas.ui.web.window.datatypes.DocumentId in project metasfresh-webui-api by metasfresh.
the class DocumentWebsocketPublisher method collectFrom.
private static final void collectFrom(final JSONDocumentChangedWebSocketEventCollector collector, final JSONDocument event) {
final WindowId windowId = event.getWindowId();
if (windowId == null) {
return;
}
// Included document => nothing to publish about it
if (event.getTabId() != null) {
return;
}
final DocumentId documentId = event.getId();
event.getIncludedTabsInfos().forEach(tabInfo -> collector.mergeFrom(windowId, documentId, tabInfo));
}
use of de.metas.ui.web.window.datatypes.DocumentId in project metasfresh-webui-api by metasfresh.
the class JSONDocumentChangedWebSocketEvent method rootDocument.
public static JSONDocumentChangedWebSocketEvent rootDocument(final WindowId windowId, final DocumentId documentId) {
final String tabId = null;
final DocumentId rowId = null;
final JSONDocumentChangedWebSocketEvent event = new JSONDocumentChangedWebSocketEvent(windowId, documentId, tabId, rowId);
return event;
}
use of de.metas.ui.web.window.datatypes.DocumentId in project metasfresh-webui-api by metasfresh.
the class ProcessRestController method getInstance.
@RequestMapping(value = "/{processId}/{pinstanceId}", method = RequestMethod.GET)
public JSONProcessInstance getInstance(@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 instancesRepository.forProcessInstanceReadonly(pinstanceId, processInstance -> JSONProcessInstance.of(processInstance, newJSONOptions()));
}
use of de.metas.ui.web.window.datatypes.DocumentId in project metasfresh-webui-api by metasfresh.
the class ProcessRestController method getParameterTypeahead.
@RequestMapping(value = "/{processId}/{pinstanceId}/field/{parameterName}/typeahead", method = RequestMethod.GET)
public JSONLookupValuesList getParameterTypeahead(//
@PathVariable("processId") final String processIdStr, //
@PathVariable("pinstanceId") final String pinstanceIdStr, //
@PathVariable("parameterName") final String parameterName, //
@RequestParam(name = "query", required = true) final String query) {
userSession.assertLoggedIn();
final ProcessId processId = ProcessId.fromJson(processIdStr);
final DocumentId pinstanceId = DocumentId.of(pinstanceIdStr);
final IProcessInstancesRepository instancesRepository = getRepository(processId);
return instancesRepository.forProcessInstanceReadonly(pinstanceId, processInstance -> processInstance.getParameterLookupValuesForQuery(parameterName, query)).transform(JSONLookupValuesList::ofLookupValuesList);
}
use of de.metas.ui.web.window.datatypes.DocumentId 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