001
014
015 package com.liferay.portlet;
016
017 import com.liferay.portal.kernel.atom.AtomCollectionAdapter;
018 import com.liferay.portal.kernel.lar.PortletDataHandler;
019 import com.liferay.portal.kernel.lar.StagedModelDataHandler;
020 import com.liferay.portal.kernel.poller.PollerProcessor;
021 import com.liferay.portal.kernel.pop.MessageListener;
022 import com.liferay.portal.kernel.portlet.ConfigurationAction;
023 import com.liferay.portal.kernel.portlet.FriendlyURLMapper;
024 import com.liferay.portal.kernel.portlet.PortletBag;
025 import com.liferay.portal.kernel.portlet.PortletLayoutListener;
026 import com.liferay.portal.kernel.search.Indexer;
027 import com.liferay.portal.kernel.search.OpenSearch;
028 import com.liferay.portal.kernel.servlet.URLEncoder;
029 import com.liferay.portal.kernel.template.TemplateHandler;
030 import com.liferay.portal.kernel.trash.TrashHandler;
031 import com.liferay.portal.kernel.util.LocaleUtil;
032 import com.liferay.portal.kernel.webdav.WebDAVStorage;
033 import com.liferay.portal.kernel.workflow.WorkflowHandler;
034 import com.liferay.portal.kernel.xmlrpc.Method;
035 import com.liferay.portal.security.permission.PermissionPropagator;
036 import com.liferay.portlet.asset.model.AssetRendererFactory;
037 import com.liferay.portlet.expando.model.CustomAttributesDisplay;
038 import com.liferay.portlet.social.model.SocialActivityInterpreter;
039 import com.liferay.portlet.social.model.SocialRequestInterpreter;
040
041 import java.util.List;
042 import java.util.Locale;
043 import java.util.Map;
044 import java.util.ResourceBundle;
045
046 import javax.portlet.Portlet;
047 import javax.portlet.PreferencesValidator;
048
049 import javax.servlet.ServletContext;
050
051
055 public class PortletBagImpl implements PortletBag {
056
057 public PortletBagImpl(
058 String portletName, ServletContext servletContext,
059 Portlet portletInstance,
060 ConfigurationAction configurationActionInstance,
061 List<Indexer> indexerInstances, OpenSearch openSearchInstance,
062 FriendlyURLMapper friendlyURLMapperInstance,
063 URLEncoder urlEncoderInstance,
064 PortletDataHandler portletDataHandlerInstance,
065 List<StagedModelDataHandler<?>> stagedModelDataHandlerInstances,
066 TemplateHandler templateHandlerInstance,
067 PortletLayoutListener portletLayoutListenerInstance,
068 PollerProcessor pollerProcessorInstance,
069 MessageListener popMessageListenerInstance,
070 List<SocialActivityInterpreter> socialActivityInterpreterInstances,
071 SocialRequestInterpreter socialRequestInterpreterInstance,
072 WebDAVStorage webDAVStorageInstance, Method xmlRpcMethodInstance,
073 ControlPanelEntry controlPanelEntryInstance,
074 List<AssetRendererFactory> assetRendererFactoryInstances,
075 List<AtomCollectionAdapter<?>> atomCollectionAdapters,
076 List<CustomAttributesDisplay> customAttributesDisplayInstances,
077 PermissionPropagator permissionPropagatorInstance,
078 List<TrashHandler> trashHandlerInstances,
079 List<WorkflowHandler> workflowHandlerInstances,
080 PreferencesValidator preferencesValidatorInstance,
081 Map<String, ResourceBundle> resourceBundles) {
082
083 _portletName = portletName;
084 _servletContext = servletContext;
085 _portletInstance = portletInstance;
086 _configurationActionInstance = configurationActionInstance;
087 _indexerInstances = indexerInstances;
088 _openSearchInstance = openSearchInstance;
089 _friendlyURLMapperInstance = friendlyURLMapperInstance;
090 _urlEncoderInstance = urlEncoderInstance;
091 _portletDataHandlerInstance = portletDataHandlerInstance;
092 _stagedModelDataHandlerInstances = stagedModelDataHandlerInstances;
093 _templateHandlerInstance = templateHandlerInstance;
094 _portletLayoutListenerInstance = portletLayoutListenerInstance;
095 _pollerProcessorInstance = pollerProcessorInstance;
096 _popMessageListenerInstance = popMessageListenerInstance;
097 _socialActivityInterpreterInstances =
098 socialActivityInterpreterInstances;
099 _socialRequestInterpreterInstance = socialRequestInterpreterInstance;
100 _webDAVStorageInstance = webDAVStorageInstance;
101 _xmlRpcMethodInstance = xmlRpcMethodInstance;
102 _controlPanelEntryInstance = controlPanelEntryInstance;
103 _assetRendererFactoryInstances = assetRendererFactoryInstances;
104 _atomCollectionAdapterInstances = atomCollectionAdapters;
105 _customAttributesDisplayInstances = customAttributesDisplayInstances;
106 _permissionPropagatorInstance = permissionPropagatorInstance;
107 _trashHandlerInstances = trashHandlerInstances;
108 _workflowHandlerInstances = workflowHandlerInstances;
109 _preferencesValidatorInstance = preferencesValidatorInstance;
110 _resourceBundles = resourceBundles;
111 }
112
113 @Override
114 public Object clone() {
115 return new PortletBagImpl(
116 getPortletName(), getServletContext(), getPortletInstance(),
117 getConfigurationActionInstance(), getIndexerInstances(),
118 getOpenSearchInstance(), getFriendlyURLMapperInstance(),
119 getURLEncoderInstance(), getPortletDataHandlerInstance(),
120 getStagedModelDataHandlerInstances(), getTemplateHandlerInstance(),
121 getPortletLayoutListenerInstance(), getPollerProcessorInstance(),
122 getPopMessageListenerInstance(),
123 getSocialActivityInterpreterInstances(),
124 getSocialRequestInterpreterInstance(), getWebDAVStorageInstance(),
125 getXmlRpcMethodInstance(), getControlPanelEntryInstance(),
126 getAssetRendererFactoryInstances(),
127 getAtomCollectionAdapterInstances(),
128 getCustomAttributesDisplayInstances(),
129 getPermissionPropagatorInstance(), getTrashHandlerInstances(),
130 getWorkflowHandlerInstances(), getPreferencesValidatorInstance(),
131 getResourceBundles());
132 }
133
134 public List<AssetRendererFactory> getAssetRendererFactoryInstances() {
135 return _assetRendererFactoryInstances;
136 }
137
138 public List<AtomCollectionAdapter<?>> getAtomCollectionAdapterInstances() {
139 return _atomCollectionAdapterInstances;
140 }
141
142 public ConfigurationAction getConfigurationActionInstance() {
143 return _configurationActionInstance;
144 }
145
146 public ControlPanelEntry getControlPanelEntryInstance() {
147 return _controlPanelEntryInstance;
148 }
149
150 public List<CustomAttributesDisplay> getCustomAttributesDisplayInstances() {
151 return _customAttributesDisplayInstances;
152 }
153
154 public FriendlyURLMapper getFriendlyURLMapperInstance() {
155 return _friendlyURLMapperInstance;
156 }
157
158 public List<Indexer> getIndexerInstances() {
159 return _indexerInstances;
160 }
161
162 public OpenSearch getOpenSearchInstance() {
163 return _openSearchInstance;
164 }
165
166 public PermissionPropagator getPermissionPropagatorInstance() {
167 return _permissionPropagatorInstance;
168 }
169
170 public PollerProcessor getPollerProcessorInstance() {
171 return _pollerProcessorInstance;
172 }
173
174 public MessageListener getPopMessageListenerInstance() {
175 return _popMessageListenerInstance;
176 }
177
178 public PortletDataHandler getPortletDataHandlerInstance() {
179 return _portletDataHandlerInstance;
180 }
181
182 public Portlet getPortletInstance() {
183 return _portletInstance;
184 }
185
186 public PortletLayoutListener getPortletLayoutListenerInstance() {
187 return _portletLayoutListenerInstance;
188 }
189
190 public String getPortletName() {
191 return _portletName;
192 }
193
194 public PreferencesValidator getPreferencesValidatorInstance() {
195 return _preferencesValidatorInstance;
196 }
197
198 public ResourceBundle getResourceBundle(Locale locale) {
199 ResourceBundle resourceBundle = _resourceBundles.get(
200 LocaleUtil.toLanguageId(locale));
201
202 if (resourceBundle == null) {
203 resourceBundle = _resourceBundles.get(locale.getLanguage());
204
205 if (resourceBundle == null) {
206 resourceBundle = _resourceBundles.get(
207 LocaleUtil.toLanguageId(LocaleUtil.getDefault()));
208 }
209 }
210
211 return resourceBundle;
212 }
213
214 public Map<String, ResourceBundle> getResourceBundles() {
215 return _resourceBundles;
216 }
217
218 public ServletContext getServletContext() {
219 return _servletContext;
220 }
221
222 public List<SocialActivityInterpreter>
223 getSocialActivityInterpreterInstances() {
224
225 return _socialActivityInterpreterInstances;
226 }
227
228 public SocialRequestInterpreter getSocialRequestInterpreterInstance() {
229 return _socialRequestInterpreterInstance;
230 }
231
232 public List<StagedModelDataHandler<?>>
233 getStagedModelDataHandlerInstances() {
234
235 return _stagedModelDataHandlerInstances;
236 }
237
238 public TemplateHandler getTemplateHandlerInstance() {
239 return _templateHandlerInstance;
240 }
241
242 public List<TrashHandler> getTrashHandlerInstances() {
243 return _trashHandlerInstances;
244 }
245
246 public URLEncoder getURLEncoderInstance() {
247 return _urlEncoderInstance;
248 }
249
250 public WebDAVStorage getWebDAVStorageInstance() {
251 return _webDAVStorageInstance;
252 }
253
254 public List<WorkflowHandler> getWorkflowHandlerInstances() {
255 return _workflowHandlerInstances;
256 }
257
258 public Method getXmlRpcMethodInstance() {
259 return _xmlRpcMethodInstance;
260 }
261
262 public void setPortletInstance(Portlet portletInstance) {
263 _portletInstance = portletInstance;
264 }
265
266 public void setPortletName(String portletName) {
267 _portletName = portletName;
268 }
269
270 private List<AssetRendererFactory> _assetRendererFactoryInstances;
271 private List<AtomCollectionAdapter<?>> _atomCollectionAdapterInstances;
272 private ConfigurationAction _configurationActionInstance;
273 private ControlPanelEntry _controlPanelEntryInstance;
274 private List<CustomAttributesDisplay> _customAttributesDisplayInstances;
275 private FriendlyURLMapper _friendlyURLMapperInstance;
276 private List<Indexer> _indexerInstances;
277 private OpenSearch _openSearchInstance;
278 private PermissionPropagator _permissionPropagatorInstance;
279 private PollerProcessor _pollerProcessorInstance;
280 private MessageListener _popMessageListenerInstance;
281 private PortletDataHandler _portletDataHandlerInstance;
282 private Portlet _portletInstance;
283 private PortletLayoutListener _portletLayoutListenerInstance;
284 private String _portletName;
285 private PreferencesValidator _preferencesValidatorInstance;
286 private Map<String, ResourceBundle> _resourceBundles;
287 private ServletContext _servletContext;
288 private List<SocialActivityInterpreter> _socialActivityInterpreterInstances;
289 private SocialRequestInterpreter _socialRequestInterpreterInstance;
290 private List<StagedModelDataHandler<?>> _stagedModelDataHandlerInstances;
291 private TemplateHandler _templateHandlerInstance;
292 private List<TrashHandler> _trashHandlerInstances;
293 private URLEncoder _urlEncoderInstance;
294 private WebDAVStorage _webDAVStorageInstance;
295 private List<WorkflowHandler> _workflowHandlerInstances;
296 private Method _xmlRpcMethodInstance;
297
298 }