KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > portal > pluto > om > PortletEntityImpl


1 /*
2  * Copyright 2004,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.cocoon.portal.pluto.om;
17
18 import java.io.IOException JavaDoc;
19 import java.util.Locale JavaDoc;
20
21 import org.apache.cocoon.portal.PortalService;
22 import org.apache.cocoon.portal.coplet.CopletInstanceData;
23 import org.apache.cocoon.portal.profile.ProfileManager;
24 import org.apache.pluto.om.common.Description;
25 import org.apache.pluto.om.common.ObjectID;
26 import org.apache.pluto.om.common.PreferenceSet;
27 import org.apache.pluto.om.entity.PortletApplicationEntity;
28 import org.apache.pluto.om.entity.PortletEntity;
29 import org.apache.pluto.om.entity.PortletEntityCtrl;
30 import org.apache.pluto.om.portlet.PortletDefinition;
31 import org.apache.pluto.om.window.PortletWindowList;
32
33 /**
34  *
35  *
36  * @author <a HREF="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
37  *
38  * @version CVS $Id: PortletEntityImpl.java 280331 2005-09-12 12:46:40Z cziegeler $
39  */

40 public class PortletEntityImpl implements PortletEntity, PortletEntityCtrl {
41
42     protected final PortletWindowList portletWindows;
43     protected final ObjectID objectId;
44     protected final PortletDefinition definition;
45     protected final CopletInstanceData coplet;
46     protected final PortletApplicationEntity applicationEntity;
47     protected final PortalService service;
48
49     /**
50      * Constructor
51      */

52     PortletEntityImpl(PortletApplicationEntity pae,
53                       CopletInstanceData cid,
54                       PortletDefinition pd,
55                       PortalService service) {
56         this.objectId = org.apache.cocoon.portal.pluto.om.common.ObjectIDImpl.createFromString("CID" + cid.hashCode());
57         this.portletWindows = new PortletWindowListImpl();
58         this.coplet = cid;
59         this.definition = pd;
60         this.applicationEntity = pae;
61         this.service = service;
62     }
63     
64     /**
65      * @see org.apache.pluto.om.entity.PortletEntity#getDescription(java.util.Locale)
66      */

67     public Description getDescription(Locale JavaDoc locale) {
68         return this.definition.getDescription(locale);
69     }
70
71     /**
72      * @see org.apache.pluto.om.entity.PortletEntity#getId()
73      */

74     public ObjectID getId() {
75         return this.objectId;
76     }
77
78     /**
79      * @see org.apache.pluto.om.entity.PortletEntity#getPortletApplicationEntity()
80      */

81     public PortletApplicationEntity getPortletApplicationEntity() {
82         return this.applicationEntity;
83     }
84
85     /**
86      * @see org.apache.pluto.om.entity.PortletEntity#getPortletDefinition()
87      */

88     public PortletDefinition getPortletDefinition() {
89         return this.definition;
90     }
91
92     /**
93      * @see org.apache.pluto.om.entity.PortletEntity#getPortletWindowList()
94      */

95     public PortletWindowList getPortletWindowList() {
96         return this.portletWindows;
97     }
98
99     /**
100      * @see org.apache.pluto.om.entity.PortletEntity#getPreferenceSet()
101      */

102     public PreferenceSet getPreferenceSet() {
103         return this.coplet.getPreferences();
104     }
105
106     /**
107      * Return the coplet instance data.
108      */

109     public CopletInstanceData getCopletInstanceData() {
110         return this.coplet;
111     }
112     
113     
114     /**
115      * @see org.apache.pluto.om.entity.PortletEntityCtrl#reset()
116      */

117     public void reset() throws IOException JavaDoc {
118         // This method doesn't seem to be called by anything.
119
}
120
121     /**
122      * @see org.apache.pluto.om.entity.PortletEntityCtrl#setId(java.lang.String)
123      */

124     public void setId(String JavaDoc id) {
125         // This method doesn't seem to be called by anything.
126
}
127
128     /**
129      * @see org.apache.pluto.om.entity.PortletEntityCtrl#setPortletDefinition(org.apache.pluto.om.portlet.PortletDefinition)
130      */

131     public void setPortletDefinition(PortletDefinition portletDefinition) {
132         // This method doesn't seem to be called by anything
133
}
134
135     /**
136      * @see org.apache.pluto.om.entity.PortletEntityCtrl#store()
137      */

138     public void store() throws IOException JavaDoc {
139         final ProfileManager manager = this.service.getComponentManager().getProfileManager();
140         manager.saveUserCopletInstanceDatas(null);
141     }
142
143 }
144
Popular Tags