use of de.metas.ui.web.menu.datatypes.json.JSONMenuNodeType in project metasfresh-webui-api by metasfresh.
the class MenuRestController method getPath.
@GetMapping("/elementPath")
public JSONMenuNode getPath(@RequestParam(name = PARAM_Type, required = true) final JSONMenuNodeType jsonType, @RequestParam(name = PARAM_ElementId, required = true) final String elementIdStr, @RequestParam(name = PARAM_IncludeLastNode, required = false, defaultValue = "false") @ApiParam("Shall we include the last node") final boolean includeLastNode) {
userSession.assertLoggedIn();
final MenuNodeType menuNodeType = jsonType.toMenuNodeType();
final DocumentId elementId = DocumentId.of(elementIdStr);
final List<MenuNode> path = getMenuTree().getPath(menuNodeType, elementId).orElseGet(() -> getPathOfMissingElement(menuNodeType, elementId, userSession.getAD_Language()));
final boolean skipRootNode = true;
return JSONMenuNode.ofPath(path, skipRootNode, includeLastNode, menuTreeRepository);
}
Aggregations