1 16 package org.apache.cocoon.portal.pluto.om; 17 18 import java.util.Iterator ; 19 import java.util.Map ; 20 import java.util.Vector ; 21 22 import org.apache.cocoon.portal.pluto.om.common.AbstractSupportSet; 23 import org.apache.cocoon.portal.pluto.om.common.Support; 24 import org.apache.pluto.om.common.ObjectID; 25 import org.apache.pluto.om.portlet.PortletApplicationDefinition; 26 import org.apache.pluto.om.portlet.PortletDefinition; 27 import org.apache.pluto.om.portlet.PortletDefinitionList; 28 import org.apache.pluto.om.servlet.ServletDefinition; 29 30 37 public class PortletDefinitionListImpl extends AbstractSupportSet 38 implements PortletDefinitionList, java.io.Serializable , Support { 39 40 42 public PortletDefinition get(ObjectID objectId) { 43 Iterator iterator = this.iterator(); 44 while (iterator.hasNext()) { 45 PortletDefinition portletDefinition = (PortletDefinition)iterator.next(); 46 if (portletDefinition.getId().equals(objectId)) { 47 return portletDefinition; 48 } 49 } 50 return null; 51 } 52 53 55 public void preBuild(Object parameter) throws Exception { 56 Vector structure = (Vector )parameter; 57 PortletApplicationDefinition portletApplication = (PortletApplicationDefinition)structure.get(0); 58 Map servletMap = (Map )structure.get(1); 59 60 Iterator iterator = this.iterator(); 61 while (iterator.hasNext()) { 62 PortletDefinition portlet = (PortletDefinition)iterator.next(); 63 64 ((Support)portlet).preBuild(portletApplication); 65 66 ServletDefinition servlet = null; 67 if (servletMap != null) { 68 servlet = (ServletDefinition)servletMap.get(portlet.getId().toString()); 69 } 70 71 ((Support)portlet).postBuild(servlet); 72 73 } 74 } 75 76 77 public void postBuild(Object parameter) throws Exception { 78 } 80 81 public void postLoad(Object parameter) throws Exception { 82 Iterator iterator = this.iterator(); 83 while (iterator.hasNext()) { 84 ((PortletDefinitionImpl)iterator.next()).postLoad(parameter); 85 } 86 } 87 88 public void postStore(Object parameter) throws Exception { 89 } 91 92 public void preStore(Object parameter) throws Exception { 93 } 95 96 98 public PortletDefinition get(String objectId) { 99 Iterator iterator = this.iterator(); 100 while (iterator.hasNext()) { 101 PortletDefinition portletDefinition = (PortletDefinition)iterator.next(); 102 if (portletDefinition.getId().toString().equals(objectId)) { 103 return portletDefinition; 104 } 105 } 106 return null; 107 } 108 109 } 110 | Popular Tags |