1
14
15 package com.liferay.portlet;
16
17 import com.liferay.portal.kernel.job.Scheduler;
18 import com.liferay.portal.kernel.poller.PollerProcessor;
19 import com.liferay.portal.kernel.pop.MessageListener;
20 import com.liferay.portal.kernel.portlet.ConfigurationAction;
21 import com.liferay.portal.kernel.portlet.FriendlyURLMapper;
22 import com.liferay.portal.kernel.portlet.PortletBag;
23 import com.liferay.portal.kernel.portlet.PortletLayoutListener;
24 import com.liferay.portal.kernel.search.Indexer;
25 import com.liferay.portal.kernel.search.OpenSearch;
26 import com.liferay.portal.kernel.servlet.URLEncoder;
27 import com.liferay.portal.kernel.util.LocaleUtil;
28 import com.liferay.portal.kernel.workflow.WorkflowHandler;
29 import com.liferay.portal.kernel.xmlrpc.Method;
30 import com.liferay.portal.lar.PortletDataHandler;
31 import com.liferay.portal.webdav.WebDAVStorage;
32 import com.liferay.portlet.asset.model.AssetRendererFactory;
33 import com.liferay.portlet.expando.model.CustomAttributesDisplay;
34 import com.liferay.portlet.social.model.SocialActivityInterpreter;
35 import com.liferay.portlet.social.model.SocialRequestInterpreter;
36
37 import java.util.List;
38 import java.util.Locale;
39 import java.util.Map;
40 import java.util.ResourceBundle;
41
42 import javax.portlet.Portlet;
43 import javax.portlet.PreferencesValidator;
44
45 import javax.servlet.ServletContext;
46
47
53 public class PortletBagImpl implements PortletBag {
54
55 public PortletBagImpl(
56 String portletName, ServletContext servletContext,
57 Portlet portletInstance,
58 ConfigurationAction configurationActionInstance,
59 Indexer indexerInstance, OpenSearch openSearchInstance,
60 Scheduler schedulerInstance,
61 FriendlyURLMapper friendlyURLMapperInstance,
62 URLEncoder urlEncoderInstance,
63 PortletDataHandler portletDataHandlerInstance,
64 PortletLayoutListener portletLayoutListenerInstance,
65 PollerProcessor pollerProcessorInstance,
66 MessageListener popMessageListenerInstance,
67 SocialActivityInterpreter socialActivityInterpreterInstance,
68 SocialRequestInterpreter socialRequestInterpreterInstance,
69 WebDAVStorage webDAVStorageInstance, Method xmlRpcMethodInstance,
70 ControlPanelEntry controlPanelEntryInstance,
71 List<AssetRendererFactory> assetRendererFactoryInstances,
72 List<CustomAttributesDisplay> customAttributesDisplayInstances,
73 List<WorkflowHandler> workflowHandlerInstances,
74 PreferencesValidator preferencesValidatorInstance,
75 Map<String, ResourceBundle> resourceBundles) {
76
77 _portletName = portletName;
78 _servletContext = servletContext;
79 _portletInstance = portletInstance;
80 _configurationActionInstance = configurationActionInstance;
81 _indexerInstance = indexerInstance;
82 _openSearchInstance = openSearchInstance;
83 _schedulerInstance = schedulerInstance;
84 _friendlyURLMapperInstance = friendlyURLMapperInstance;
85 _urlEncoderInstance = urlEncoderInstance;
86 _portletDataHandlerInstance = portletDataHandlerInstance;
87 _portletLayoutListenerInstance = portletLayoutListenerInstance;
88 _pollerProcessorInstance = pollerProcessorInstance;
89 _popMessageListenerInstance = popMessageListenerInstance;
90 _socialActivityInterpreterInstance = socialActivityInterpreterInstance;
91 _socialRequestInterpreterInstance = socialRequestInterpreterInstance;
92 _webDAVStorageInstance = webDAVStorageInstance;
93 _xmlRpcMethodInstance = xmlRpcMethodInstance;
94 _controlPanelEntryInstance = controlPanelEntryInstance;
95 _assetRendererFactoryInstances = assetRendererFactoryInstances;
96 _customAttributesDisplayInstances = customAttributesDisplayInstances;
97 _workflowHandlerInstances = workflowHandlerInstances;
98 _preferencesValidatorInstance = preferencesValidatorInstance;
99 _resourceBundles = resourceBundles;
100 }
101
102 public Object clone() {
103 return new PortletBagImpl(
104 getPortletName(), getServletContext(), getPortletInstance(),
105 getConfigurationActionInstance(), getIndexerInstance(),
106 getOpenSearchInstance(), getSchedulerInstance(),
107 getFriendlyURLMapperInstance(), getURLEncoderInstance(),
108 getPortletDataHandlerInstance(), getPortletLayoutListenerInstance(),
109 getPollerProcessorInstance(), getPopMessageListenerInstance(),
110 getSocialActivityInterpreterInstance(),
111 getSocialRequestInterpreterInstance(), getWebDAVStorageInstance(),
112 getXmlRpcMethodInstance(), getControlPanelEntryInstance(),
113 getAssetRendererFactoryInstances(),
114 getCustomAttributesDisplayInstances(),
115 getWorkflowHandlerInstances(), getPreferencesValidatorInstance(),
116 getResourceBundles());
117 }
118
119 public List<AssetRendererFactory> getAssetRendererFactoryInstances() {
120 return _assetRendererFactoryInstances;
121 }
122
123 public ConfigurationAction getConfigurationActionInstance() {
124 return _configurationActionInstance;
125 }
126
127 public ControlPanelEntry getControlPanelEntryInstance() {
128 return _controlPanelEntryInstance;
129 }
130
131 public List<CustomAttributesDisplay> getCustomAttributesDisplayInstances() {
132 return _customAttributesDisplayInstances;
133 }
134
135 public FriendlyURLMapper getFriendlyURLMapperInstance() {
136 return _friendlyURLMapperInstance;
137 }
138
139 public Indexer getIndexerInstance() {
140 return _indexerInstance;
141 }
142
143 public OpenSearch getOpenSearchInstance() {
144 return _openSearchInstance;
145 }
146
147 public PollerProcessor getPollerProcessorInstance() {
148 return _pollerProcessorInstance;
149 }
150
151 public MessageListener getPopMessageListenerInstance() {
152 return _popMessageListenerInstance;
153 }
154
155 public PortletDataHandler getPortletDataHandlerInstance() {
156 return _portletDataHandlerInstance;
157 }
158
159 public Portlet getPortletInstance() {
160 return _portletInstance;
161 }
162
163 public PortletLayoutListener getPortletLayoutListenerInstance() {
164 return _portletLayoutListenerInstance;
165 }
166
167 public String getPortletName() {
168 return _portletName;
169 }
170
171 public PreferencesValidator getPreferencesValidatorInstance() {
172 return _preferencesValidatorInstance;
173 }
174
175 public ResourceBundle getResourceBundle(Locale locale) {
176 ResourceBundle resourceBundle = _resourceBundles.get(
177 LocaleUtil.toLanguageId(locale));
178
179 if (resourceBundle == null) {
180 resourceBundle = _resourceBundles.get(locale.getLanguage());
181
182 if (resourceBundle == null) {
183 resourceBundle = _resourceBundles.get(
184 LocaleUtil.toLanguageId(LocaleUtil.getDefault()));
185 }
186 }
187
188 return resourceBundle;
189 }
190
191 public Map<String, ResourceBundle> getResourceBundles() {
192 return _resourceBundles;
193 }
194
195 public Scheduler getSchedulerInstance() {
196 return _schedulerInstance;
197 }
198
199 public ServletContext getServletContext() {
200 return _servletContext;
201 }
202
203 public SocialActivityInterpreter getSocialActivityInterpreterInstance() {
204 return _socialActivityInterpreterInstance;
205 }
206
207 public SocialRequestInterpreter getSocialRequestInterpreterInstance() {
208 return _socialRequestInterpreterInstance;
209 }
210
211 public URLEncoder getURLEncoderInstance() {
212 return _urlEncoderInstance;
213 }
214
215 public WebDAVStorage getWebDAVStorageInstance() {
216 return _webDAVStorageInstance;
217 }
218
219 public List<WorkflowHandler> getWorkflowHandlerInstances() {
220 return _workflowHandlerInstances;
221 }
222
223 public Method getXmlRpcMethodInstance() {
224 return _xmlRpcMethodInstance;
225 }
226
227 public void setPortletInstance(Portlet portletInstance) {
228 _portletInstance = portletInstance;
229 }
230
231 public void setPortletName(String portletName) {
232 _portletName = portletName;
233 }
234
235 private List<AssetRendererFactory> _assetRendererFactoryInstances;
236 private ConfigurationAction _configurationActionInstance;
237 private ControlPanelEntry _controlPanelEntryInstance;
238 private List<CustomAttributesDisplay> _customAttributesDisplayInstances;
239 private FriendlyURLMapper _friendlyURLMapperInstance;
240 private Indexer _indexerInstance;
241 private OpenSearch _openSearchInstance;
242 private PollerProcessor _pollerProcessorInstance;
243 private MessageListener _popMessageListenerInstance;
244 private PortletDataHandler _portletDataHandlerInstance;
245 private Portlet _portletInstance;
246 private PortletLayoutListener _portletLayoutListenerInstance;
247 private String _portletName;
248 private PreferencesValidator _preferencesValidatorInstance;
249 private Map<String, ResourceBundle> _resourceBundles;
250 private Scheduler _schedulerInstance;
251 private ServletContext _servletContext;
252 private SocialActivityInterpreter _socialActivityInterpreterInstance;
253 private SocialRequestInterpreter _socialRequestInterpreterInstance;
254 private URLEncoder _urlEncoderInstance;
255 private WebDAVStorage _webDAVStorageInstance;
256 private Method _xmlRpcMethodInstance;
257 private List<WorkflowHandler> _workflowHandlerInstances;
258
259 }