use of org.jaffa.components.navigation.domain.MenuOption in project jaffa-framework by jaffa-projects.
the class NavAccessor method parseMenuOptions.
/**
* @return the number of menu items added under this option
*/
int parseMenuOptions(List menuOptions, List navOptions) {
int counter = 0;
for (Iterator it = menuOptions.iterator(); it.hasNext(); ) {
MenuOption mOpt = (MenuOption) it.next();
try {
NavOption nOpt = new NavOption(this, mOpt);
navOptions.add(nOpt);
counter++;
if (log.isDebugEnabled())
log.debug("Added Option - " + nOpt.getLabel());
} catch (SecurityException se) {
if (log.isDebugEnabled())
log.debug("Access Denied to Menu Option " + mOpt.getLabel());
}
}
return counter;
}
use of org.jaffa.components.navigation.domain.MenuOption in project jaffa-framework by jaffa-projects.
the class NavigationXmlLoadTest method testNavigationRegistration.
/**
* testNavigationRegistration - Verifies that the navigation.xml has been loaded correctly into the NavigationManager.
*/
@Test
public void testNavigationRegistration() {
NavigationManager navigationManager = xmlLoaderConfig.getBean(NavigationManager.class);
ContextKey key = new ContextKey("CONTRACTOR", "roles.xml", "DEF", "100-Highest");
assertNull(navigationManager.getNavigationRepository().query(key));
GlobalMenu globalMenu = new GlobalMenu();
MenuOption menuOption = new MenuOption();
menuOption.setLabel("Label 1");
globalMenu.getMenuOption().add(menuOption);
navigationManager.registerGlobalMenu(key, globalMenu);
assertNotNull(navigationManager.getNavigationRepository().query(key));
navigationManager.unregisterGlobalMenu(key);
assertNull(navigationManager.getNavigationRepository().query(key));
}
Aggregations