{
String portletName =
rundata.getParameters().getString(PORTLET_NAME);
if (portletName == null || portletName.length() == 0)
{
JetspeedLink link = JetspeedLinkFactory.getInstance(rundata);
DynamicURI duri =
link
.getPaneByName(PORTLET_UPDATE_PANE)
.addPathInfo(
SecurityConstants.PARAM_MODE,
SecurityConstants.PARAM_MODE_INSERT)
.addPathInfo(
SecurityConstants.PARAM_MSGID,
SecurityConstants.MID_INVALID_ENTITY_NAME);
JetspeedLinkFactory.putInstance(link);
rundata.setRedirectURI(duri.toString());
resetForm(rundata);
}
else
{
PortletEntry existingEntry =
(PortletEntry) Registry.getEntry(
Registry.PORTLET,
portletName);
if (existingEntry != null)
{
throw new EntityExistsException(
"PortletEntry: " + portletName + " Already Exists!");
}
PortletEntry portletEntry = new BasePortletEntry();
portletEntry.setName(portletName);
setPortletEntryInfo(rundata, portletEntry);
Registry.addEntry(Registry.PORTLET, portletEntry);
}
}
catch (EntityExistsException e)
{
//
// dup key found - display error message - bring back to same screen
//
JetspeedLink link = JetspeedLinkFactory.getInstance(rundata);
DynamicURI duri =
link
.getPaneByName(PORTLET_UPDATE_PANE)
.addPathInfo(
SecurityConstants.PARAM_MODE,
SecurityConstants.PARAM_MODE_INSERT)
.addPathInfo(
SecurityConstants.PARAM_MSGID,
SecurityConstants.MID_ENTITY_ALREADY_EXISTS);
JetspeedLinkFactory.putInstance(link);
rundata.setRedirectURI(duri.toString());
resetForm(rundata);
}
catch (Exception e)
{
JetspeedLink link = JetspeedLinkFactory.getInstance(rundata);
DynamicURI duri =
link
.getPaneByName(PORTLET_UPDATE_PANE)
.addPathInfo(
SecurityConstants.PARAM_MODE,
SecurityConstants.PARAM_MODE_INSERT)
.addPathInfo(