session.setAttribute(ZeroConstants.MENU_KEY, menu);
} else {
log.debug("menu found in session");
}
if (menu.getSelected() == null) {
MenuItem priorityItem = findMenuItemPriority(menu);
if (priorityItem == null || priorityItem.getPriority() <= 1) {
if (!menu.getItems().isEmpty()) {
Iterator<MenuItem> it = menu.getItems().iterator();
MenuItem item = it.next();
log.debug(item.getAction() + Boolean.toString(item.isJsp()));
// skip redirects
while (it.hasNext() && item.isJsp()) {
log.debug(item.getAction() + Boolean.toString(item.isJsp()));
item = it.next();
}
log.debug(item.getAction() + Boolean.toString(item.isJsp()));
menu.select(item.getAction());
} else {
log.debug("no menus found");
}
} else {
log.debug("priorityItem: " + priorityItem.getPriority());
menu.select(priorityItem.getAction());
}
}
if (menuAction != null && !menuAction.equals("")) {
menu.select(menuAction);
}
JSONArray jmenu = new JSONArray();
view.getJson().element("menu", jmenu);
createMenu(jmenu, menu.getItems());
JSONArray jmenu2 = new JSONArray();
JSONArray jmenu3 = new JSONArray();
for (MenuItem item : menu.getItems()) {
if (item.isSelected()) {
view.getJson().element("menu2", jmenu2);
createMenu(jmenu2, item.getItems());
for (MenuItem item2 : item.getItems()) {
if (item2.isSelected()) {
view.getJson().element("menu3", jmenu3);
createMenu(jmenu3, item2.getItems());
}
}