use of de.metas.ui.web.window.datatypes.WindowId in project metasfresh-webui-api by metasfresh.
the class JSONCreateViewRequest method getReferencingDocumentPaths.
public Set<DocumentPath> getReferencingDocumentPaths() {
if (referencing == null) {
return ImmutableSet.of();
}
final Set<String> documentIds = referencing.getDocumentIds();
if (documentIds == null || documentIds.isEmpty()) {
return ImmutableSet.of();
}
final WindowId windowId = WindowId.fromJson(referencing.getDocumentType());
final String tabIdStr = referencing.getTabId();
if (tabIdStr == null) {
return documentIds.stream().map(id -> DocumentPath.rootDocumentPath(windowId, id)).collect(ImmutableSet.toImmutableSet());
} else {
final DocumentId documentId = DocumentId.of(ListUtils.singleElement(documentIds));
final DetailId tabId = DetailId.fromJson(tabIdStr);
final Set<String> rowIds = referencing.getRowIds();
return rowIds.stream().map(DocumentId::of).map(rowId -> DocumentPath.includedDocumentPath(windowId, documentId, tabId, rowId)).collect(ImmutableSet.toImmutableSet());
}
}
use of de.metas.ui.web.window.datatypes.WindowId in project metasfresh-webui-api by metasfresh.
the class WindowRestController method getDocumentFieldZoomInto.
@ApiOperation("field current value's window layout to zoom into")
@GetMapping("/{windowId}/{documentId}/field/{fieldName}/zoomInto")
public JSONZoomInto getDocumentFieldZoomInto(//
@PathVariable("windowId") final String windowIdStr, //
@PathVariable("documentId") final String documentId, //
@PathVariable("fieldName") final String fieldName) {
final WindowId windowId = WindowId.fromJson(windowIdStr);
final DocumentPath documentPath = DocumentPath.rootDocumentPath(windowId, documentId);
return getDocumentFieldZoomInto(documentPath, fieldName);
}
use of de.metas.ui.web.window.datatypes.WindowId in project metasfresh-webui-api by metasfresh.
the class WindowRestController method processRecord.
/**
* @task https://github.com/metasfresh/metasfresh/issues/1090
*/
@GetMapping("/{windowId}/{documentId}/processNewRecord")
public int processRecord(//
@PathVariable("windowId") final String windowIdStr, //
@PathVariable("documentId") final String documentIdStr) {
userSession.assertLoggedIn();
final WindowId windowId = WindowId.fromJson(windowIdStr);
final DocumentPath documentPath = DocumentPath.rootDocumentPath(windowId, documentIdStr);
final IDocumentChangesCollector changesCollector = NullDocumentChangesCollector.instance;
return Execution.callInNewExecution("window.processTemplate", () -> documentCollection.forDocumentWritable(documentPath, changesCollector, document -> {
document.saveIfValidAndHasChanges();
if (document.hasChangesRecursivelly()) {
throw new AdempiereException("Not saved");
}
final int newRecordId = newRecordDescriptorsProvider.getNewRecordDescriptor(document.getEntityDescriptor()).getProcessor().processNewRecordDocument(document);
return newRecordId;
}));
}
use of de.metas.ui.web.window.datatypes.WindowId in project metasfresh-webui-api by metasfresh.
the class WindowRestController method getIncludedDocumentActions.
@GetMapping("/{windowId}/{documentId}/{tabId}/{rowId}/actions")
public JSONDocumentActionsList getIncludedDocumentActions(@PathVariable("windowId") final String windowIdStr, @PathVariable("documentId") final String documentIdStr, @PathVariable("tabId") final String tabIdStr, @PathVariable("rowId") final String rowIdStr, @RequestParam(name = "disabled", defaultValue = "false") final boolean returnDisabled) {
final WindowId windowId = WindowId.fromJson(windowIdStr);
final DocumentPath documentPath = DocumentPath.includedDocumentPath(windowId, documentIdStr, tabIdStr, rowIdStr);
final Set<TableRecordReference> selectedIncludedRecords = ImmutableSet.of();
return getDocumentActions(documentPath, selectedIncludedRecords, returnDisabled);
}
use of de.metas.ui.web.window.datatypes.WindowId in project metasfresh-webui-api by metasfresh.
the class WindowRestController method getData.
@GetMapping("/{windowId}/{documentId}/{tabId}/{rowId}")
public List<JSONDocument> getData(//
@PathVariable("windowId") final String windowIdStr, //
@PathVariable("documentId") final String documentIdStr, //
@PathVariable("tabId") final String tabIdStr, //
@PathVariable("rowId") final String rowIdStr, //
@RequestParam(name = PARAM_FieldsList, required = false) @ApiParam("comma separated field names") final String fieldsListStr, //
@RequestParam(name = PARAM_Advanced, required = false, defaultValue = PARAM_Advanced_DefaultValue) final boolean advanced) {
final WindowId windowId = WindowId.fromJson(windowIdStr);
final DocumentPath documentPath = DocumentPath.includedDocumentPath(windowId, documentIdStr, tabIdStr, rowIdStr);
final List<DocumentQueryOrderBy> orderBys = ImmutableList.of();
return getData(documentPath, fieldsListStr, advanced, orderBys);
}
Aggregations