1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.pluto.portalImpl.om.entity.impl;
21
22 import java.util.Collection;
23 import java.util.Iterator;
24
25 import org.apache.pluto.om.common.ObjectID;
26 import org.apache.pluto.om.entity.PortletApplicationEntity;
27 import org.apache.pluto.om.entity.PortletEntityList;
28 import org.apache.pluto.om.portlet.PortletApplicationDefinition;
29 import org.apache.pluto.portalImpl.services.portletdefinitionregistry.PortletDefinitionRegistry;
30 import org.apache.pluto.util.StringUtils;
31
32 public class PortletApplicationEntityImpl
33 implements PortletApplicationEntity, java.io.Serializable,
34 org.apache.pluto.portalImpl.om.common.Support {
35
36 private String id = "";
37 private String definitionId = "";
38 private PortletEntityList portlets = new PortletEntityListImpl();
39
40 private ObjectID objectId = null;
41
42
43
44 public ObjectID getId()
45 {
46 if (objectId==null) {
47 objectId = org.apache.pluto.portalImpl.util.ObjectID.createFromString(id);
48 }
49 return objectId;
50 }
51
52 public PortletEntityList getPortletEntityList()
53 {
54 return portlets;
55 }
56
57 public PortletApplicationDefinition getPortletApplicationDefinition()
58 {
59 return PortletDefinitionRegistry.getPortletApplicationDefinitionList().get(
60 org.apache.pluto.portalImpl.util.ObjectID.createFromString(definitionId));
61 }
62
63
64
65
66
67 public void setId(String id)
68 {
69 this.id = id;
70 objectId= null;
71 }
72
73 public Collection getCastorPortlets()
74 {
75 return(PortletEntityListImpl)portlets;
76 }
77
78 public void postLoad(Object parameter) throws Exception
79 {
80 }
81
82 public void preBuild(Object parameter) throws Exception
83 {
84 Iterator iterator = portlets.iterator();
85 while (iterator.hasNext()) {
86 ((PortletEntityImpl)iterator.next()).preBuild(this);
87 }
88 }
89
90 public void postBuild(Object parameter) throws Exception
91 {
92 }
93
94 public void preStore(Object parameter) throws Exception
95 {
96 }
97
98 public void postStore(Object parameter) throws Exception
99 {
100 }
101
102
103 public String getCastorId() {
104 return getId().toString();
105 }
106
107 public void setCastorId(String id) {
108 setId(id);
109 }
110
111 public String getDefinitionId()
112 {
113 return definitionId;
114 }
115
116 public void setDefinitionId(String definitionId)
117 {
118 this.definitionId = definitionId;
119 }
120
121
122
123 public String toString()
124 {
125 return toString(0);
126 }
127
128 public String toString(int indent)
129 {
130 StringBuffer buffer = new StringBuffer(1000);
131 StringUtils.newLine(buffer,indent);
132 buffer.append(getClass().toString()); buffer.append(":");
133 StringUtils.newLine(buffer,indent);
134 buffer.append("{");
135 StringUtils.newLine(buffer,indent);
136 buffer.append("id='");
137 buffer.append(id);
138 buffer.append("'");
139 StringUtils.newLine(buffer,indent);
140 buffer.append("definition-id='");
141 buffer.append(definitionId);
142 buffer.append("'");
143
144 StringUtils.newLine(buffer,indent);
145 buffer.append(((org.apache.pluto.portalImpl.om.entity.impl.PortletEntityListImpl)portlets).toString(indent));
146
147 StringUtils.newLine(buffer,indent);
148 buffer.append("}");
149 return buffer.toString();
150 }
151
152 }