Search in sources :

Example 1 with MenuNodeType

use of de.metas.ui.web.menu.MenuNode.MenuNodeType 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);
}
Also used : MenuNodeType(de.metas.ui.web.menu.MenuNode.MenuNodeType) JSONMenuNodeType(de.metas.ui.web.menu.datatypes.json.JSONMenuNodeType) DocumentId(de.metas.ui.web.window.datatypes.DocumentId) JSONMenuNode(de.metas.ui.web.menu.datatypes.json.JSONMenuNode) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Aggregations

MenuNodeType (de.metas.ui.web.menu.MenuNode.MenuNodeType)1 JSONMenuNode (de.metas.ui.web.menu.datatypes.json.JSONMenuNode)1 JSONMenuNodeType (de.metas.ui.web.menu.datatypes.json.JSONMenuNodeType)1 DocumentId (de.metas.ui.web.window.datatypes.DocumentId)1 GetMapping (org.springframework.web.bind.annotation.GetMapping)1