1 16 19 20 package org.apache.pluto.portalImpl.om.portlet.impl; 21 22 import java.util.Iterator ; 23 import java.util.Map ; 24 import java.util.Vector ; 25 26 import org.apache.pluto.om.common.ObjectID; 27 import org.apache.pluto.om.portlet.PortletApplicationDefinition; 28 import org.apache.pluto.om.portlet.PortletDefinition; 29 import org.apache.pluto.om.portlet.PortletDefinitionList; 30 import org.apache.pluto.om.servlet.ServletDefinition; 31 import org.apache.pluto.portalImpl.om.common.AbstractSupportSet; 32 import org.apache.pluto.portalImpl.om.common.Support; 33 import org.apache.pluto.util.StringUtils; 34 35 public class PortletDefinitionListImpl extends AbstractSupportSet 36 implements PortletDefinitionList, java.io.Serializable , Support { 37 38 40 public PortletDefinition get(ObjectID objectId) 41 { 42 Iterator iterator = this.iterator(); 43 while (iterator.hasNext()) { 44 PortletDefinition portletDefinition = (PortletDefinition)iterator.next(); 45 if (portletDefinition.getId().equals(objectId)) { 46 return portletDefinition; 47 } 48 } 49 return null; 50 } 51 52 54 57 public void preBuild(Object parameter) throws Exception 58 { 59 Vector structure = (Vector )parameter; 60 PortletApplicationDefinition portletApplication = (PortletApplicationDefinition)structure.get(0); 61 Map servletMap = (Map )structure.get(1); 62 63 Iterator iterator = this.iterator(); 64 while (iterator.hasNext()) { 65 PortletDefinition portlet = (PortletDefinition)iterator.next(); 66 67 ((Support)portlet).preBuild(portletApplication); 68 69 ServletDefinition servlet = null; 70 if (servletMap != null) { 71 servlet = (ServletDefinition)servletMap.get(portlet.getId().toString()); 72 } 73 74 ((Support)portlet).postBuild(servlet); 75 76 } 77 } 78 79 80 83 public void postBuild(Object parameter) throws Exception { 84 } 85 86 89 public void postLoad(Object parameter) throws Exception { 90 Iterator iterator = this.iterator(); 91 while (iterator.hasNext()) { 92 ((PortletDefinitionImpl)iterator.next()).postLoad(parameter); 93 } 94 } 95 96 99 public void postStore(Object parameter) throws Exception { 100 } 101 102 105 public void preStore(Object parameter) throws Exception { 106 } 107 108 110 public PortletDefinition get(String objectId) 111 { 112 Iterator iterator = this.iterator(); 113 while (iterator.hasNext()) { 114 PortletDefinition portletDefinition = (PortletDefinition)iterator.next(); 115 if (portletDefinition.getId().toString().equals(objectId)) { 116 return portletDefinition; 117 } 118 } 119 return null; 120 } 121 122 public String toString() 123 { 124 return toString(0); 125 } 126 127 public String toString(int indent) 128 { 129 StringBuffer buffer = new StringBuffer (50); 130 StringUtils.newLine(buffer,indent); 131 buffer.append(getClass().toString()); 132 buffer.append(": "); 133 Iterator iterator = this.iterator(); 134 while (iterator.hasNext()) { 135 buffer.append(((PortletDefinitionImpl)iterator.next()).toString(indent+2)); 136 } 137 return buffer.toString(); 138 } 139 } 140 | Popular Tags |