1 16 package org.apache.cocoon.portal.pluto.om; 17 18 import java.util.HashMap ; 19 import java.util.Iterator ; 20 import java.util.Map ; 21 22 import org.apache.cocoon.portal.coplet.CopletInstanceData; 23 import org.apache.cocoon.portal.pluto.om.common.ObjectIDImpl; 24 import org.apache.pluto.om.common.ObjectID; 25 import org.apache.pluto.om.entity.PortletApplicationEntity; 26 import org.apache.pluto.om.entity.PortletEntity; 27 import org.apache.pluto.om.entity.PortletEntityList; 28 import org.apache.pluto.om.entity.PortletEntityListCtrl; 29 import org.apache.pluto.om.portlet.PortletDefinition; 30 31 38 public class PortletEntityListImpl 39 implements PortletEntityList, PortletEntityListCtrl { 40 41 42 protected Map portlets = new HashMap (); 43 44 47 public PortletEntity get(ObjectID objectId) { 48 return (PortletEntity)this.portlets.get(objectId); 49 } 50 51 52 55 public Iterator iterator() { 56 return this.portlets.values().iterator(); 57 } 58 59 62 public PortletEntity add(PortletApplicationEntity appEntity, String definitionId) { 63 PortletDefinitionRegistry registry = null; 65 PortletDefinition pd = registry.getPortletDefinition(ObjectIDImpl.createFromString(definitionId)); 66 PortletApplicationEntity pae = registry.getPortletApplicationEntityList().get(ObjectIDImpl.createFromString("cocoon")); 67 CopletInstanceData coplet = null; 68 PortletEntity portletEntity = new PortletEntityImpl(pae, coplet, pd, registry.getPortalService()); 69 this.portlets.put(portletEntity.getId(), portletEntity); 70 71 return portletEntity; 72 } 73 74 77 public PortletEntity add(PortletApplicationEntity appEntity, 78 String definitionId, 79 CopletInstanceData coplet, 80 PortletDefinitionRegistry registry) { 81 PortletDefinition pd = registry.getPortletDefinition(ObjectIDImpl.createFromString(definitionId)); 82 PortletEntity portletEntity = new PortletEntityImpl(appEntity, coplet, pd, registry.getPortalService()); 83 this.portlets.put(portletEntity.getId(), portletEntity); 84 85 return portletEntity; 86 } 87 88 91 public void remove(PortletEntity entity) { 92 if ( entity != null ) { 93 this.portlets.remove(entity.getId()); 94 } 95 } 96 } 97 | Popular Tags |