if ( (displayName != null) && (displayName.equals(appName)) )
found = true;
}
if (!found) {
for (Iterator iter = definitionList.iterator(); !found && iter.hasNext();) {
PortletApplicationDefinition portletApp = (PortletApplicationDefinition)iter.next();
if (portletApp.getId().toString().equals(appName)) {
//PortletApplicationEntityListCtrl appEntityListCtrl = (PortletApplicationEntityListCtrl)ControllerObjectAccess.get(entityList);
PortletApplicationEntityListCtrl appEntityListCtrl = (PortletApplicationEntityListCtrl)entityList;
appEntity = appEntityListCtrl.add(portletApp.getId().toString());
log("added Portlet Application " + appName + " to PortletEntityRegistry");
found = true;
}
}
}
if ( !found ) {
log("Portlet Application "+appName+" not found!");
throw new ServletException("Portlet Application "+appName+" not found!");
}
portletIt = appEntity.getPortletEntityList().iterator();
PortletEntity portlet = null;
// search for portlet
found = false;
while ( portletIt.hasNext() && ! found ) {
portlet = (PortletEntity) portletIt.next();
PortletDefinition tmpPortletDef = portlet.getPortletDefinition();
if ( tmpPortletDef == null ) {
log("ERROR: Portlet definition of portlet enity (id="+portlet.getId()+") not found!");
log(" Portlet may not be defined in portlet.xml!");
throw new ServletException("Portlet definition of portlet enity (id="+portlet.getId()+") not found!");
}
String tmpPortletName = tmpPortletDef.getName();
//delete all existing preferences for this portlet entity
if (tmpPortletName != null && tmpPortletName.equals(portletName)) {
for (Iterator iter = portlet.getPreferenceSet().iterator(); iter.hasNext();) {
iter.next();
iter.remove();
}
found = true;
}
}
if (!found) {
for (Iterator appIter = definitionList.iterator(); !found && appIter.hasNext();) {
PortletApplicationDefinition appDef = (PortletApplicationDefinition)appIter.next();
if (appDef.getId().toString().equals(appName)) {
for (Iterator portletIter = appDef.getPortletDefinitionList().iterator(); !found && portletIter.hasNext();) {
PortletDefinition portletDef = (PortletDefinition)portletIter.next();
if (portletDef.getId().toString().equals(appName + "." + portletName)) {
//PortletEntityListCtrl entityListCtrl = (PortletEntityListCtrl)ControllerObjectAccess.get(appEntity.getPortletEntityList());
PortletEntityListCtrl entityListCtrl = (PortletEntityListCtrl)appEntity.getPortletEntityList();
portlet = entityListCtrl.add(appEntity, portletDef.getId().toString());