public void addConfigAttribute(Role role) throws Exception{
if(ValidationUtil.validateList(role.getOpcionesMenu())){
Collection<ConfigAttribute> catts = new HashSet<ConfigAttribute>();
catts.add(new SecurityConfig(role.getName()));
allCfgattrs.addAll(catts);
Iterator<String> ite = resourceMap.keySet().iterator();
while (ite.hasNext()) {
String deMenu = ite.next();
Collection<ConfigAttribute> configAtt = resourceMap.get(deMenu);
if (configAtt.contains(new SecurityConfig(role.getName()))) {
configAtt.remove(new SecurityConfig(role.getName()));
resourceMap.put(deMenu, configAtt);
}
}
for(Iterator<OpcionMenu> iter = role.getOpcionesMenu().iterator(); iter.hasNext(); ){
OpcionMenu opcionMenu = iter.next();
String deMenuHtml = opcionMenu.getDeMenuHtml();
if(deMenuHtml != null && (opcionMenu.isStElegido() ||
Constants.URL_LOGOUT.equalsIgnoreCase(deMenuHtml) ||
Constants.URL_MAIN_MENU.equalsIgnoreCase(deMenuHtml))){
if(!deMenuHtml.startsWith("/"))
deMenuHtml = "/"+deMenuHtml;
Collection<ConfigAttribute> roleConfig = resourceMap.get(deMenuHtml);
if(roleConfig == null){
resourceMap.put(deMenuHtml, catts);
}else{
roleConfig.add(new SecurityConfig(role.getName()));
resourceMap.put(deMenuHtml, roleConfig);
}
}
}
}