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);
}
Aggregations