});
try
{
// Create an empty portlet container
Portlets portlets = new PsmlPortlets();
Control control = new PsmlControl();
control.setName(this.groupmergeControl);
portlets.setControl(control);
Controller controller = new PsmlController();
controller.setName(this.groupmergeController);
portlets.setController(controller);
// Set title
portlets.setTitle("Home Page");
// Set the skin
Skin skin = new PsmlSkin();
skin.setName(PortalToolkit.getSkin((String) null).getName());
portlets.setSkin(skin);
// Set top level security ref
if (groupmergeSecurityref != null)
{
SecurityEntry entry =
(SecurityEntry) Registry.getEntry(
Registry.SECURITY,
groupmergeSecurityref);
if (entry != null)
{
SecurityReference ref = new BaseSecurityReference();
ref.setParent(entry.getName());
portlets.setSecurityRef(ref);
}
}
String mediaType = null;
// Process each group profile
int paneCount = 0;
for (Iterator it = profiles.iterator(); it.hasNext();)
{
Profile groupProfile = (Profile) it.next();
mediaType =
mediaType == null
? groupProfile.getMediaType()
: mediaType;
Profile tmpProfile = (Profile) groupProfile.clone();
Portlets tmpPortlets =
tmpProfile.getDocument().getPortlets();
// If topmost control is a tab control, then add each tab to the container
Control paneControl = tmpPortlets.getControl();
if (paneControl != null
&& paneControl.getName().equals(this.groupmergeControl))
{
for (int i = 0;
i < tmpPortlets.getPortletsCount();
i++)
{
Portlets pane = tmpPortlets.getPortlets(i);
pane.setLayout(null);
portlets.addPortlets(pane);
paneCount++;
}
}
// Otherwise, add the contents of profile as a pane
else
{
if (tmpPortlets.getTitle() == null)
{
String title =
org
.apache
.turbine
.util
.StringUtils
.firstLetterCaps(
groupProfile.getRoleName());
tmpPortlets.setTitle(title + " Home");
}
tmpPortlets.setLayout(null);
portlets.addPortlets(tmpPortlets);
paneCount++;
}
if (logger.isDebugEnabled())
{