use of de.metas.ui.web.menu.exception.NoMenuNodesFoundException in project metasfresh-webui-api by metasfresh.
the class MenuRestController method query.
@GetMapping("/queryPaths")
public JSONMenuNode query(@RequestParam(name = PARAM_NameQuery, required = true) final String nameQuery, @RequestParam(name = PARAM_ChildrenLimit, required = false, defaultValue = "0") final int childrenLimit, @RequestParam(name = "childrenInclusive", required = false, defaultValue = "false") @ApiParam("true if groups that were matched shall be populated with it's leafs, even if those leafs are not matching") final boolean includeLeafsIfGroupAccepted) {
userSession.assertLoggedIn();
final MenuNode rootFiltered = getMenuTree().filter(nameQuery, includeLeafsIfGroupAccepted);
if (rootFiltered == null) {
throw new NoMenuNodesFoundException();
}
if (rootFiltered.getChildren().isEmpty()) {
throw new NoMenuNodesFoundException();
}
return JSONMenuNode.builder(rootFiltered).setMaxLeafNodes(childrenLimit).setIsFavoriteProvider(menuTreeRepository).build();
}
Aggregations