use of de.metas.ui.web.window.datatypes.json.JSONDocument in project metasfresh-webui-api by metasfresh.
the class WindowQuickInputRestController method processChanges.
@PatchMapping("/{quickInputId}")
public List<JSONDocument> processChanges(//
@PathVariable("windowId") final String windowIdStr, //
@PathVariable("documentId") final String documentIdStr, //
@PathVariable("tabId") final String tabIdStr, //
@PathVariable("quickInputId") final String quickInputIdStr, @RequestBody final List<JSONDocumentChangedEvent> events) {
userSession.assertLoggedIn();
final QuickInputPath quickInputPath = QuickInputPath.of(windowIdStr, documentIdStr, tabIdStr, quickInputIdStr);
return Execution.callInNewExecution("quickInput-writable-" + quickInputPath, () -> {
final IDocumentChangesCollector changesCollector = Execution.getCurrentDocumentChangesCollectorOrNull();
forQuickInputWritable(quickInputPath, changesCollector, quickInput -> {
quickInput.processValueChanges(events);
changesCollector.setPrimaryChange(quickInput.getDocumentPath());
// void
return null;
});
// Extract and send websocket events
final List<JSONDocument> jsonDocumentEvents = JSONDocument.ofEvents(changesCollector, newJSONOptions());
websocketPublisher.convertAndPublish(jsonDocumentEvents);
return jsonDocumentEvents;
});
}
Aggregations