if (request.getPortletMode() == PortletMode.VIEW)
{
String selectedSite = request.getParameter("ssoSite");
if (selectedSite != null)
{
SSOSite site = sso.getSite(selectedSite);
if (site != null)
{
PortletMessaging.publish(request, "site", "selectedUrl", selectedSite);
PortletMessaging.publish(request, "site", "selectedName", site.getName());
PortletMessaging.publish(request, "site", "change", selectedSite);
}
}
String refresh = request.getParameter("sso.refresh");
String save = request.getParameter("sso.save");
String neue = request.getParameter("sso.new");
String delete = request.getParameter("ssoDelete");
if (refresh != null)
{
this.clearBrowserIterator(request);
}
else if (neue != null)
{
PortletMessaging.cancel(request, "site", "selected");
PortletMessaging.cancel(request, "site", "selectedUrl");
}
else if (delete != null && (!(isEmpty(delete))))
{
try
{
SSOSite site = null;
site = sso.getSite(delete);
if (site != null)
{
sso.removeSite(site);
this.clearBrowserIterator(request);
PortletMessaging.cancel(request, "site", "selected");
PortletMessaging.cancel(request, "site", "selectedUrl");
}
}
catch (SSOException e)
{
publishStatusMessage(request, "SSOBrowser", "status", e, "Could not remove site");
}
}
else if (save != null)
{
String siteName = request.getParameter("site.name");
String siteUrl = request.getParameter("site.url");
if (!(isEmpty(siteName) || isEmpty(siteUrl)))
{
try
{
SSOSite site = null;
String old = (String)PortletMessaging.receive(request, "site", "selectedUrl");
if (old != null)
{
site = sso.getSite(old);
}
else
{
site = sso.getSite(siteUrl);
}
if (site != null)
{
site.setName(siteName);
site.setSiteURL(siteUrl);
sso.updateSite(site);
this.clearBrowserIterator(request);
PortletMessaging.publish(request, "site", "selectedName", siteName);
PortletMessaging.publish(request, "site", "selectedUrl", siteUrl);
}