*/
public void addRole()
{
ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
Map appMap = (Map) externalContext.getApplicationMap();
RoleManager roleMgr = (RoleManager) appMap.get(CommonPortletServices.CPS_ROLE_MANAGER_COMPONENT);
try
{
String roleToAddPath = getRoleName();
// If the role to add is relative to a selected parent.
if (!getParentRole().getRoleName().equals(DEFAULT_PARENT_ROLE_NAME))
{
roleToAddPath = getParentRole().getRoleName() + "." + roleToAddPath;
}
if (log.isDebugEnabled())
{
log.debug("Adding role: " + roleToAddPath);
}
// Add role.
roleMgr.addRole(roleToAddPath);
// Get the newly added role.
Role addedRole = roleMgr.getRole(roleToAddPath);
// Resolve the tree table.
FacesContext facesContext = FacesContext.getCurrentInstance();
VariableResolver vr = facesContext.getApplication().getVariableResolver();
RoleTreeTable roleTree = (RoleTreeTable) vr.resolveVariable(facesContext, RoleTreeTable.ROLE_TREE_TABLE);
// Get the listeners registered.