View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    * 
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.jetspeed.components.portletentity;
18  
19  import java.io.IOException;
20  import java.util.Collection;
21  
22  import org.apache.jetspeed.om.common.portlet.MutablePortletEntity;
23  import org.apache.jetspeed.om.page.ContentFragment;
24  import org.apache.jetspeed.om.page.Fragment;
25  import org.apache.pluto.om.common.ObjectID;
26  import org.apache.pluto.om.common.PreferenceSet;
27  import org.apache.pluto.om.entity.PortletEntity;
28  import org.apache.pluto.om.portlet.PortletDefinition;
29  
30  /***
31   * <p>
32   * PortletEntityAccessComponent
33   * </p>
34   * 
35   * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
36   * @version $Id: PortletEntityAccessComponent.java,v 1.8 2005/04/29 13:59:46 weaver Exp $
37   *
38   */
39  public interface PortletEntityAccessComponent
40  {
41      /***
42       * 
43       * <p>
44       * getPortletEntity
45       * </p>
46       *
47       * @param id
48       * @return
49       */
50  	MutablePortletEntity getPortletEntity(ObjectID id);
51      
52      MutablePortletEntity getPortletEntity(String id);
53      
54  	/***
55  	 * 
56  	 * <p>
57  	 * generateEntityFromFragment
58  	 * </p>
59  	 *
60  	 * @param fragment
61  	 * @param principal
62  	 * @return
63  	 * @throws PortletEntityNotGeneratedException
64  	 */
65  	MutablePortletEntity generateEntityFromFragment(ContentFragment fragment, String principal) throws PortletEntityNotGeneratedException;
66  	
67  	/***
68  	 * 
69  	 * <p>
70  	 * generateEntityFromFragment
71  	 * </p>
72  	 *
73  	 * @param fragment
74  	 * @return
75  	 * @throws PortletEntityNotGeneratedException
76  	 */
77  	MutablePortletEntity generateEntityFromFragment(ContentFragment fragment) throws PortletEntityNotGeneratedException;
78         
79  	/***
80  	 * 
81  	 * <p>
82  	 * generateEntityKey
83  	 * </p>
84  	 *
85  	 * @param fragment
86  	 * @param principal
87  	 * @return
88  	 */
89  	ObjectID generateEntityKey(Fragment fragment, String principal);
90  
91  	/***
92  	 * 
93  	 * <p>
94  	 * newPortletEntityInstance
95  	 * </p>
96  	 *
97  	 * @param portletDefinition
98  	 * @return
99  	 */
100 	MutablePortletEntity newPortletEntityInstance(PortletDefinition portletDefinition);
101     MutablePortletEntity newPortletEntityInstance(PortletDefinition portletDefinition, String id);
102 	
103 	/***
104 	 * 
105 	 * <p>
106 	 * getPortletEntityForFragment
107 	 * </p>
108 	 *
109 	 * @param fragment
110 	 * @param principal
111 	 * @return
112 	 * @throws PortletEntityNotStoredException 
113 	 */
114 	MutablePortletEntity getPortletEntityForFragment(ContentFragment fragment, String principal) throws PortletEntityNotStoredException;
115 	
116 	/***
117 	 * 
118 	 * <p>
119 	 * getPortletEntityForFragment
120 	 * </p>
121 	 *
122 	 * @param fragment
123 	 * @return
124 	 * @throws PortletEntityNotStoredException 
125 	 */
126 	MutablePortletEntity getPortletEntityForFragment(ContentFragment fragment) throws PortletEntityNotStoredException;
127     
128 	/***
129 	 * 
130 	 * <p>
131 	 * removePortletEntity
132 	 * </p>
133 	 *
134 	 * @param portletEntity
135 	 * @throws PortletEntityNotDeletedException
136 	 */
137 	void removePortletEntity(PortletEntity portletEntity) throws PortletEntityNotDeletedException;
138 	
139 	/***
140 	 * 
141 	 * <p>
142 	 * removeFromCache
143 	 * </p>
144 	 * Removes a PortletEntity from the cache.
145 	 * @param entity
146 	 */
147 	void removeFromCache(PortletEntity entity);
148 
149     /***
150      * <p>
151      * updatePortletEntity
152      * </p>
153      *
154      * Updates portlet definition associated with the portlet
155      * entity to match the fragment configuration 
156      *
157      * @param portletEntity
158 	 * @param fragment
159 	 * @throws PortletEntityNotStoredException 
160      */
161     void updatePortletEntity(PortletEntity portletEntity, ContentFragment fragment) throws PortletEntityNotStoredException;
162 
163     /***
164      * 
165      * <p>
166      * storePortletEntity
167      * </p>
168      *
169      * @param portletEntity
170      * @throws PortletEntityNotStoredException
171      */
172 	void storePortletEntity(PortletEntity portletEntity) throws PortletEntityNotStoredException;
173 	
174 	/***
175 	 * 
176 	 * <p>
177 	 * getPortletEntities
178 	 * </p>
179 	 *
180 	 * @param portletDefinition
181 	 * @return
182 	 */
183 	Collection getPortletEntities(PortletDefinition portletDefinition);
184     
185     Collection getPortletEntities( String portletUniqueName );
186 	
187 	/***
188 	 * 
189 	 * <p>
190 	 * removePortletEntities
191 	 * </p>
192 	 *
193 	 * @param portletDefinition
194 	 * @throws PortletEntityNotDeletedException
195 	 */
196 	void removePortletEntities(PortletDefinition portletDefinition) throws PortletEntityNotDeletedException;
197 	
198 	
199 	void storePreferenceSet(PreferenceSet prefSet, PortletEntity entity) throws IOException;
200 
201     /*** 
202      *  All preferences were shared. With JS2-449, preferences are now
203      *  stored 'per user'. The username is stored in the preferences FULL_PATH
204      *  To turn on mergeSharedPreferences configure this property to true 
205      *  in your Spring configuration. This will NOT turn off per user prefs, 
206      *  but instead merge with them, where user prefs override.
207      */   
208     boolean isMergeSharedPreferences();
209 }