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