if (request.getPortletMode() == PortletMode.VIEW)
{
String selected = request.getParameter("role");
if (selected != null)
{
Role role = lookupRole(selected);
if (role != null)
{
PortletMessaging.publish(request, "role", "selected", selected);
PortletMessaging.publish(request, "role", "change", selected);
}
}
String refresh = request.getParameter("role.refresh");
String save = request.getParameter("role.save");
String neue = request.getParameter("role.new");
String delete = request.getParameter("roleDelete");
if (refresh != null)
{
this.clearBrowserIterator(request);
}
else if (neue != null)
{
PortletMessaging.cancel(request, "role", "selected");
}
else if (delete != null && (!(isEmpty(delete))))
{
try
{
Role role = lookupRole(delete);
if (role != null)
{
roleManager.removeRole(delete);
this.clearBrowserIterator(request);
PortletMessaging.cancel(request, "role", "selected");
PortletMessaging.publish(request, SecurityResources.USER_BROWSER, "roles", "refresh");
}
}
catch (Exception e)
{
publishStatusMessage(request, "RoleBrowser", "status", e, "Could not remove role");
}
}
else if (save != null)
{
String roleName = request.getParameter("role.name");
if (!(isEmpty(roleName)))
{
try
{
Role role = null;
String old = (String)PortletMessaging.receive(request, "role", "selected");
if (old != null)
{
role = lookupRole(old);
}