Search in sources :

Example 1 with JSONDocumentOptions

use of de.metas.ui.web.window.datatypes.json.JSONDocumentOptions in project metasfresh-webui-api by metasfresh.

the class ETagResponseEntityBuilder method getJSONDocumentOptions.

private JSONDocumentOptions getJSONDocumentOptions() {
    final Supplier<JSONDocumentOptions> jsonDocumentOptionsSupplier = this._jsonDocumentOptionsSupplier;
    if (jsonDocumentOptionsSupplier == null) {
        throw new IllegalStateException("jsonDocumentOptions suppliere not configured");
    }
    final JSONDocumentOptions jsonDocumentOptions = jsonDocumentOptionsSupplier.get();
    if (jsonDocumentOptions == null) {
        throw new IllegalStateException("jsonDocumentOptions not configured");
    }
    return jsonDocumentOptions;
}
Also used : JSONDocumentOptions(de.metas.ui.web.window.datatypes.json.JSONDocumentOptions)

Example 2 with JSONDocumentOptions

use of de.metas.ui.web.window.datatypes.json.JSONDocumentOptions in project metasfresh-webui-api by metasfresh.

the class WindowRestController method patchDocument.

private List<JSONDocument> patchDocument(final DocumentPath documentPath, final boolean advanced, final List<JSONDocumentChangedEvent> events) {
    userSession.assertLoggedIn();
    final JSONDocumentOptions jsonOpts = newJSONDocumentOptions().showAdvancedFields(advanced).build();
    return Execution.callInNewExecution("window.commit", () -> patchDocument0(documentPath, events, jsonOpts));
}
Also used : JSONDocumentOptions(de.metas.ui.web.window.datatypes.json.JSONDocumentOptions)

Example 3 with JSONDocumentOptions

use of de.metas.ui.web.window.datatypes.json.JSONDocumentOptions in project metasfresh-webui-api by metasfresh.

the class WindowRestController method getIncludedTabRow.

@GetMapping("/{windowId}/{documentId}/{tabId}/{rowId}")
public List<JSONDocument> getIncludedTabRow(// 
@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 JSONDocumentOptions jsonOpts = newJSONDocumentOptions().showOnlyFieldsListStr(fieldsListStr).showAdvancedFields(advanced).build();
    return getData(documentPath, DocumentQueryOrderByList.EMPTY, jsonOpts);
}
Also used : WindowId(de.metas.ui.web.window.datatypes.WindowId) DocumentPath(de.metas.ui.web.window.datatypes.DocumentPath) JSONDocumentPath(de.metas.ui.web.window.datatypes.json.JSONDocumentPath) JSONDocumentOptions(de.metas.ui.web.window.datatypes.json.JSONDocumentOptions) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 4 with JSONDocumentOptions

use of de.metas.ui.web.window.datatypes.json.JSONDocumentOptions in project metasfresh-webui-api by metasfresh.

the class WindowRestController method deleteDocuments.

private List<JSONDocument> deleteDocuments(final List<DocumentPath> documentPaths) {
    userSession.assertLoggedIn();
    final JSONDocumentOptions jsonOpts = newJSONDocumentOptions().showAdvancedFields(false).build();
    return Execution.callInNewExecution("window.delete", () -> {
        final IDocumentChangesCollector changesCollector = Execution.getCurrentDocumentChangesCollectorOrNull();
        documentCollection.deleteAll(documentPaths, changesCollector);
        return JSONDocument.ofEvents(changesCollector, jsonOpts);
    });
}
Also used : IDocumentChangesCollector(de.metas.ui.web.window.model.IDocumentChangesCollector) JSONDocumentOptions(de.metas.ui.web.window.datatypes.json.JSONDocumentOptions)

Example 5 with JSONDocumentOptions

use of de.metas.ui.web.window.datatypes.json.JSONDocumentOptions 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);
}
Also used : WindowId(de.metas.ui.web.window.datatypes.WindowId) DocumentPath(de.metas.ui.web.window.datatypes.DocumentPath) JSONDocumentPath(de.metas.ui.web.window.datatypes.json.JSONDocumentPath) JSONDocumentOptions(de.metas.ui.web.window.datatypes.json.JSONDocumentOptions) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Aggregations

JSONDocumentOptions (de.metas.ui.web.window.datatypes.json.JSONDocumentOptions)7 DocumentPath (de.metas.ui.web.window.datatypes.DocumentPath)4 JSONDocumentPath (de.metas.ui.web.window.datatypes.json.JSONDocumentPath)4 WindowId (de.metas.ui.web.window.datatypes.WindowId)3 GetMapping (org.springframework.web.bind.annotation.GetMapping)3 DocumentId (de.metas.ui.web.window.datatypes.DocumentId)1 DocumentIdsSelection (de.metas.ui.web.window.datatypes.DocumentIdsSelection)1 JSONDocument (de.metas.ui.web.window.datatypes.json.JSONDocument)1 DetailId (de.metas.ui.web.window.descriptor.DetailId)1 Document (de.metas.ui.web.window.model.Document)1 DocumentQueryOrderByList (de.metas.ui.web.window.model.DocumentQueryOrderByList)1 IDocumentChangesCollector (de.metas.ui.web.window.model.IDocumentChangesCollector)1 PostMapping (org.springframework.web.bind.annotation.PostMapping)1