Search in sources :

Example 1 with JSONDocumentLayout

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

the class WindowRestController method getLayout.

@GetMapping("/{windowId}/{tabId}/layout")
public ResponseEntity<JSONDocumentLayout> getLayout(@PathVariable("windowId") final String windowIdStr, @PathVariable("tabId") final String tabIdStr, @RequestParam(name = PARAM_Advanced, required = false, defaultValue = PARAM_Advanced_DefaultValue) final boolean advanced, final WebRequest request) {
    userSession.assertLoggedIn();
    final WindowId windowId = WindowId.fromJson(windowIdStr);
    final DetailId detailId = DetailId.fromJson(tabIdStr);
    final DocumentDescriptor descriptor = documentCollection.getDocumentDescriptorFactory().getDocumentDescriptor(windowId);
    DocumentPermissionsHelper.checkWindowAccess(descriptor.getEntityDescriptor(), userSession.getUserRolePermissions());
    return ETagResponseEntityBuilder.ofETagAware(request, descriptor).includeLanguageInETag().cacheMaxAge(userSession.getHttpCacheMaxAge()).map(desc -> desc.getLayout().getDetail(detailId)).jsonOptions(() -> newJSONOptions().setShowAdvancedFields(advanced).build()).toJson(JSONDocumentLayout::ofDetailTab);
}
Also used : DetailId(de.metas.ui.web.window.descriptor.DetailId) WindowId(de.metas.ui.web.window.datatypes.WindowId) JSONDocumentLayout(de.metas.ui.web.window.datatypes.json.JSONDocumentLayout) DocumentDescriptor(de.metas.ui.web.window.descriptor.DocumentDescriptor) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Aggregations

WindowId (de.metas.ui.web.window.datatypes.WindowId)1 JSONDocumentLayout (de.metas.ui.web.window.datatypes.json.JSONDocumentLayout)1 DetailId (de.metas.ui.web.window.descriptor.DetailId)1 DocumentDescriptor (de.metas.ui.web.window.descriptor.DocumentDescriptor)1 GetMapping (org.springframework.web.bind.annotation.GetMapping)1