use of de.metas.ui.web.window.datatypes.DocumentPath in project metasfresh-webui-api by metasfresh.
the class WindowRestController method getIncludedTabRows.
@GetMapping("/{windowId}/{documentId}/{tabId}")
public List<JSONDocument> getIncludedTabRows(@PathVariable("windowId") final String windowIdStr, @PathVariable("documentId") final String documentIdStr, @PathVariable("tabId") final String tabIdStr, @RequestParam(name = "ids", required = false) @ApiParam("comma separated rowIds") final String rowIdsListStr, @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 = "orderBy", required = false) final String orderBysListStr) {
final WindowId windowId = WindowId.fromJson(windowIdStr);
final DocumentId documentId = DocumentId.of(documentIdStr);
final DetailId tabId = DetailId.fromJson(tabIdStr);
final DocumentIdsSelection onlyRowIds = DocumentIdsSelection.ofCommaSeparatedString(rowIdsListStr);
final DocumentPath documentPath;
if (onlyRowIds.isEmpty() || onlyRowIds.isAll()) {
documentPath = DocumentPath.includedDocumentPath(windowId, documentId, tabId);
} else {
documentPath = DocumentPath.includedDocumentPath(windowId, documentId, tabId, onlyRowIds);
}
final DocumentQueryOrderByList orderBys = DocumentQueryOrderByList.parse(orderBysListStr);
final JSONDocumentOptions jsonOpts = newJSONDocumentOptions().showOnlyFieldsListStr(fieldsListStr).showAdvancedFields(advanced).build();
return getData(documentPath, orderBys, jsonOpts);
}
use of de.metas.ui.web.window.datatypes.DocumentPath in project metasfresh-webui-api by metasfresh.
the class WindowRestController method duplicate.
@PostMapping("/{windowId}/{documentId}/duplicate")
public JSONDocument duplicate(@PathVariable("windowId") final String windowIdStr, @PathVariable("documentId") final String documentIdStr, @RequestParam(name = PARAM_Advanced, required = false, defaultValue = PARAM_Advanced_DefaultValue) final boolean advanced) {
userSession.assertLoggedIn();
final DocumentPath fromDocumentPath = DocumentPath.rootDocumentPath(WindowId.fromJson(windowIdStr), DocumentId.of(documentIdStr));
final Document documentCopy = documentCollection.duplicateDocument(fromDocumentPath);
final JSONDocumentOptions jsonOpts = newJSONDocumentOptions().showAdvancedFields(advanced).build();
return JSONDocument.ofDocument(documentCopy, jsonOpts);
}
use of de.metas.ui.web.window.datatypes.DocumentPath 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 DetailId selectedTabId = DetailId.fromJson(tabIdStr);
final DocumentPath includedDocumentPath = DocumentPath.includedDocumentPath(windowId, documentIdStr, selectedTabId.toJson(), rowIdStr);
final Set<TableRecordReference> selectedIncludedRecords = ImmutableSet.of();
return getDocumentActions(includedDocumentPath, selectedTabId, selectedIncludedRecords, returnDisabled, DisplayPlace.SingleDocumentActionsMenu);
}
use of de.metas.ui.web.window.datatypes.DocumentPath 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(CollectionUtils.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.DocumentPath in project metasfresh-webui-api by metasfresh.
the class WindowRestController method getDocumentChangeLog.
@GetMapping("/{windowId}/{documentId}/changeLog")
public JSONDocumentChangeLog getDocumentChangeLog(@PathVariable("windowId") final String windowIdStr, @PathVariable("documentId") final String documentIdStr) {
final WindowId windowId = WindowId.fromJson(windowIdStr);
final DocumentPath documentPath = DocumentPath.rootDocumentPath(windowId, documentIdStr);
return getDocumentChangeLog(documentPath);
}
Aggregations