use of de.metas.ui.web.window.datatypes.DocumentPath in project metasfresh-webui-api by metasfresh.
the class WindowRestController method deleteIncludedDocument.
@DeleteMapping("/{windowId}/{documentId}/{tabId}/{rowId}")
public List<JSONDocument> deleteIncludedDocument(//
@PathVariable("windowId") final String windowIdStr, //
@PathVariable("documentId") final String documentId, //
@PathVariable("tabId") final String tabId, //
@PathVariable("rowId") final String rowId) {
final WindowId windowId = WindowId.fromJson(windowIdStr);
final DocumentPath documentPath = DocumentPath.includedDocumentPath(windowId, documentId, tabId, rowId);
return deleteDocuments(ImmutableList.of(documentPath));
}
use of de.metas.ui.web.window.datatypes.DocumentPath in project metasfresh-webui-api by metasfresh.
the class WindowRestController method getDocumentActions.
@GetMapping("/{windowId}/{documentId}/actions")
public JSONDocumentActionsList getDocumentActions(@PathVariable("windowId") final String windowIdStr, @PathVariable("documentId") final String documentIdStr, @RequestParam(name = "selectedTabId", required = false) final String selectedTabIdStr, @RequestParam(name = "selectedRowIds", required = false) final String selectedRowIdsAsStr, @RequestParam(name = "disabled", defaultValue = "false") final boolean returnDisabled) {
final WindowId windowId = WindowId.fromJson(windowIdStr);
final DocumentPath rootDocumentPath = DocumentPath.rootDocumentPath(windowId, documentIdStr);
final DetailId selectedTabId = DetailId.fromJson(selectedTabIdStr);
final DocumentIdsSelection selectedRowIds = DocumentIdsSelection.ofCommaSeparatedString(selectedRowIdsAsStr);
final Set<TableRecordReference> selectedIncludedRecords = selectedRowIds.stream().map(rowId -> rootDocumentPath.createChildPath(selectedTabId, rowId)).map(documentCollection::getTableRecordReference).collect(ImmutableSet.toImmutableSet());
return getDocumentActions(rootDocumentPath, selectedTabId, selectedIncludedRecords, returnDisabled, DisplayPlace.SingleDocumentActionsMenu);
}
use of de.metas.ui.web.window.datatypes.DocumentPath in project metasfresh-webui-api by metasfresh.
the class WindowRestController method getDocumentFieldZoomInto.
private JSONZoomInto getDocumentFieldZoomInto(final DocumentPath documentPath, final String fieldName) {
userSession.assertLoggedIn();
final JSONDocumentPath jsonZoomIntoDocumentPath;
final DocumentZoomIntoInfo zoomIntoInfo = documentCollection.forDocumentReadonly(documentPath, document -> getDocumentFieldZoomInto(document, fieldName));
if (zoomIntoInfo == null) {
throw new EntityNotFoundException("ZoomInto not supported").setParameter("documentPath", documentPath).setParameter("fieldName", fieldName);
} else if (!zoomIntoInfo.isRecordIdPresent()) {
final WindowId windowId = documentCollection.getWindowId(zoomIntoInfo);
jsonZoomIntoDocumentPath = JSONDocumentPath.newWindowRecord(windowId);
} else {
final DocumentPath zoomIntoDocumentPath = documentCollection.getDocumentPath(zoomIntoInfo);
jsonZoomIntoDocumentPath = JSONDocumentPath.ofWindowDocumentPath(zoomIntoDocumentPath);
}
return JSONZoomInto.builder().documentPath(jsonZoomIntoDocumentPath).source(JSONDocumentPath.ofWindowDocumentPath(documentPath, fieldName)).build();
}
use of de.metas.ui.web.window.datatypes.DocumentPath in project metasfresh-webui-api by metasfresh.
the class WindowRestController method getDocumentFieldTypeahead.
/**
* Typeahead for included document's field
*/
@GetMapping(value = "/{windowId}/{documentId}/{tabId}/{rowId}/field/{fieldName}/typeahead")
public JSONLookupValuesList getDocumentFieldTypeahead(//
@PathVariable("windowId") final String windowIdStr, //
@PathVariable("documentId") final String documentId, //
@PathVariable("tabId") final String tabId, //
@PathVariable("rowId") final String rowId, //
@PathVariable("fieldName") final String fieldName, //
@RequestParam(name = "query", required = true) final String query) {
final WindowId windowId = WindowId.fromJson(windowIdStr);
final DocumentPath documentPath = DocumentPath.includedDocumentPath(windowId, documentId, tabId, rowId);
return getDocumentFieldTypeahead(documentPath, fieldName, query);
}
use of de.metas.ui.web.window.datatypes.DocumentPath in project metasfresh-webui-api by metasfresh.
the class WindowRestController method getRootDocuments.
@GetMapping("/{windowId}/{documentId}")
public List<JSONDocument> getRootDocuments(@PathVariable("windowId") final String windowIdStr, @PathVariable("documentId") final String documentIdStr, @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, @RequestParam(name = "noTabs", required = false, defaultValue = "false") final boolean noTabs) {
final WindowId windowId = WindowId.fromJson(windowIdStr);
final DocumentPath documentPath = DocumentPath.rootDocumentPath(windowId, documentIdStr);
final JSONDocumentOptions jsonOpts = newJSONDocumentOptions().showOnlyFieldsListStr(fieldsListStr).showAdvancedFields(advanced).doNotFetchIncludedTabs(noTabs).build();
return getData(documentPath, DocumentQueryOrderByList.EMPTY, jsonOpts);
}
Aggregations