001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.cocoon.portal.pluto.om;
018:
019: import java.io.IOException;
020: import java.util.Locale;
021:
022: import org.apache.cocoon.portal.PortalService;
023: import org.apache.cocoon.portal.coplet.CopletInstanceData;
024: import org.apache.cocoon.portal.profile.ProfileManager;
025: import org.apache.pluto.om.common.Description;
026: import org.apache.pluto.om.common.ObjectID;
027: import org.apache.pluto.om.common.PreferenceSet;
028: import org.apache.pluto.om.entity.PortletApplicationEntity;
029: import org.apache.pluto.om.entity.PortletEntity;
030: import org.apache.pluto.om.entity.PortletEntityCtrl;
031: import org.apache.pluto.om.portlet.PortletDefinition;
032: import org.apache.pluto.om.window.PortletWindowList;
033:
034: /**
035: *
036: *
037: * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
038: *
039: * @version CVS $Id: PortletEntityImpl.java 433543 2006-08-22 06:22:54Z crossley $
040: */
041: public class PortletEntityImpl implements PortletEntity,
042: PortletEntityCtrl {
043:
044: protected final PortletWindowList portletWindows;
045: protected final ObjectID objectId;
046: protected final PortletDefinition definition;
047: protected final CopletInstanceData coplet;
048: protected final PortletApplicationEntity applicationEntity;
049: protected final PortalService service;
050:
051: /**
052: * Constructor
053: */
054: PortletEntityImpl(PortletApplicationEntity pae,
055: CopletInstanceData cid, PortletDefinition pd,
056: PortalService service) {
057: this .objectId = org.apache.cocoon.portal.pluto.om.common.ObjectIDImpl
058: .createFromString("CID" + cid.hashCode());
059: this .portletWindows = new PortletWindowListImpl();
060: this .coplet = cid;
061: this .definition = pd;
062: this .applicationEntity = pae;
063: this .service = service;
064: }
065:
066: /**
067: * @see org.apache.pluto.om.entity.PortletEntity#getDescription(java.util.Locale)
068: */
069: public Description getDescription(Locale locale) {
070: return this .definition.getDescription(locale);
071: }
072:
073: /**
074: * @see org.apache.pluto.om.entity.PortletEntity#getId()
075: */
076: public ObjectID getId() {
077: return this .objectId;
078: }
079:
080: /**
081: * @see org.apache.pluto.om.entity.PortletEntity#getPortletApplicationEntity()
082: */
083: public PortletApplicationEntity getPortletApplicationEntity() {
084: return this .applicationEntity;
085: }
086:
087: /**
088: * @see org.apache.pluto.om.entity.PortletEntity#getPortletDefinition()
089: */
090: public PortletDefinition getPortletDefinition() {
091: return this .definition;
092: }
093:
094: /**
095: * @see org.apache.pluto.om.entity.PortletEntity#getPortletWindowList()
096: */
097: public PortletWindowList getPortletWindowList() {
098: return this .portletWindows;
099: }
100:
101: /**
102: * @see org.apache.pluto.om.entity.PortletEntity#getPreferenceSet()
103: */
104: public PreferenceSet getPreferenceSet() {
105: return this .coplet.getPreferences();
106: }
107:
108: /**
109: * Return the coplet instance data.
110: */
111: public CopletInstanceData getCopletInstanceData() {
112: return this .coplet;
113: }
114:
115: /**
116: * @see org.apache.pluto.om.entity.PortletEntityCtrl#reset()
117: */
118: public void reset() throws IOException {
119: // This method doesn't seem to be called by anything.
120: }
121:
122: /**
123: * @see org.apache.pluto.om.entity.PortletEntityCtrl#setId(java.lang.String)
124: */
125: public void setId(String id) {
126: // This method doesn't seem to be called by anything.
127: }
128:
129: /**
130: * @see org.apache.pluto.om.entity.PortletEntityCtrl#setPortletDefinition(org.apache.pluto.om.portlet.PortletDefinition)
131: */
132: public void setPortletDefinition(PortletDefinition portletDefinition) {
133: // This method doesn't seem to be called by anything
134: }
135:
136: /**
137: * @see org.apache.pluto.om.entity.PortletEntityCtrl#store()
138: */
139: public void store() throws IOException {
140: final ProfileManager manager = this.service
141: .getComponentManager().getProfileManager();
142: manager.saveUserCopletInstanceDatas(null);
143: }
144:
145: }
|