if ((p==null) || (changeRequested = false ))
{
doCancel(rundata, context);
return;
}
PortletConfig pc = p.getPortletConfig();
Profile profile = ((JetspeedRunData)rundata).getCustomizedProfile();
Entry entry = profile.getDocument().getEntryById(p.getID());
// Only update the security ref if the parent changed
if ((newSecurityParent != null))
{
boolean securityChanged = false;
SecurityReference currentSecurityRef = pc.getSecurityRef();
if (currentSecurityRef != null)
{
securityChanged = (newSecurityParent.equals(currentSecurityRef.getParent()) == false);
}
else
{
securityChanged = (newSecurityParent.trim().length() > 0);
}
if (securityChanged == true)
{
SecurityReference securityRef = null;
if ((newSecurityParent.trim().length() > 0))
{
securityRef = new BaseSecurityReference();
securityRef.setParent( newSecurityParent);
}
// Note: setting the portlet's config may not be a good idea -
// it might be used as the Portlet for other PSMLDocument Entries that
// have a different idea of security - and the caching of Portlets does
// NOT include security -ggolden.
pc.setSecurityRef(securityRef);
entry.setSecurityRef(securityRef);
madePcChange = true;
}
}
// Only update the skin if the name changed
if (newSkinName != null)
{
boolean skinChanged = false;
String currentSkinName = null;
if (pc.getSkin() != null)
currentSkinName = pc.getPortletSkin().getName();
if (currentSkinName != null)
{
skinChanged = (newSkinName.equals(currentSkinName) == false);
}
else
{
skinChanged = (newSkinName.trim().length() > 0);
}
if (skinChanged == true)
{
PortletSkin skin = null;
if ((newSkinName.trim().length() > 0))
{
skin = PortalToolkit.getSkin(newSkinName);
if (skin != null)
{
// Note: setting the portlet's config may not be a good idea -
// it might be used as the Portlet for other PSMLDocument Entries that
// have a different idea of skin - and the caching of Portlets does
// NOT include skin -ggolden.
pc.setPortletSkin(skin);
Skin psmlSkin = entry.getSkin();
if (psmlSkin == null)
{
entry.setSkin(new PsmlSkin());
}
entry.getSkin().setName(newSkinName);
}
else
{
Log.warn( "Unable to update skin for portlet entry " + entry.getId() + " because skin " + skin + " does not exist.");
}
}
else
{
// Note: setting the portlet's config may not be a good idea -
// it might be used as the Portlet for other PSMLDocument Entries that
// have a different idea of skin - and the caching of Portlets does
// NOT include skin -ggolden.
pc.setPortletSkin( null);
entry.setSkin(null);
}
madePcChange = true;
}
}
// Only update the title if the title changed
if (newTitle != null)
{
boolean titleChanged = false;
String currentTitle = entry.getTitle();
MetaData md = pc.getMetainfo();
if (currentTitle == null && md != null && md.getTitle() != null)
currentTitle = md.getTitle();
if (currentTitle != null)
{
titleChanged = (newTitle.equals(currentTitle) == false);
}
else
{
titleChanged = (newTitle.trim().length() > 0);
}
if (titleChanged == true)
{
if ((newTitle.trim().length() > 0))
{
// Note: setting the portlet's config may not be a good idea -
// it might be used as the Portlet for other PSMLDocument Entries that
// have a different idea of title - and the caching of Portlets does
// NOT include title -ggolden.
if (md == null) {
md = new MetaData();
pc.setMetainfo(md);
}
md.setTitle(newTitle);
entry.setTitle(newTitle);
madePcChange = true;
}