// Get categories for side menu
List<Category> categories = userService.getCategoriesForUser(user, deviceType, SortOrder.ASCENDING);
List<MenuItem> categoryMenuItems = new ArrayList<MenuItem>();
if (categories != null) {
for (Category category : categories) {
MenuItem menuItem = new MenuItem(category.getName(), category.getId());
categoryMenuItems.add(menuItem);
}
}
modelAndView.getModel().put("categoryMenuItems", categoryMenuItems);
// Get groups for side menu
List<MenuItem> groupMenuItems = new ArrayList<MenuItem>();
List<Group> groups = userService.getGroupsForActiveOrganization(user, SortOrder.ASCENDING);
if (groups != null) {
for (Group group : groups) {
MenuItem groupModel = new MenuItem(group.getName(), group.getId());
groupMenuItems.add(groupModel);
}
}
modelAndView.getModel().put("groupMenuItems", groupMenuItems);