if (portletConfiguration == null)
throw new AssertException("No portlet configuration found for portlet::" + portletName + " in portal::" + this.name);
// add portal and portlet name to configuration
portletConfiguration.put("portalName", this.name);
portletConfiguration.put("id", portletName);
PortletContainer pc = PortletFactory.getPortletContainerFor(portletConfiguration, getWindowControl(), ureq);
pc.addControllerListener(this);
// remember this portlet container
this.portletContainers.put(portletName, pc);
String addLinkName = "command.add." + portletName;
Link tmp = LinkFactory.createCustomLink(addLinkName, addLinkName, "add", Link.BUTTON_XSMALL, portalVC, this);
tmp.setUserObject(portletName);
// and add to velocity
this.portalVC.put(portletName, pc.getInitialComponent());
// check if portlet is active for this user
Iterator colIter = this.portalColumns.iterator();
boolean isActive = false;
while (colIter.hasNext()) {
List row = (List) colIter.next();
Iterator rowIter = row.iterator();
while (rowIter.hasNext()) {
String activePortletName = (String) rowIter.next();
if (portletName.equals(activePortletName)) isActive = true;
}
}
if (isActive) {
// initialize portlet container for active portlets only
pc.initializeRunComponent(ureq);
} else {
// add it to inacitve portlets list if not active
inactivePortlets.add(portletName);
}
}