| PortletImpl.java |
1 /**
2 * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 * SOFTWARE.
21 */
22
23 package com.liferay.portal.model.impl;
24
25 import com.liferay.portal.kernel.job.Scheduler;
26 import com.liferay.portal.kernel.log.Log;
27 import com.liferay.portal.kernel.log.LogFactoryUtil;
28 import com.liferay.portal.kernel.plugin.PluginPackage;
29 import com.liferay.portal.kernel.poller.PollerProcessor;
30 import com.liferay.portal.kernel.pop.MessageListener;
31 import com.liferay.portal.kernel.portlet.ConfigurationAction;
32 import com.liferay.portal.kernel.portlet.FriendlyURLMapper;
33 import com.liferay.portal.kernel.portlet.PortletBag;
34 import com.liferay.portal.kernel.portlet.PortletBagPool;
35 import com.liferay.portal.kernel.portlet.PortletLayoutListener;
36 import com.liferay.portal.kernel.search.Indexer;
37 import com.liferay.portal.kernel.search.OpenSearch;
38 import com.liferay.portal.kernel.servlet.URLEncoder;
39 import com.liferay.portal.kernel.util.ContentTypes;
40 import com.liferay.portal.kernel.util.InstancePool;
41 import com.liferay.portal.kernel.util.StringPool;
42 import com.liferay.portal.kernel.util.StringUtil;
43 import com.liferay.portal.kernel.util.Validator;
44 import com.liferay.portal.lar.PortletDataHandler;
45 import com.liferay.portal.model.Plugin;
46 import com.liferay.portal.model.PluginSetting;
47 import com.liferay.portal.model.Portlet;
48 import com.liferay.portal.model.PortletApp;
49 import com.liferay.portal.model.PortletConstants;
50 import com.liferay.portal.model.PortletFilter;
51 import com.liferay.portal.model.PortletInfo;
52 import com.liferay.portal.model.PublicRenderParameter;
53 import com.liferay.portal.model.RoleConstants;
54 import com.liferay.portal.model.User;
55 import com.liferay.portal.service.RoleLocalServiceUtil;
56 import com.liferay.portal.service.UserLocalServiceUtil;
57 import com.liferay.portal.util.PortalUtil;
58 import com.liferay.portal.util.PropsValues;
59 import com.liferay.portal.util.QNameUtil;
60 import com.liferay.portlet.PortletBagImpl;
61 import com.liferay.portlet.social.model.SocialActivityInterpreter;
62 import com.liferay.portlet.social.model.SocialRequestInterpreter;
63
64 import java.util.ArrayList;
65 import java.util.Arrays;
66 import java.util.HashMap;
67 import java.util.HashSet;
68 import java.util.Hashtable;
69 import java.util.Iterator;
70 import java.util.LinkedHashMap;
71 import java.util.List;
72 import java.util.Map;
73 import java.util.Set;
74 import java.util.TreeSet;
75
76 import javax.portlet.PortletMode;
77 import javax.portlet.WindowState;
78
79 import javax.xml.namespace.QName;
80
81 /**
82 * <a href="PortletImpl.java.html"><b><i>View Source</i></b></a>
83 *
84 * @author Brian Wing Shun Chan
85 *
86 */
87 public class PortletImpl extends PortletModelImpl implements Portlet {
88
89 /**
90 * Constructs a portlet with no parameters.
91 */
92 public PortletImpl() {
93 }
94
95 /**
96 * Constructs a portlet with the specified parameters.
97 */
98 public PortletImpl(long companyId, String portletId) {
99 setCompanyId(companyId);
100 setPortletId(portletId);
101 setStrutsPath(portletId);
102 setActive(true);
103 _headerPortalCss = new ArrayList<String>();
104 _headerPortletCss = new ArrayList<String>();
105 _headerPortalJavaScript = new ArrayList<String>();
106 _headerPortletJavaScript = new ArrayList<String>();
107 _footerPortalCss = new ArrayList<String>();
108 _footerPortletCss = new ArrayList<String>();
109 _footerPortalJavaScript = new ArrayList<String>();
110 _footerPortletJavaScript = new ArrayList<String>();
111 _unlinkedRoles = new HashSet<String>();
112 _roleMappers = new LinkedHashMap<String, String>();
113 _initParams = new HashMap<String, String>();
114 _portletModes = new HashMap<String, Set<String>>();
115 _windowStates = new HashMap<String, Set<String>>();
116 _supportedLocales = new HashSet<String>();
117 _portletFilters = new LinkedHashMap<String, PortletFilter>();
118 _processingEvents = new HashSet<QName>();
119 _publishingEvents = new HashSet<QName>();
120 _publicRenderParameters = new HashSet<PublicRenderParameter>();
121 }
122
123 /**
124 * Constructs a portlet with the specified parameters.
125 */
126 public PortletImpl(
127 String portletId, PluginPackage pluginPackage,
128 PluginSetting pluginSetting, long companyId, long timestamp,
129 String icon, String virtualPath, String strutsPath, String portletName,
130 String displayName, String portletClass,
131 String configurationActionClass, String indexerClass,
132 String openSearchClass, String schedulerClass, String portletURLClass,
133 String friendlyURLMapperClass, String urlEncoderClass,
134 String portletDataHandlerClass, String portletLayoutListenerClass,
135 String pollerProcessorClass, String popMessageListenerClass,
136 String socialActivityInterpreterClass,
137 String socialRequestInterpreterClass, String defaultPreferences,
138 String prefsValidator, boolean prefsCompanyWide,
139 boolean prefsUniquePerLayout, boolean prefsOwnedByGroup,
140 boolean useDefaultTemplate, boolean showPortletAccessDenied,
141 boolean showPortletInactive, boolean actionURLRedirect,
142 boolean restoreCurrentView, boolean maximizeEdit, boolean maximizeHelp,
143 boolean popUpPrint, boolean layoutCacheable, boolean instanceable,
144 String userPrincipalStrategy, boolean privateRequestAttributes,
145 boolean privateSessionAttributes, int renderWeight, boolean ajaxable,
146 List<String> headerPortalCss, List<String> headerPortletCss,
147 List<String> headerPortalJavaScript,
148 List<String> headerPortletJavaScript, List<String> footerPortalCss,
149 List<String> footerPortletCss, List<String> footerPortalJavaScript,
150 List<String> footerPortletJavaScript,
151 String cssClassWrapper, String facebookIntegration,
152 boolean addDefaultResource, String roles, Set<String> unlinkedRoles,
153 Map<String, String> roleMappers, boolean system, boolean active,
154 boolean include, Map<String, String> initParams, Integer expCache,
155 Map<String, Set<String>> portletModes,
156 Map<String, Set<String>> windowStates, Set<String> supportedLocales,
157 String resourceBundle, PortletInfo portletInfo,
158 Map<String, PortletFilter> portletFilters, Set<QName> processingEvents,
159 Set<QName> publishingEvents,
160 Set<PublicRenderParameter> publicRenderParameters,
161 PortletApp portletApp) {
162
163 setPortletId(portletId);
164 _pluginPackage = pluginPackage;
165 _defaultPluginSetting = pluginSetting;
166 setCompanyId(companyId);
167 _timestamp = timestamp;
168 _icon = icon;
169 _virtualPath = virtualPath;
170 _strutsPath = strutsPath;
171 _portletName = portletName;
172 _displayName = displayName;
173 _portletClass = portletClass;
174 _configurationActionClass = configurationActionClass;
175 _indexerClass = indexerClass;
176 _openSearchClass = openSearchClass;
177 _schedulerClass = schedulerClass;
178 _portletURLClass = portletURLClass;
179 _friendlyURLMapperClass = friendlyURLMapperClass;
180 _urlEncoderClass = urlEncoderClass;
181 _portletDataHandlerClass = portletDataHandlerClass;
182 _portletLayoutListenerClass = portletLayoutListenerClass;
183 _pollerProcessorClass = pollerProcessorClass;
184 _popMessageListenerClass = popMessageListenerClass;
185 _socialActivityInterpreterClass = socialActivityInterpreterClass;
186 _socialRequestInterpreterClass = socialRequestInterpreterClass;
187 _defaultPreferences = defaultPreferences;
188 _prefsValidator = prefsValidator;
189 _prefsCompanyWide = prefsCompanyWide;
190 _prefsUniquePerLayout = prefsUniquePerLayout;
191 _prefsOwnedByGroup = prefsOwnedByGroup;
192 _useDefaultTemplate = useDefaultTemplate;
193 _showPortletAccessDenied = showPortletAccessDenied;
194 _showPortletInactive = showPortletInactive;
195 _actionURLRedirect = actionURLRedirect;
196 _restoreCurrentView = restoreCurrentView;
197 _maximizeEdit = maximizeEdit;
198 _maximizeHelp = maximizeHelp;
199 _popUpPrint = popUpPrint;
200 _layoutCacheable = layoutCacheable;
201 _instanceable = instanceable;
202 _userPrincipalStrategy = userPrincipalStrategy;
203 _privateRequestAttributes = privateRequestAttributes;
204 _privateSessionAttributes = privateSessionAttributes;
205 _renderWeight = renderWeight;
206 _ajaxable = ajaxable;
207 _headerPortalCss = headerPortalCss;
208 _headerPortletCss = headerPortletCss;
209 _headerPortalJavaScript = headerPortalJavaScript;
210 _headerPortletJavaScript = headerPortletJavaScript;
211 _footerPortalCss = footerPortalCss;
212 _footerPortletCss = footerPortletCss;
213 _footerPortalJavaScript = footerPortalJavaScript;
214 _footerPortletJavaScript = footerPortletJavaScript;
215 _cssClassWrapper = cssClassWrapper;
216 _facebookIntegration = facebookIntegration;
217 _addDefaultResource = addDefaultResource;
218 setRoles(roles);
219 _unlinkedRoles = unlinkedRoles;
220 _roleMappers = roleMappers;
221 _system = system;
222 setActive(active);
223 _include = include;
224 _initParams = initParams;
225 _expCache = expCache;
226 _portletModes = portletModes;
227 _windowStates = windowStates;
228 _supportedLocales = supportedLocales;
229 _resourceBundle = resourceBundle;
230 _portletInfo = portletInfo;
231 _portletFilters = portletFilters;
232 setProcessingEvents(processingEvents);
233 setPublishingEvents(publishingEvents);
234 setPublicRenderParameters(publicRenderParameters);
235 _portletApp = portletApp;
236
237 if (_instanceable) {
238 _clonedInstances = new Hashtable<String, Portlet>();
239 }
240 }
241
242 /**
243 * Gets the root portlet id of the portlet.
244 *
245 * @return the root portlet id of the portlet
246 */
247 public String getRootPortletId() {
248 return PortletConstants.getRootPortletId(getPortletId());
249 }
250
251 /**
252 * Gets the instance id of the portlet.
253 *
254 * @return the instance id of the portlet
255 */
256 public String getInstanceId() {
257 return PortletConstants.getInstanceId(getPortletId());
258 }
259
260 /**
261 * Gets the plugin id of the portlet.
262 *
263 * @return the plugin id of the portlet
264 */
265 public String getPluginId() {
266 return getRootPortletId();
267 }
268
269 /**
270 * Gets the plugin type of the portlet.
271 *
272 * @return the plugin type of the portlet
273 */
274 public String getPluginType() {
275 return Plugin.TYPE_PORTLET;
276 }
277
278 /**
279 * Get the package to which the portlet belongs to.
280 *
281 * @return the plugin package of the portlet
282 */
283 public PluginPackage getPluginPackage() {
284 return _pluginPackage;
285 }
286
287 /**
288 * Sets the plugin package this portlet belongs to.
289 *
290 * @param pluginPackage the plugin package
291 */
292 public void setPluginPackage(PluginPackage pluginPackage) {
293 _pluginPackage = pluginPackage;
294 }
295
296 /**
297 * Get the default plugin settings of the portlet.
298 *
299 * @return the plugin settings
300 */
301 public PluginSetting getDefaultPluginSetting() {
302 return _defaultPluginSetting;
303 }
304
305 /**
306 * Sets the default plugin settings of the portlet.
307 *
308 * @param pluginSetting the plugin setting
309 */
310 public void setDefaultPluginSetting(PluginSetting pluginSetting) {
311 _defaultPluginSetting = pluginSetting;
312 }
313
314 /**
315 * Gets the timestamp of the portlet.
316 *
317 * @return the timestamp of the portlet
318 */
319 public long getTimestamp() {
320 return _timestamp;
321 }
322
323 /**
324 * Sets the timestamp of the portlet.
325 *
326 * @param timestamp the timestamp of the portlet
327 */
328 public void setTimestamp(long timestamp) {
329 _timestamp = timestamp;
330 }
331
332 /**
333 * Gets the icon of the portlet.
334 *
335 * @return the icon of the portlet
336 */
337 public String getIcon() {
338 return _icon;
339 }
340
341 /**
342 * Sets the icon of the portlet.
343 *
344 * @param icon the icon of the portlet
345 */
346 public void setIcon(String icon) {
347 _icon = icon;
348 }
349
350 /**
351 * Gets the virtual path of the portlet.
352 *
353 * @return the virtual path of the portlet
354 */
355 public String getVirtualPath() {
356 return _virtualPath;
357 }
358
359 /**
360 * Sets the virtual path of the portlet.
361 *
362 * @param virtualPath the virtual path of the portlet
363 */
364 public void setVirtualPath(String virtualPath) {
365 if (_portletApp.isWARFile() && Validator.isNull(virtualPath)) {
366 virtualPath = PropsValues.PORTLET_VIRTUAL_PATH;
367 }
368
369 _virtualPath = virtualPath;
370 }
371
372 /**
373 * Gets the struts path of the portlet.
374 *
375 * @return the struts path of the portlet
376 */
377 public String getStrutsPath() {
378 return _strutsPath;
379 }
380
381 /**
382 * Sets the struts path of the portlet.
383 *
384 * @param strutsPath the struts path of the portlet
385 */
386 public void setStrutsPath(String strutsPath) {
387 _strutsPath = strutsPath;
388 }
389
390 /**
391 * Gets the name of the portlet.
392 *
393 * @return the display name of the portlet
394 */
395 public String getPortletName() {
396 return _portletName;
397 }
398
399 /**
400 * Sets the name of the portlet.
401 *
402 * @param portletName the name of the portlet
403 */
404 public void setPortletName(String portletName) {
405 _portletName = portletName;
406 }
407
408 /**
409 * Gets the display name of the portlet.
410 *
411 * @return the display name of the portlet
412 */
413 public String getDisplayName() {
414 return _displayName;
415 }
416
417 /**
418 * Sets the display name of the portlet.
419 *
420 * @param displayName the display name of the portlet
421 */
422 public void setDisplayName(String displayName) {
423 _displayName = displayName;
424 }
425
426 /**
427 * Gets the name of the portlet class of the portlet.
428 *
429 * @return the name of the portlet class of the portlet
430 */
431 public String getPortletClass() {
432 return _portletClass;
433 }
434
435 /**
436 * Sets the name of the portlet class of the portlet.
437 *
438 * @param portletClass the name of the portlet class of the portlet
439 */
440 public void setPortletClass(String portletClass) {
441 _portletClass = portletClass;
442 }
443
444 /**
445 * Gets the configuration action class of the portlet.
446 *
447 * @return the configuration action class of the portlet
448 */
449 public String getConfigurationActionClass() {
450 return _configurationActionClass;
451 }
452
453 /**
454 * Sets the configuration action class of the portlet.
455 *
456 * @param configurationActionClass the configuration action class of
457 * the portlet
458 */
459 public void setConfigurationActionClass(String configurationActionClass) {
460 _configurationActionClass = configurationActionClass;
461 }
462
463 /**
464 * Gets the configuration action instance of the portlet.
465 *
466 * @return the configuration action instance of the portlet
467 */
468 public ConfigurationAction getConfigurationActionInstance() {
469 if (Validator.isNotNull(getConfigurationActionClass())) {
470 if (_portletApp.isWARFile()) {
471 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
472
473 return portletBag.getConfigurationActionInstance();
474 }
475 else {
476 return (ConfigurationAction)InstancePool.get(
477 getConfigurationActionClass());
478 }
479 }
480
481 return null;
482 }
483
484 /**
485 * Gets the name of the indexer class of the portlet.
486 *
487 * @return the name of the indexer class of the portlet
488 */
489 public String getIndexerClass() {
490 return _indexerClass;
491 }
492
493 /**
494 * Sets the name of the indexer class of the portlet.
495 *
496 * @param indexerClass the name of the indexer class of the portlet
497 */
498 public void setIndexerClass(String indexerClass) {
499 _indexerClass = indexerClass;
500 }
501
502 /**
503 * Gets the indexer instance of the portlet.
504 *
505 * @return the indexer instance of the portlet
506 */
507 public Indexer getIndexerInstance() {
508 if (Validator.isNotNull(getIndexerClass())) {
509 if (_portletApp.isWARFile()) {
510 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
511
512 return portletBag.getIndexerInstance();
513 }
514 else {
515 return (Indexer)InstancePool.get(getIndexerClass());
516 }
517 }
518
519 return null;
520 }
521
522 /**
523 * Gets the name of the open search class of the portlet.
524 *
525 * @return the name of the open search class of the portlet
526 */
527 public String getOpenSearchClass() {
528 return _openSearchClass;
529 }
530
531 /**
532 * Sets the name of the open search class of the portlet.
533 *
534 * @param openSearchClass the name of the open search class of the
535 * portlet
536 */
537 public void setOpenSearchClass(String openSearchClass) {
538 _openSearchClass = openSearchClass;
539 }
540
541 /**
542 * Gets the indexer instance of the portlet.
543 *
544 * @return the indexer instance of the portlet
545 */
546 public OpenSearch getOpenSearchInstance() {
547 if (Validator.isNull(getOpenSearchClass())) {
548 return null;
549 }
550
551 if (_portletApp.isWARFile()) {
552 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
553
554 return portletBag.getOpenSearchInstance();
555 }
556
557 return (OpenSearch)InstancePool.get(getOpenSearchClass());
558 }
559
560 /**
561 * Gets the name of the scheduler class of the portlet.
562 *
563 * @return the name of the scheduler class of the portlet
564 */
565 public String getSchedulerClass() {
566 return _schedulerClass;
567 }
568
569 /**
570 * Sets the name of the scheduler class of the portlet.
571 *
572 * @param schedulerClass the name of the scheduler class of the
573 * portlet
574 */
575 public void setSchedulerClass(String schedulerClass) {
576 _schedulerClass = schedulerClass;
577 }
578
579 /**
580 * Gets the scheduler instance of the portlet.
581 *
582 * @return the scheduler instance of the portlet
583 */
584 public Scheduler getSchedulerInstance() {
585 if (Validator.isNotNull(getSchedulerClass())) {
586 if (_portletApp.isWARFile()) {
587 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
588
589 return portletBag.getSchedulerInstance();
590 }
591 else {
592 return (Scheduler)InstancePool.get(getSchedulerClass());
593 }
594 }
595
596 return null;
597 }
598
599 /**
600 * Gets the name of the portlet URL class of the portlet.
601 *
602 * @return the name of the portlet URL class of the portlet
603 */
604 public String getPortletURLClass() {
605 return _portletURLClass;
606 }
607
608 /**
609 * Sets the name of the portlet URL class of the portlet.
610 *
611 * @param portletURLClass the name of the portlet URL class of the
612 * portlet
613 */
614 public void setPortletURLClass(String portletURLClass) {
615 _portletURLClass = portletURLClass;
616 }
617
618 /**
619 * Gets the name of the friendly URL mapper class of the portlet.
620 *
621 * @return the name of the friendly URL mapper class of the portlet
622 */
623 public String getFriendlyURLMapperClass() {
624 return _friendlyURLMapperClass;
625 }
626
627 /**
628 * Sets the name of the friendly URL mapper class of the portlet.
629 *
630 * @param friendlyURLMapperClass the name of the friendly URL plugin
631 * class of the portlet
632 */
633 public void setFriendlyURLMapperClass(String friendlyURLMapperClass) {
634 _friendlyURLMapperClass = friendlyURLMapperClass;
635 }
636
637 /**
638 * Gets the friendly URL mapper instance of the portlet.
639 *
640 * @return the friendly URL mapper instance of the portlet
641 */
642 public FriendlyURLMapper getFriendlyURLMapperInstance() {
643 if (Validator.isNotNull(getFriendlyURLMapperClass())) {
644 if (_portletApp.isWARFile()) {
645 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
646
647 return portletBag.getFriendlyURLMapperInstance();
648 }
649 else {
650 return (FriendlyURLMapper)InstancePool.get(
651 getFriendlyURLMapperClass());
652 }
653 }
654
655 return null;
656 }
657
658 /**
659 * Gets the name of the URL encoder class of the portlet.
660 *
661 * @return the name of the URL encoder class of the portlet
662 */
663 public String getURLEncoderClass() {
664 return _urlEncoderClass;
665 }
666
667 /**
668 * Sets the name of the URL encoder class of the portlet.
669 *
670 * @param urlEncoderClass the name of the URL encoder class of the
671 * portlet
672 */
673 public void setURLEncoderClass(String urlEncoderClass) {
674 _urlEncoderClass = urlEncoderClass;
675 }
676
677 /**
678 * Gets the URL encoder instance of the portlet.
679 *
680 * @return the URL encoder instance of the portlet
681 */
682 public URLEncoder getURLEncoderInstance() {
683 if (Validator.isNotNull(getURLEncoderClass())) {
684 if (_portletApp.isWARFile()) {
685 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
686
687 return portletBag.getURLEncoderInstance();
688 }
689 else {
690 return (URLEncoder)InstancePool.get(getURLEncoderClass());
691 }
692 }
693
694 return null;
695 }
696
697 /**
698 * Gets the name of the portlet data handler class of the portlet.
699 *
700 * @return the name of the portlet data handler class of the portlet
701 */
702 public String getPortletDataHandlerClass() {
703 return _portletDataHandlerClass;
704 }
705
706 /**
707 * Sets the name of the portlet data handler class of the portlet.
708 *
709 * @param portletDataHandlerClass the name of portlet data handler
710 * class of the portlet
711 */
712 public void setPortletDataHandlerClass(String portletDataHandlerClass) {
713 _portletDataHandlerClass = portletDataHandlerClass;
714 }
715
716 /**
717 * Gets the portlet data handler instance of the portlet.
718 *
719 * @return the portlet data handler instance of the portlet
720 */
721 public PortletDataHandler getPortletDataHandlerInstance() {
722 if (Validator.isNotNull(getPortletDataHandlerClass())) {
723 if (_portletApp.isWARFile()) {
724 PortletBagImpl portletBagImpl =
725 (PortletBagImpl)PortletBagPool.get(getRootPortletId());
726
727 return portletBagImpl.getPortletDataHandlerInstance();
728 }
729 else {
730 return (PortletDataHandler)InstancePool.get(
731 getPortletDataHandlerClass());
732 }
733 }
734
735 return null;
736 }
737
738 /**
739 * Gets the portlet layout listener of the portlet.
740 *
741 * @return the name of the portlet layout listener class of the portlet
742 */
743 public PortletLayoutListener getPortletLayoutListener() {
744 if (Validator.isNull(getPortletLayoutListenerClass())) {
745 return null;
746 }
747
748 return (PortletLayoutListener)InstancePool.get(
749 getPortletLayoutListenerClass());
750 }
751
752 /**
753 * Gets the name of the portlet layout listener class of the portlet.
754 *
755 * @return the name of the portlet layout listener class of the portlet
756 */
757 public String getPortletLayoutListenerClass() {
758 return _portletLayoutListenerClass;
759 }
760
761 /**
762 * Sets the name of the portlet layout listener class of the portlet.
763 *
764 * @param portletLayoutListenerClass the name of the portlet layout
765 * listener class of the portlet
766 */
767 public void setPortletLayoutListenerClass(
768 String portletLayoutListenerClass) {
769
770 _portletLayoutListenerClass = portletLayoutListenerClass;
771 }
772
773 /**
774 * Gets the portlet layout listener instance of the portlet.
775 *
776 * @return the portlet layout listener instance of the portlet
777 */
778 public PortletLayoutListener getPortletLayoutListenerInstance() {
779 if (Validator.isNull(getPortletLayoutListenerClass())) {
780 return null;
781 }
782
783 if (_portletApp.isWARFile()) {
784 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
785
786 return portletBag.getPortletLayoutListenerInstance();
787 }
788
789 return (PortletLayoutListener)InstancePool.get(
790 getPortletLayoutListenerClass());
791 }
792
793 /**
794 * Gets the name of the poller processor class of the portlet.
795 *
796 * @return the name of the poller processor class of the portlet
797 */
798 public String getPollerProcessorClass() {
799 return _pollerProcessorClass;
800 }
801
802 /**
803 * Sets the name of the poller processor class of the portlet.
804 *
805 * @param pollerProcessorClass the name of the poller processor
806 * class of the portlet
807 */
808 public void setPollerProcessorClass(String pollerProcessorClass) {
809 _pollerProcessorClass = pollerProcessorClass;
810 }
811
812 /**
813 * Gets the poller processor instance of the portlet.
814 *
815 * @return the poller processor instance of the portlet
816 */
817 public PollerProcessor getPollerProcessorInstance() {
818 if (Validator.isNull(getPollerProcessorClass())) {
819 return null;
820 }
821
822 if (_portletApp.isWARFile()) {
823 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
824
825 return portletBag.getPollerProcessorInstance();
826 }
827
828 return (PollerProcessor)InstancePool.get(getPollerProcessorClass());
829 }
830
831 /**
832 * Gets the name of the POP message listener class of the portlet.
833 *
834 * @return the name of the POP message listener class of the portlet
835 */
836 public String getPopMessageListenerClass() {
837 return _popMessageListenerClass;
838 }
839
840 /**
841 * Sets the name of the POP message listener class of the portlet.
842 *
843 * @param popMessageListenerClass the name of the POP message listener
844 * class of the portlet
845 */
846 public void setPopMessageListenerClass(String popMessageListenerClass) {
847 _popMessageListenerClass = popMessageListenerClass;
848 }
849
850 /**
851 * Gets the POP message listener instance of the portlet.
852 *
853 * @return the POP message listener instance of the portlet
854 */
855 public MessageListener getPopMessageListenerInstance() {
856 if (Validator.isNotNull(getPopMessageListenerClass())) {
857 if (_portletApp.isWARFile()) {
858 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
859
860 return portletBag.getPopMessageListenerInstance();
861 }
862 else {
863 return (MessageListener)InstancePool.get(
864 getPopMessageListenerClass());
865 }
866 }
867
868 return null;
869 }
870
871 /**
872 * Gets the name of the social activity interpreter class of the portlet.
873 *
874 * @return the name of the social activity interpreter class of the
875 * portlet
876 */
877 public String getSocialActivityInterpreterClass() {
878 return _socialActivityInterpreterClass;
879 }
880
881 /**
882 * Sets the name of the social activity interpreter class of the portlet.
883 *
884 * @param socialActivityInterpreterClass the name of the activity
885 * interpreter class of the portlet
886 */
887 public void setSocialActivityInterpreterClass(
888 String socialActivityInterpreterClass) {
889
890 _socialActivityInterpreterClass = socialActivityInterpreterClass;
891 }
892
893 /**
894 * Gets the name of the social activity interpreter instance of the portlet.
895 *
896 * @return the name of the social activity interpreter instance of the
897 * portlet
898 */
899 public SocialActivityInterpreter getSocialActivityInterpreterInstance() {
900 if (Validator.isNotNull(getSocialActivityInterpreterClass())) {
901 if (_portletApp.isWARFile()) {
902 PortletBagImpl portletBagImpl =
903 (PortletBagImpl)PortletBagPool.get(getRootPortletId());
904
905 return portletBagImpl.getSocialActivityInterpreterInstance();
906 }
907 else {
908 return (SocialActivityInterpreter)InstancePool.get(
909 getSocialActivityInterpreterClass());
910 }
911 }
912
913 return null;
914 }
915
916 /**
917 * Gets the name of the social request interpreter class of the portlet.
918 *
919 * @return the name of the social request interpreter class of the
920 * portlet
921 */
922 public String getSocialRequestInterpreterClass() {
923 return _socialRequestInterpreterClass;
924 }
925
926 /**
927 * Sets the name of the social request interpreter class of the portlet.
928 *
929 * @param socialRequestInterpreterClass the name of the request
930 * interpreter class of the portlet
931 */
932 public void setSocialRequestInterpreterClass(
933 String socialRequestInterpreterClass) {
934
935 _socialRequestInterpreterClass = socialRequestInterpreterClass;
936 }
937
938 /**
939 * Gets the name of the social request interpreter instance of the portlet.
940 *
941 * @return the name of the social request interpreter instance of the
942 * portlet
943 */
944 public SocialRequestInterpreter getSocialRequestInterpreterInstance() {
945 if (Validator.isNotNull(getSocialRequestInterpreterClass())) {
946 if (_portletApp.isWARFile()) {
947 PortletBagImpl portletBag =
948 (PortletBagImpl)PortletBagPool.get(getRootPortletId());
949
950 return portletBag.getSocialRequestInterpreterInstance();
951 }
952 else {
953 return (SocialRequestInterpreter)InstancePool.get(
954 getSocialRequestInterpreterClass());
955 }
956 }
957
958 return null;
959 }
960
961 /**
962 * Gets the default preferences of the portlet.
963 *
964 * @return the default preferences of the portlet
965 */
966 public String getDefaultPreferences() {
967 if (Validator.isNull(_defaultPreferences)) {
968 return PortletConstants.DEFAULT_PREFERENCES;
969 }
970 else {
971 return _defaultPreferences;
972 }
973 }
974
975 /**
976 * Sets the default preferences of the portlet.
977 *
978 * @param defaultPreferences the default preferences of the portlet
979 */
980 public void setDefaultPreferences(String defaultPreferences) {
981 _defaultPreferences = defaultPreferences;
982 }
983
984 /**
985 * Gets the name of the preferences validator class of the portlet.
986 *
987 * @return the name of the preferences validator class of the portlet
988 */
989 public String getPreferencesValidator() {
990 return _prefsValidator;
991 }
992
993 /**
994 * Sets the name of the preferences validator class of the portlet.
995 *
996 * @param prefsValidator the name of the preferences validator class
997 * of the portlet
998 */
999 public void setPreferencesValidator(String prefsValidator) {
1000 if (prefsValidator != null) {
1001
1002 // Trim this because XDoclet generates preferences validators with
1003 // extra white spaces
1004
1005 _prefsValidator = prefsValidator.trim();
1006 }
1007 else {
1008 _prefsValidator = null;
1009 }
1010 }
1011
1012 /**
1013 * Returns true if preferences are shared across the entire company.
1014 *
1015 * @return true if preferences are shared across the entire company
1016 */
1017 public boolean getPreferencesCompanyWide() {
1018 return _prefsCompanyWide;
1019 }
1020
1021 /**
1022 * Returns true if preferences are shared across the entire company.
1023 *
1024 * @return true if preferences are shared across the entire company
1025 */
1026 public boolean isPreferencesCompanyWide() {
1027 return _prefsCompanyWide;
1028 }
1029
1030 /**
1031 * Sets to true if preferences are shared across the entire company.
1032 *
1033 * @param prefsCompanyWide boolean value for whether preferences
1034 * are shared across the entire company
1035 */
1036 public void setPreferencesCompanyWide(boolean prefsCompanyWide) {
1037 _prefsCompanyWide = prefsCompanyWide;
1038 }
1039
1040 /**
1041 * Returns true if preferences are unique per layout.
1042 *
1043 * @return true if preferences are unique per layout
1044 */
1045 public boolean getPreferencesUniquePerLayout() {
1046 return _prefsUniquePerLayout;
1047 }
1048
1049 /**
1050 * Returns true if preferences are unique per layout.
1051 *
1052 * @return true if preferences are unique per layout
1053 */
1054 public boolean isPreferencesUniquePerLayout() {
1055 return _prefsUniquePerLayout;
1056 }
1057
1058 /**
1059 * Sets to true if preferences are unique per layout.
1060 *
1061 * @param prefsUniquePerLayout boolean value for whether preferences
1062 * are unique per layout
1063 */
1064 public void setPreferencesUniquePerLayout(boolean prefsUniquePerLayout) {
1065 _prefsUniquePerLayout = prefsUniquePerLayout;
1066 }
1067
1068 /**
1069 * Returns true if preferences are owned by the group when the portlet is
1070 * shown in a group layout. Returns false if preferences are owned by the
1071 * user at all times.
1072 *
1073 * @return true if preferences are owned by the group when the portlet
1074 * is shown in a group layout; false if preferences are owned
1075 * by the user at all times.
1076 */
1077 public boolean getPreferencesOwnedByGroup() {
1078 return _prefsOwnedByGroup;
1079 }
1080
1081 /**
1082 * Returns true if preferences are owned by the group when the portlet is
1083 * shown in a group layout. Returns false if preferences are owned by the
1084 * user at all times.
1085 *
1086 * @return true if preferences are owned by the group when the portlet
1087 * is shown in a group layout; false if preferences are owned
1088 * by the user at all times.
1089 */
1090 public boolean isPreferencesOwnedByGroup() {
1091 return _prefsOwnedByGroup;
1092 }
1093
1094 /**
1095 * Sets to true if preferences are owned by the group when the portlet is
1096 * shown in a group layout. Sets to false if preferences are owned by the
1097 * user at all times.
1098 *
1099 * @param prefsOwnedByGroup boolean value for whether preferences are
1100 * owned by the group when the portlet is shown in a group
1101 * layout or preferences are owned by the user at all times
1102 */
1103 public void setPreferencesOwnedByGroup(boolean prefsOwnedByGroup) {
1104 _prefsOwnedByGroup = prefsOwnedByGroup;
1105 }
1106
1107 /**
1108 * Returns true if the portlet uses the default template.
1109 *
1110 * @return true if the portlet uses the default template
1111 */
1112 public boolean getUseDefaultTemplate() {
1113 return _useDefaultTemplate;
1114 }
1115
1116 /**
1117 * Returns true if the portlet uses the default template.
1118 *
1119 * @return true if the portlet uses the default template
1120 */
1121 public boolean isUseDefaultTemplate() {
1122 return _useDefaultTemplate;
1123 }
1124
1125 /**
1126 * Sets to true if the portlet uses the default template.
1127 *
1128 * @param useDefaultTemplate boolean value for whether the portlet
1129 * uses the default template
1130 */
1131 public void setUseDefaultTemplate(boolean useDefaultTemplate) {
1132 _useDefaultTemplate = useDefaultTemplate;
1133 }
1134
1135 /**
1136 * Returns true if users are shown that they do not have access to the
1137 * portlet.
1138 *
1139 * @return true if users are shown that they do not have access to the
1140 * portlet
1141 */
1142 public boolean getShowPortletAccessDenied() {
1143 return _showPortletAccessDenied;
1144 }
1145
1146 /**
1147 * Returns true if users are shown that they do not have access to the
1148 * portlet.
1149 *
1150 * @return true if users are shown that they do not have access to the
1151 * portlet
1152 */
1153 public boolean isShowPortletAccessDenied() {
1154 return _showPortletAccessDenied;
1155 }
1156
1157 /**
1158 * Sets to true if users are shown that they do not have access to the
1159 * portlet.
1160 *
1161 * @param showPortletAccessDenied boolean value for whether users are
1162 * shown that they do not have access to the portlet
1163 */
1164 public void setShowPortletAccessDenied(boolean showPortletAccessDenied) {
1165 _showPortletAccessDenied = showPortletAccessDenied;
1166 }
1167
1168 /**
1169 * Returns true if users are shown that the portlet is inactive.
1170 *
1171 * @return true if users are shown that the portlet is inactive
1172 */
1173 public boolean getShowPortletInactive() {
1174 return _showPortletInactive;
1175 }
1176
1177 /**
1178 * Returns true if users are shown that the portlet is inactive.
1179 *
1180 * @return true if users are shown that the portlet is inactive
1181 */
1182 public boolean isShowPortletInactive() {
1183 return _showPortletInactive;
1184 }
1185
1186 /**
1187 * Sets to true if users are shown that the portlet is inactive.
1188 *
1189 * @param showPortletInactive boolean value for whether users are
1190 * shown that the portlet is inactive
1191 */
1192 public void setShowPortletInactive(boolean showPortletInactive) {
1193 _showPortletInactive = showPortletInactive;
1194 }
1195
1196 /**
1197 * Returns true if an action URL for this portlet should cause an auto
1198 * redirect.
1199 *
1200 * @return true if an action URL for this portlet should cause an auto
1201 * redirect
1202 */
1203 public boolean getActionURLRedirect() {
1204 return _actionURLRedirect;
1205 }
1206
1207 /**
1208 * Returns true if an action URL for this portlet should cause an auto
1209 * redirect.
1210 *
1211 * @return true if an action URL for this portlet should cause an auto
1212 * redirect
1213 */
1214 public boolean isActionURLRedirect() {
1215 return _actionURLRedirect;
1216 }
1217
1218 /**
1219 * Sets to true if an action URL for this portlet should cause an auto
1220 * redirect.
1221 *
1222 * @param actionURLRedirect boolean value for whether an action URL
1223 * for this portlet should cause an auto redirect
1224 */
1225 public void setActionURLRedirect(boolean actionURLRedirect) {
1226 _actionURLRedirect = actionURLRedirect;
1227 }
1228
1229 /**
1230 * Returns true if the portlet restores to the current view from the
1231 * maximized state.
1232 *
1233 * @return true if the portlet restores to the current view from the
1234 * maximized state
1235 */
1236 public boolean getRestoreCurrentView() {
1237 return _restoreCurrentView;
1238 }
1239
1240 /**
1241 * Returns true if the portlet restores to the current view from the
1242 * maximized state.
1243 *
1244 * @return true if the portlet restores to the current view from the
1245 * maximized state
1246 */
1247 public boolean isRestoreCurrentView() {
1248 return _restoreCurrentView;
1249 }
1250
1251 /**
1252 * Sets to true if the portlet restores to the current view from the
1253 * maximized state.
1254 *
1255 * @param restoreCurrentView boolean value for whether the portlet
1256 * restores to the current view from the maximized state
1257 */
1258 public void setRestoreCurrentView(boolean restoreCurrentView) {
1259 _restoreCurrentView = restoreCurrentView;
1260 }
1261
1262 /**
1263 * Returns true if the portlet goes into the maximized state when the user
1264 * goes into the edit mode.
1265 *
1266 * @return true if the portlet goes into the maximized state when the
1267 * user goes into the edit mode
1268 */
1269 public boolean getMaximizeEdit() {
1270 return _maximizeEdit;
1271 }
1272
1273 /**
1274 * Returns true if the portlet goes into the maximized state when the user
1275 * goes into the edit mode.
1276 *
1277 * @return true if the portlet goes into the maximized state when the
1278 * user goes into the edit mode
1279 */
1280 public boolean isMaximizeEdit() {
1281 return _maximizeEdit;
1282 }
1283
1284 /**
1285 * Sets to true if the portlet goes into the maximized state when the user
1286 * goes into the edit mode.
1287 *
1288 * @param maximizeEdit boolean value for whether the portlet goes into
1289 * the maximized state when the user goes into the edit mode
1290 */
1291 public void setMaximizeEdit(boolean maximizeEdit) {
1292 _maximizeEdit = maximizeEdit;
1293 }
1294
1295 /**
1296 * Returns true if the portlet goes into the maximized state when the user
1297 * goes into the help mode.
1298 *
1299 * @return true if the portlet goes into the maximized state when the
1300 * user goes into the help mode
1301 */
1302 public boolean getMaximizeHelp() {
1303 return _maximizeHelp;
1304 }
1305
1306 /**
1307 * Returns true if the portlet goes into the maximized state when the user
1308 * goes into the help mode.
1309 *
1310 * @return true if the portlet goes into the maximized state when the
1311 * user goes into the help mode
1312 */
1313 public boolean isMaximizeHelp() {
1314 return _maximizeHelp;
1315 }
1316
1317 /**
1318 * Sets to true if the portlet goes into the maximized state when the user
1319 * goes into the help mode.
1320 *
1321 * @param maximizeHelp boolean value for whether the portlet goes into
1322 * the maximized state when the user goes into the help mode
1323 */
1324 public void setMaximizeHelp(boolean maximizeHelp) {
1325 _maximizeHelp = maximizeHelp;
1326 }
1327
1328 /**
1329 * Returns true if the portlet goes into the pop up state when the user goes
1330 * into the print mode.
1331 *
1332 * @return true if the portlet goes into the pop up state when the user
1333 * goes into the print mode
1334 */
1335 public boolean getPopUpPrint() {
1336 return _popUpPrint;
1337 }
1338
1339 /**
1340 * Returns true if the portlet goes into the pop up state when the user goes
1341 * into the print mode.
1342 *
1343 * @return true if the portlet goes into the pop up state when the user
1344 * goes into the print mode
1345 */
1346 public boolean isPopUpPrint() {
1347 return _popUpPrint;
1348 }
1349
1350 /**
1351 * Sets to true if the portlet goes into the pop up state when the user goes
1352 * into the print mode.
1353 *
1354 * @param popUpPrint boolean value for whether the portlet goes into
1355 * the pop up state when the user goes into the print mode
1356 */
1357 public void setPopUpPrint(boolean popUpPrint) {
1358 _popUpPrint = popUpPrint;
1359 }
1360
1361 /**
1362 * Returns true to allow the portlet to be cached within the layout.
1363 *
1364 * @return true if the portlet can be cached within the layout
1365 */
1366 public boolean getLayoutCacheable() {
1367 return _layoutCacheable;
1368 }
1369
1370 /**
1371 * Returns true to allow the portlet to be cached within the layout.
1372 *
1373 * @return true if the portlet can be cached within the layout
1374 */
1375 public boolean isLayoutCacheable() {
1376 return _layoutCacheable;
1377 }
1378
1379 /**
1380 * Sets to true to allow the portlet to be cached within the layout.
1381 *
1382 * @param layoutCacheable boolean value for whether the portlet can be
1383 * cached within the layout
1384 */
1385 public void setLayoutCacheable(boolean layoutCacheable) {
1386 _layoutCacheable = layoutCacheable;
1387 }
1388
1389 /**
1390 * Returns true if the portlet can be added multiple times to a layout.
1391 *
1392 * @return true if the portlet can be added multiple times to a layout
1393 */
1394 public boolean getInstanceable() {
1395 return _instanceable;
1396 }
1397
1398 /**
1399 * Returns true if the portlet can be added multiple times to a layout.
1400 *
1401 * @return true if the portlet can be added multiple times to a layout
1402 */
1403 public boolean isInstanceable() {
1404 return _instanceable;
1405 }
1406
1407 /**
1408 * Sets to true if the portlet can be added multiple times to a layout.
1409 *
1410 * @param instanceable boolean value for whether the portlet can be
1411 * added multiple times to a layout
1412 */
1413 public void setInstanceable(boolean instanceable) {
1414 _instanceable = instanceable;
1415 }
1416
1417 /**
1418 * Gets the user principal strategy of the portlet.
1419 *
1420 * @return the user principal strategy of the portlet
1421 */
1422 public String getUserPrincipalStrategy() {
1423 return _userPrincipalStrategy;
1424 }
1425
1426 /**
1427 * Sets the user principal strategy of the portlet.
1428 *
1429 * @param userPrincipalStrategy the user principal strategy of the
1430 * portlet
1431 */
1432 public void setUserPrincipalStrategy(String userPrincipalStrategy) {
1433 if (Validator.isNotNull(userPrincipalStrategy)) {
1434 _userPrincipalStrategy = userPrincipalStrategy;
1435 }
1436 }
1437
1438 /**
1439 * Returns true if the portlet does not share request attributes with the
1440 * portal or portlets from another WAR.
1441 *
1442 * @return true if the portlet does not share request attributes with
1443 * the portal or portlets from another WAR
1444 */
1445 public boolean getPrivateRequestAttributes() {
1446 return _privateRequestAttributes;
1447 }
1448
1449 /**
1450 * Returns true if the portlet does not share request attributes with the
1451 * portal or portlets from another WAR.
1452 *
1453 * @return true if the portlet does not share request attributes with
1454 * the portal or portlets from another WAR
1455 */
1456 public boolean isPrivateRequestAttributes() {
1457 return _privateRequestAttributes;
1458 }
1459
1460 /**
1461 * Sets to true if the portlet does not share request attributes with the
1462 * portal or portlets from another WAR.
1463 *
1464 * @param privateRequestAttributes boolean value for whether the
1465 * portlet shares request attributes with the portal or
1466 * portlets from another WAR
1467 */
1468 public void setPrivateRequestAttributes(boolean privateRequestAttributes) {
1469 _privateRequestAttributes = privateRequestAttributes;
1470 }
1471
1472 /**
1473 * Returns true if the portlet does not share session attributes with the
1474 * portal.
1475 *
1476 * @return true if the portlet does not share session attributes with
1477 * the portal
1478 */
1479 public boolean getPrivateSessionAttributes() {
1480 return _privateSessionAttributes;
1481 }
1482
1483 /**
1484 * Returns true if the portlet does not share session attributes with the
1485 * portal.
1486 *
1487 * @return true if the portlet does not share session attributes with
1488 * the portal
1489 */
1490 public boolean isPrivateSessionAttributes() {
1491 return _privateSessionAttributes;
1492 }
1493
1494 /**
1495 * Sets to true if the portlet does not share session attributes with the
1496 * portal.
1497 *
1498 * @param privateSessionAttributes boolean value for whether the
1499 * portlet shares session attributes with the portal
1500 */
1501 public void setPrivateSessionAttributes(boolean privateSessionAttributes) {
1502 _privateSessionAttributes = privateSessionAttributes;
1503 }
1504
1505 /**
1506 * Returns the render weight of the portlet.
1507 *
1508 * @return the render weight of the portlet
1509 */
1510 public int getRenderWeight() {
1511 return _renderWeight;
1512 }
1513
1514 /**
1515 * Sets the render weight of the portlet.
1516 *
1517 * @param renderWeight int value for the render weight of the portlet
1518 */
1519 public void setRenderWeight(int renderWeight) {
1520 _renderWeight = renderWeight;
1521 }
1522
1523 /**
1524 * Returns true if the portlet can be displayed via Ajax.
1525 *
1526 * @return true if the portlet can be displayed via Ajax
1527 */
1528 public boolean getAjaxable() {
1529 return _ajaxable;
1530 }
1531
1532 /**
1533 * Returns true if the portlet can be displayed via Ajax.
1534 *
1535 * @return true if the portlet can be displayed via Ajax
1536 */
1537 public boolean isAjaxable() {
1538 return _ajaxable;
1539 }
1540
1541 /**
1542 * Sets to true if the portlet can be displayed via Ajax.
1543 *
1544 * @param ajaxable boolean value for whether the portlet can be
1545 * displayed via Ajax
1546 */
1547 public void setAjaxable(boolean ajaxable) {
1548 _ajaxable = ajaxable;
1549 }
1550
1551 /**
1552 * Gets a list of CSS files that will be referenced from the page's header
1553 * relative to the portal's context path.
1554 *
1555 * @return a list of CSS files that will be referenced from the page's
1556 * header relative to the portal's context path
1557 */
1558 public List<String> getHeaderPortalCss() {
1559 return _headerPortalCss;
1560 }
1561
1562 /**
1563 * Sets a list of CSS files that will be referenced from the page's header
1564 * relative to the portal's context path.
1565 *
1566 * @param headerPortalCss a list of CSS files that will be referenced
1567 * from the page's header relative to the portal's context path
1568 */
1569 public void setHeaderPortalCss(List<String> headerPortalCss) {
1570 _headerPortalCss = headerPortalCss;
1571 }
1572
1573 /**
1574 * Gets a list of CSS files that will be referenced from the page's header
1575 * relative to the portlet's context path.
1576 *
1577 * @return a list of CSS files that will be referenced from the page's
1578 * header relative to the portlet's context path
1579 */
1580 public List<String> getHeaderPortletCss() {
1581 return _headerPortletCss;
1582 }
1583
1584 /**
1585 * Sets a list of CSS files that will be referenced from the page's header
1586 * relative to the portlet's context path.
1587 *
1588 * @param headerPortletCss a list of CSS files that will be referenced
1589 * from the page's header relative to the portlet's context
1590 * path
1591 */
1592 public void setHeaderPortletCss(List<String> headerPortletCss) {
1593 _headerPortletCss = headerPortletCss;
1594 }
1595
1596 /**
1597 * Gets a list of JavaScript files that will be referenced from the page's
1598 * header relative to the portal's context path.
1599 *
1600 * @return a list of JavaScript files that will be referenced from the
1601 * page's header relative to the portal's context path
1602 */
1603 public List<String> getHeaderPortalJavaScript() {
1604 return _headerPortalJavaScript;
1605 }
1606
1607 /**
1608 * Sets a list of JavaScript files that will be referenced from the page's
1609 * header relative to the portal's context path.
1610 *
1611 * @param headerPortalJavaScript a list of JavaScript files that will
1612 * be referenced from the page's header relative to the
1613 * portal's context path
1614 */
1615 public void setHeaderPortalJavaScript(List<String> headerPortalJavaScript) {
1616 _headerPortalJavaScript = headerPortalJavaScript;
1617 }
1618
1619 /**
1620 * Gets a list of JavaScript files that will be referenced from the page's
1621 * header relative to the portlet's context path.
1622 *
1623 * @return a list of JavaScript files that will be referenced from the
1624 * page's header relative to the portlet's context path
1625 */
1626 public List<String> getHeaderPortletJavaScript() {
1627 return _headerPortletJavaScript;
1628 }
1629
1630 /**
1631 * Sets a list of JavaScript files that will be referenced from the page's
1632 * header relative to the portlet's context path.
1633 *
1634 * @param headerPortletJavaScript a list of JavaScript files that will
1635 * be referenced from the page's header relative to the
1636 * portlet's context path
1637 */
1638 public void setHeaderPortletJavaScript(
1639 List<String> headerPortletJavaScript) {
1640
1641 _headerPortletJavaScript = headerPortletJavaScript;
1642 }
1643
1644 /**
1645 * Gets a list of CSS files that will be referenced from the page's footer
1646 * relative to the portal's context path.
1647 *
1648 * @return a list of CSS files that will be referenced from the page's
1649 * footer relative to the portal's context path
1650 */
1651 public List<String> getFooterPortalCss() {
1652 return _footerPortalCss;
1653 }
1654
1655 /**
1656 * Sets a list of CSS files that will be referenced from the page's footer
1657 * relative to the portal's context path.
1658 *
1659 * @param footerPortalCss a list of CSS files that will be referenced
1660 * from the page's footer relative to the portal's context path
1661 */
1662 public void setFooterPortalCss(List<String> footerPortalCss) {
1663 _footerPortalCss = footerPortalCss;
1664 }
1665
1666 /**
1667 * Gets a list of CSS files that will be referenced from the page's footer
1668 * relative to the portlet's context path.
1669 *
1670 * @return a list of CSS files that will be referenced from the page's
1671 * footer relative to the portlet's context path
1672 */
1673 public List<String> getFooterPortletCss() {
1674 return _footerPortletCss;
1675 }
1676
1677 /**
1678 * Sets a list of CSS files that will be referenced from the page's footer
1679 * relative to the portlet's context path.
1680 *
1681 * @param footerPortletCss a list of CSS files that will be referenced
1682 * from the page's footer relative to the portlet's context
1683 * path
1684 */
1685 public void setFooterPortletCss(List<String> footerPortletCss) {
1686 _footerPortletCss = footerPortletCss;
1687 }
1688
1689 /**
1690 * Gets a list of JavaScript files that will be referenced from the page's
1691 * footer relative to the portal's context path.
1692 *
1693 * @return a list of JavaScript files that will be referenced from the
1694 * page's footer relative to the portal's context path
1695 */
1696 public List<String> getFooterPortalJavaScript() {
1697 return _footerPortalJavaScript;
1698 }
1699
1700 /**
1701 * Sets a list of JavaScript files that will be referenced from the page's
1702 * footer relative to the portal's context path.
1703 *
1704 * @param footerPortalJavaScript a list of JavaScript files that will
1705 * be referenced from the page's footer relative to the
1706 * portal's context path
1707 */
1708 public void setFooterPortalJavaScript(List<String> footerPortalJavaScript) {
1709 _footerPortalJavaScript = footerPortalJavaScript;
1710 }
1711
1712 /**
1713 * Gets a list of JavaScript files that will be referenced from the page's
1714 * footer relative to the portlet's context path.
1715 *
1716 * @return a list of JavaScript files that will be referenced from the
1717 * page's footer relative to the portlet's context path
1718 */
1719 public List<String> getFooterPortletJavaScript() {
1720 return _footerPortletJavaScript;
1721 }
1722
1723 /**
1724 * Sets a list of JavaScript files that will be referenced from the page's
1725 * footer relative to the portlet's context path.
1726 *
1727 * @param footerPortletJavaScript a list of JavaScript files that will
1728 * be referenced from the page's footer relative to the
1729 * portlet's context path
1730 */
1731 public void setFooterPortletJavaScript(
1732 List<String> footerPortletJavaScript) {
1733
1734 _footerPortletJavaScript = footerPortletJavaScript;
1735 }
1736
1737 /**
1738 * Gets the name of the CSS class that will be injected in the DIV that
1739 * wraps this portlet.
1740 *
1741 * @return the name of the CSS class that will be injected in the DIV
1742 * that wraps this portlet
1743 */
1744 public String getCssClassWrapper() {
1745 return _cssClassWrapper;
1746 }
1747
1748 /**
1749 * Sets the name of the CSS class that will be injected in the DIV that
1750 * wraps this portlet.
1751 *
1752 * @param cssClassWrapper the name of the CSS class that will be
1753 * injected in the DIV that wraps this portlet
1754 */
1755 public void setCssClassWrapper(String cssClassWrapper) {
1756 _cssClassWrapper = cssClassWrapper;
1757 }
1758
1759 /**
1760 * Gets the Facebook integration method of the portlet.
1761 *
1762 * @return the Facebook integration method of the portlet
1763 */
1764 public String getFacebookIntegration() {
1765 return _facebookIntegration;
1766 }
1767
1768 /**
1769 * Sets the Facebook integration method of the portlet.
1770 *
1771 * @param facebookIntegration the Facebook integration method of the
1772 * portlet
1773 */
1774 public void setFacebookIntegration(String facebookIntegration) {
1775 if (Validator.isNotNull(facebookIntegration)) {
1776 _facebookIntegration = facebookIntegration;
1777 }
1778 }
1779
1780 /**
1781 * Returns true if default resources for the portlet are added to a page.
1782 *
1783 * @return true if default resources for the portlet are added to a
1784 * page
1785 */
1786 public boolean getAddDefaultResource() {
1787 return _addDefaultResource;
1788 }
1789
1790 /**
1791 * Returns true if default resources for the portlet are added to a page.
1792 *
1793 * @return true if default resources for the portlet are added to a
1794 * page
1795 */
1796 public boolean isAddDefaultResource() {
1797 return _addDefaultResource;
1798 }
1799
1800 /**
1801 * Sets to true if default resources for the portlet are added to a page.
1802 *
1803 * @param addDefaultResource boolean value for whether or not default
1804 * resources for the portlet are added to a page
1805 */
1806 public void setAddDefaultResource(boolean addDefaultResource) {
1807 _addDefaultResource = addDefaultResource;
1808 }
1809
1810 /**
1811 * Sets a string of ordered comma delimited portlet ids.
1812 *
1813 * @param roles a string of ordered comma delimited portlet ids
1814 */
1815 public void setRoles(String roles) {
1816 _rolesArray = StringUtil.split(roles);
1817
1818 super.setRoles(roles);
1819 }
1820
1821 /**
1822 * Gets an array of required roles of the portlet.
1823 *
1824 * @return an array of required roles of the portlet
1825 */
1826 public String[] getRolesArray() {
1827 return _rolesArray;
1828 }
1829
1830 /**
1831 * Sets an array of required roles of the portlet.
1832 *
1833 * @param rolesArray an array of required roles of the portlet
1834 */
1835 public void setRolesArray(String[] rolesArray) {
1836 _rolesArray = rolesArray;
1837
1838 super.setRoles(StringUtil.merge(rolesArray));
1839 }
1840
1841 /**
1842 * Gets the unlinked roles of the portlet.
1843 *
1844 * @return unlinked roles of the portlet
1845 */
1846 public Set<String> getUnlinkedRoles() {
1847 return _unlinkedRoles;
1848 }
1849
1850 /**
1851 * Sets the unlinked roles of the portlet.
1852 *
1853 * @param unlinkedRoles the unlinked roles of the portlet
1854 */
1855 public void setUnlinkedRoles(Set<String> unlinkedRoles) {
1856 _unlinkedRoles = unlinkedRoles;
1857 }
1858
1859 /**
1860 * Gets the role mappers of the portlet.
1861 *
1862 * @return role mappers of the portlet
1863 */
1864 public Map<String, String> getRoleMappers() {
1865 return _roleMappers;
1866 }
1867
1868 /**
1869 * Sets the role mappers of the portlet.
1870 *
1871 * @param roleMappers the role mappers of the portlet
1872 */
1873 public void setRoleMappers(Map<String, String> roleMappers) {
1874 _roleMappers = roleMappers;
1875 }
1876
1877 /**
1878 * Link the role names set in portlet.xml with the Liferay roles set in
1879 * liferay-portlet.xml.
1880 */
1881 public void linkRoles() {
1882 List<String> linkedRoles = new ArrayList<String>();
1883
1884 Iterator<String> itr = _unlinkedRoles.iterator();
1885
1886 while (itr.hasNext()) {
1887 String unlinkedRole = itr.next();
1888
1889 String roleLink = _roleMappers.get(unlinkedRole);
1890
1891 if (Validator.isNotNull(roleLink)) {
1892 if (_log.isDebugEnabled()) {
1893 _log.debug(
1894 "Linking role for portlet [" + getPortletId() +
1895 "] with role-name [" + unlinkedRole +
1896 "] to role-link [" + roleLink + "]");
1897 }
1898
1899 linkedRoles.add(roleLink);
1900 }
1901 else {
1902 _log.error(
1903 "Unable to link role for portlet [" + getPortletId() +
1904 "] with role-name [" + unlinkedRole +
1905 "] because role-link is null");
1906 }
1907 }
1908
1909 String[] array = linkedRoles.toArray(new String[linkedRoles.size()]);
1910
1911 Arrays.sort(array);
1912
1913 setRolesArray(array);
1914 }
1915
1916 /**
1917 * Returns true if the portlet has a role with the specified name.
1918 *
1919 * @return true if the portlet has a role with the specified name
1920 */
1921 public boolean hasRoleWithName(String roleName) {
1922 if ((_rolesArray == null) || (_rolesArray.length == 0)) {
1923 return false;
1924 }
1925
1926 for (int i = 0; i < _rolesArray.length; i++) {
1927 if (_rolesArray[i].equalsIgnoreCase(roleName)) {
1928 return true;
1929 }
1930 }
1931
1932 return false;
1933 }
1934
1935 /**
1936 * Returns true if the user has the permission to add the portlet to a
1937 * layout.
1938 *
1939 * @return true if the user has the permission to add the portlet to a
1940 * layout
1941 */
1942 public boolean hasAddPortletPermission(long userId) {
1943 try {
1944 if ((_rolesArray == null) || (_rolesArray.length == 0)) {
1945 return true;
1946 }
1947 else if (RoleLocalServiceUtil.hasUserRoles(
1948 userId, getCompanyId(), _rolesArray, true)) {
1949
1950 return true;
1951 }
1952 else if (RoleLocalServiceUtil.hasUserRole(
1953 userId, getCompanyId(), RoleConstants.ADMINISTRATOR,
1954 true)) {
1955
1956 return true;
1957 }
1958 else {
1959 User user = UserLocalServiceUtil.getUserById(userId);
1960
1961 if (user.isDefaultUser() &&
1962 hasRoleWithName(RoleConstants.GUEST)) {
1963
1964 return true;
1965 }
1966 }
1967 }
1968 catch (Exception e) {
1969 _log.error(e);
1970 }
1971
1972 return false;
1973 }
1974
1975 /**
1976 * Returns true if the portlet is a system portlet that a user cannot
1977 * manually add to their page.
1978 *
1979 * @return true if the portlet is a system portlet that a user cannot
1980 * manually add to their page
1981 */
1982 public boolean getSystem() {
1983 return _system;
1984 }
1985
1986 /**
1987 * Returns true if the portlet is a system portlet that a user cannot
1988 * manually add to their page.
1989 *
1990 * @return true if the portlet is a system portlet that a user cannot
1991 * manually add to their page
1992 */
1993 public boolean isSystem() {
1994 return _system;
1995 }
1996
1997 /**
1998 * Sets to true if the portlet is a system portlet that a user cannot
1999 * manually add to their page.
2000 *
2001 * @param system boolean value for whether the portlet is a system
2002 * portlet that a user cannot manually add to their page
2003 */
2004 public void setSystem(boolean system) {
2005 _system = system;
2006 }
2007
2008 /**
2009 * Returns true to include the portlet and make it available to be made
2010 * active.
2011 *
2012 * @return true to include the portlet and make it available to be made
2013 * active
2014 */
2015 public boolean getInclude() {
2016 return _include;
2017 }
2018
2019 /**
2020 * Returns true to include the portlet and make it available to be made
2021 * active.
2022 *
2023 * @return true to include the portlet and make it available to be made
2024 * active
2025 */
2026 public boolean isInclude() {
2027 return _include;
2028 }
2029
2030 /**
2031 * Sets to true to include the portlet and make it available to be made
2032 * active.
2033 *
2034 * @param include boolean value for whether to include the portlet and
2035 * make it available to be made active
2036 */
2037 public void setInclude(boolean include) {
2038 _include = include;
2039 }
2040
2041 /**
2042 * Gets the init parameters of the portlet.
2043 *
2044 * @return init parameters of the portlet
2045 */
2046 public Map<String, String> getInitParams() {
2047 return _initParams;
2048 }
2049
2050 /**
2051 * Sets the init parameters of the portlet.
2052 *
2053 * @param initParams the init parameters of the portlet
2054 */
2055 public void setInitParams(Map<String, String> initParams) {
2056 _initParams = initParams;
2057 }
2058
2059 /**
2060 * Gets expiration cache of the portlet.
2061 *
2062 * @return expiration cache of the portlet
2063 */
2064 public Integer getExpCache() {
2065 return _expCache;
2066 }
2067
2068 /**
2069 * Sets expiration cache of the portlet.
2070 *
2071 * @param expCache expiration cache of the portlet
2072 */
2073 public void setExpCache(Integer expCache) {
2074 _expCache = expCache;
2075 }
2076
2077 /**
2078 * Gets the portlet modes of the portlet.
2079 *
2080 * @return portlet modes of the portlet
2081 */
2082 public Map<String, Set<String>> getPortletModes() {
2083 return _portletModes;
2084 }
2085
2086 /**
2087 * Sets the portlet modes of the portlet.
2088 *
2089 * @param portletModes the portlet modes of the portlet
2090 */
2091 public void setPortletModes(Map<String, Set<String>> portletModes) {
2092 _portletModes = portletModes;
2093 }
2094
2095 /**
2096 * Returns true if the portlet supports the specified mime type and
2097 * portlet mode.
2098 *
2099 * @return true if the portlet supports the specified mime type and
2100 * portlet mode
2101 */
2102 public boolean hasPortletMode(String mimeType, PortletMode portletMode) {
2103 if (mimeType == null) {
2104 mimeType = ContentTypes.TEXT_HTML;
2105 }
2106
2107 Set<String> mimeTypePortletModes = _portletModes.get(mimeType);
2108
2109 if (mimeTypePortletModes == null) {
2110 return false;
2111 }
2112
2113 if (mimeTypePortletModes.contains(portletMode.toString())) {
2114 return true;
2115 }
2116 else {
2117 return false;
2118 }
2119 }
2120
2121 /**
2122 * Gets a list of all portlet modes supported by the portlet.
2123 *
2124 * @return a list of all portlet modes supported by the portlet
2125 */
2126 public Set<String> getAllPortletModes() {
2127 Set<String> allPortletModes = new TreeSet<String>();
2128
2129 Iterator<Map.Entry <String, Set<String>>> itr1 =
2130 _portletModes.entrySet().iterator();
2131
2132 while (itr1.hasNext()) {
2133 Map.Entry<String, Set<String>> entry = itr1.next();
2134
2135 Set<String> mimeTypePortletModes = entry.getValue();
2136
2137 Iterator<String> itr2 = mimeTypePortletModes.iterator();
2138
2139 while (itr2.hasNext()) {
2140 String portletMode = itr2.next();
2141
2142 allPortletModes.add(portletMode);
2143 }
2144 }
2145
2146 return allPortletModes;
2147 }
2148
2149 /**
2150 * Returns true if the portlet supports more than one mime type.
2151 *
2152 * @return true if the portlet supports more than one mime type
2153 */
2154 public boolean hasMultipleMimeTypes() {
2155 if (_portletModes.size() > 1) {
2156 return true;
2157 }
2158 else {
2159 return false;
2160 }
2161 }
2162
2163 /**
2164 * Gets the window states of the portlet.
2165 *
2166 * @return window states of the portlet
2167 */
2168 public Map<String, Set<String>> getWindowStates() {
2169 return _windowStates;
2170 }
2171
2172 /**
2173 * Sets the window states of the portlet.
2174 *
2175 * @param windowStates the window states of the portlet
2176 */
2177 public void setWindowStates(Map<String, Set<String>> windowStates) {
2178 _windowStates = windowStates;
2179 }
2180
2181 /**
2182 * Returns true if the portlet supports the specified mime type and
2183 * window state.
2184 *
2185 * @return true if the portlet supports the specified mime type and
2186 * window state
2187 */
2188 public boolean hasWindowState(String mimeType, WindowState windowState) {
2189 if (mimeType == null) {
2190 mimeType = ContentTypes.TEXT_HTML;
2191 }
2192
2193 Set<String> mimeTypeWindowStates = _windowStates.get(mimeType);
2194
2195 if (mimeTypeWindowStates == null) {
2196 return false;
2197 }
2198
2199 if (mimeTypeWindowStates.contains(windowState.toString())) {
2200 return true;
2201 }
2202 else {
2203 return false;
2204 }
2205 }
2206
2207 /**
2208 * Gets a list of all window states supported by the portlet.
2209 *
2210 * @return a list of all window states supported by the portlet
2211 */
2212 public Set<String> getAllWindowStates() {
2213 Set<String> allWindowStates = new TreeSet<String>();
2214
2215 Iterator<Map.Entry <String, Set<String>>> itr1 =
2216 _windowStates.entrySet().iterator();
2217
2218 while (itr1.hasNext()) {
2219 Map.Entry<String, Set<String>> entry = itr1.next();
2220
2221 Set<String> mimeTypeWindowStates = entry.getValue();
2222
2223 Iterator<String> itr2 = mimeTypeWindowStates.iterator();
2224
2225 while (itr2.hasNext()) {
2226 String windowState = itr2.next();
2227
2228 allWindowStates.add(windowState);
2229 }
2230 }
2231
2232 return allWindowStates;
2233 }
2234
2235 /**
2236 * Gets the supported locales of the portlet.
2237 *
2238 * @return supported locales of the portlet
2239 */
2240 public Set<String> getSupportedLocales() {
2241 return _supportedLocales;
2242 }
2243
2244 /**
2245 * Sets the supported locales of the portlet.
2246 *
2247 * @param supportedLocales the supported locales of the portlet
2248 */
2249 public void setSupportedLocales(Set<String> supportedLocales) {
2250 _supportedLocales = supportedLocales;
2251 }
2252
2253 /**
2254 * Gets the resource bundle of the portlet.
2255 *
2256 * @return resource bundle of the portlet
2257 */
2258 public String getResourceBundle() {
2259 return _resourceBundle;
2260 }
2261
2262 /**
2263 * Sets the resource bundle of the portlet.
2264 *
2265 * @param resourceBundle the resource bundle of the portlet
2266 */
2267 public void setResourceBundle(String resourceBundle) {
2268 _resourceBundle = resourceBundle;
2269 }
2270
2271 /**
2272 * Gets the portlet info of the portlet.
2273 *
2274 * @return portlet info of the portlet
2275 */
2276 public PortletInfo getPortletInfo() {
2277 return _portletInfo;
2278 }
2279
2280 /**
2281 * Sets the portlet info of the portlet.
2282 *
2283 * @param portletInfo the portlet info of the portlet
2284 */
2285 public void setPortletInfo(PortletInfo portletInfo) {
2286 _portletInfo = portletInfo;
2287 }
2288
2289 /**
2290 * Gets the filters of the portlet.
2291 *
2292 * @return filters of the portlet
2293 */
2294 public Map<String, PortletFilter> getPortletFilters() {
2295 return _portletFilters;
2296 }
2297
2298 /**
2299 * Sets the filters of the portlet.
2300 *
2301 * @param portletFilters the filters of the portlet
2302 */
2303 public void setPortletFilters(Map<String, PortletFilter> portletFilters) {
2304 _portletFilters = portletFilters;
2305 }
2306
2307 /**
2308 * Adds a supported processing event.
2309 *
2310 * @param publicRenderParameter a supported processing event
2311 */
2312 public void addProcessingEvent(QName processingEvent) {
2313 _processingEvents.add(processingEvent);
2314 _processingEventsByQName.put(
2315 QNameUtil.getKey(processingEvent), processingEvent);
2316 }
2317
2318 /**
2319 * Gets the supported processing event from a namespace URI and a local
2320 * part.
2321 *
2322 * @return the supported processing event from a namespace URI and a
2323 * local part
2324 */
2325 public QName getProcessingEvent(String uri, String localPart) {
2326 return _processingEventsByQName.get(
2327 QNameUtil.getKey(uri, localPart));
2328 }
2329
2330 /**
2331 * Gets the supported processing events of the portlet.
2332 *
2333 * @return supported processing events of the portlet
2334 */
2335 public Set<QName> getProcessingEvents() {
2336 return _processingEvents;
2337 }
2338
2339 /**
2340 * Sets the supported processing events of the portlet.
2341 *
2342 * @param processingEvents the supported processing events of the
2343 * portlet
2344 */
2345 public void setProcessingEvents(Set<QName> processingEvents) {
2346 for (QName processingEvent : processingEvents) {
2347 addProcessingEvent(processingEvent);
2348 }
2349 }
2350
2351 /**
2352 * Adds a supported publishing event.
2353 *
2354 * @param publicRenderParameter a supported publishing event
2355 */
2356 public void addPublishingEvent(QName publishingEvent) {
2357 _publishingEvents.add(publishingEvent);
2358 }
2359
2360 /**
2361 * Gets the supported publishing events of the portlet.
2362 *
2363 * @return supported publishing events of the portlet
2364 */
2365 public Set<QName> getPublishingEvents() {
2366 return _publishingEvents;
2367 }
2368
2369 /**
2370 * Sets the supported publishing events of the portlet.
2371 *
2372 * @param publishingEvents the supported publishing events of the
2373 * portlet
2374 */
2375 public void setPublishingEvents(Set<QName> publishingEvents) {
2376 for (QName publishingEvent : publishingEvents) {
2377 addPublishingEvent(publishingEvent);
2378 }
2379 }
2380
2381 /**
2382 * Adds a supported public render parameter.
2383 *
2384 * @param publicRenderParameter a supported public render parameter
2385 */
2386 public void addPublicRenderParameter(
2387 PublicRenderParameter publicRenderParameter) {
2388
2389 _publicRenderParameters.add(publicRenderParameter);
2390 _publicRenderParametersByIdentifier.put(
2391 publicRenderParameter.getIdentifier(), publicRenderParameter);
2392 _publicRenderParametersByQName.put(
2393 QNameUtil.getKey(publicRenderParameter.getQName()),
2394 publicRenderParameter);
2395 }
2396
2397 /**
2398 * Gets the supported public render parameter from an identifier.
2399 *
2400 * @return the supported public render parameter from an identifier
2401 */
2402 public PublicRenderParameter getPublicRenderParameter(String identifier) {
2403 return _publicRenderParametersByIdentifier.get(identifier);
2404 }
2405
2406 /**
2407 * Gets the supported public render parameter from a namespace URI and a
2408 * local part.
2409 *
2410 * @return the supported public render parameter from a namespace URI
2411 * and a local part
2412 */
2413 public PublicRenderParameter getPublicRenderParameter(
2414 String uri, String localPart) {
2415
2416 return _publicRenderParametersByQName.get(
2417 QNameUtil.getKey(uri, localPart));
2418 }
2419
2420 /**
2421 * Gets the supported public render parameters of the portlet.
2422 *
2423 * @return the supported public render parameters of the portlet
2424 */
2425 public Set<PublicRenderParameter> getPublicRenderParameters() {
2426 return _publicRenderParameters;
2427 }
2428
2429 /**
2430 * Sets the supported public render parameters of the portlet.
2431 *
2432 * @param publicRenderParameters the supported public render
2433 * parameters of the portlet
2434 */
2435 public void setPublicRenderParameters(
2436 Set<PublicRenderParameter> publicRenderParameters) {
2437
2438 for (PublicRenderParameter publicRenderParameter :
2439 publicRenderParameters) {
2440
2441 addPublicRenderParameter(publicRenderParameter);
2442 }
2443 }
2444
2445 /**
2446 * Gets the servlet context path of the portlet.
2447 *
2448 * @return the servlet context path of the portlet
2449 */
2450 public String getContextPath() {
2451 String virtualPath = getVirtualPath();
2452
2453 if (Validator.isNotNull(virtualPath)) {
2454 return virtualPath;
2455 }
2456
2457 if (_portletApp.isWARFile()) {
2458 StringBuilder sb = new StringBuilder();
2459
2460 sb.append(StringPool.SLASH);
2461 sb.append(_portletApp.getServletContextName());
2462
2463 return sb.toString();
2464 }
2465 else {
2466 return PortalUtil.getPathContext();
2467 }
2468 }
2469
2470 /**
2471 * Get the application this portlet belongs to.
2472 *
2473 * @return the application this portlet belongs to
2474 */
2475 public PortletApp getPortletApp() {
2476 return _portletApp;
2477 }
2478
2479 /**
2480 * Sets the application this portlet belongs to.
2481 *
2482 * @param portletApp the application this portlet belongs to
2483 */
2484 public void setPortletApp(PortletApp portletApp) {
2485 _portletApp = portletApp;
2486 }
2487
2488 /**
2489 * Returns true if the portlet is found in a WAR file.
2490 *
2491 * @param portletId the cloned instance portlet id
2492 * @return a cloned instance of the portlet
2493 */
2494 public Portlet getClonedInstance(String portletId) {
2495 if (_clonedInstances == null) {
2496
2497 // LEP-528
2498
2499 return null;
2500 }
2501
2502 Portlet clonedInstance = _clonedInstances.get(portletId);
2503
2504 if (clonedInstance == null) {
2505 clonedInstance = (Portlet)clone();
2506
2507 clonedInstance.setPortletId(portletId);
2508
2509 // Disable caching of cloned instances until we can figure out how
2510 // to elegantly refresh the cache when the portlet is dynamically
2511 // updated by the user. For example, the user might change the
2512 // portlet from one column to the next. Cloned instances that are
2513 // cached would not see the new change. We can then also cache
2514 // static portlet instances.
2515
2516 //_clonedInstances.put(portletId, clonedInstance);
2517 }
2518
2519 return clonedInstance;
2520 }
2521
2522 /**
2523 * Returns true if the portlet is a static portlet that is cannot be moved.
2524 *
2525 * @return true if the portlet is a static portlet that is cannot be
2526 * moved
2527 */
2528 public boolean getStatic() {
2529 return _staticPortlet;
2530 }
2531
2532 /**
2533 * Returns true if the portlet is a static portlet that is cannot be moved.
2534 *
2535 * @return true if the portlet is a static portlet that is cannot be
2536 * moved
2537 */
2538 public boolean isStatic() {
2539 return _staticPortlet;
2540 }
2541
2542 /**
2543 * Sets to true if the portlet is a static portlet that is cannot be moved.
2544 *
2545 * @param staticPortlet boolean value for whether the portlet is a
2546 * static portlet that cannot be moved
2547 */
2548 public void setStatic(boolean staticPortlet) {
2549 _staticPortlet = staticPortlet;
2550 }
2551
2552 /**
2553 * Returns true if the portlet is a static portlet at the start of a list of
2554 * portlets.
2555 *
2556 * @return true if the portlet is a static portlet at the start of a
2557 * list of portlets
2558 */
2559 public boolean getStaticStart() {
2560 return _staticPortletStart;
2561 }
2562
2563 /**
2564 * Returns true if the portlet is a static portlet at the start of a list of
2565 * portlets.
2566 *
2567 * @return true if the portlet is a static portlet at the start of a
2568 * list of portlets
2569 */
2570 public boolean isStaticStart() {
2571 return _staticPortletStart;
2572 }
2573
2574 /**
2575 * Sets to true if the portlet is a static portlet at the start of a list of
2576 * portlets.
2577 *
2578 * @param staticPortletStart boolean value for whether the portlet is
2579 * a static portlet at the start of a list of portlets
2580 */
2581 public void setStaticStart(boolean staticPortletStart) {
2582 _staticPortletStart = staticPortletStart;
2583 }
2584
2585 /**
2586 * Returns true if the portlet is a static portlet at the end of a list of
2587 * portlets.
2588 *
2589 * @return true if the portlet is a static portlet at the end of a
2590 * list of portlets
2591 */
2592 public boolean getStaticEnd() {
2593 return !_staticPortletStart;
2594 }
2595
2596 /**
2597 * Returns true if the portlet is a static portlet at the end of a list of
2598 * portlets.
2599 *
2600 * @return true if the portlet is a static portlet at the end of a
2601 * list of portlets
2602 */
2603 public boolean isStaticEnd() {
2604 return !_staticPortletStart;
2605 }
2606
2607 /**
2608 * Creates and returns a copy of this object.
2609 *
2610 * @return a copy of this object
2611 */
2612 public Object clone() {
2613 Portlet portlet = new PortletImpl(
2614 getPortletId(), getPluginPackage(), getDefaultPluginSetting(),
2615 getCompanyId(), getTimestamp(), getIcon(), getVirtualPath(),
2616 getStrutsPath(), getPortletName(), getDisplayName(),
2617 getPortletClass(), getConfigurationActionClass(), getIndexerClass(),
2618 getOpenSearchClass(), getSchedulerClass(), getPortletURLClass(),
2619 getFriendlyURLMapperClass(), getURLEncoderClass(),
2620 getPortletDataHandlerClass(), getPortletLayoutListenerClass(),
2621 getPollerProcessorClass(), getPopMessageListenerClass(),
2622 getSocialActivityInterpreterClass(),
2623 getSocialRequestInterpreterClass(), getDefaultPreferences(),
2624 getPreferencesValidator(), isPreferencesCompanyWide(),
2625 isPreferencesUniquePerLayout(), isPreferencesOwnedByGroup(),
2626 isUseDefaultTemplate(), isShowPortletAccessDenied(),
2627 isShowPortletInactive(), isActionURLRedirect(),
2628 isRestoreCurrentView(), isMaximizeEdit(), isMaximizeHelp(),
2629 isPopUpPrint(), isLayoutCacheable(), isInstanceable(),
2630 getUserPrincipalStrategy(), isPrivateRequestAttributes(),
2631 isPrivateSessionAttributes(), getRenderWeight(), isAjaxable(),
2632 getHeaderPortalCss(), getHeaderPortletCss(),
2633 getHeaderPortalJavaScript(), getHeaderPortletJavaScript(),
2634 getFooterPortalCss(), getFooterPortletCss(),
2635 getFooterPortalJavaScript(), getFooterPortletJavaScript(),
2636 getCssClassWrapper(), getFacebookIntegration(),
2637 isAddDefaultResource(), getRoles(), getUnlinkedRoles(),
2638 getRoleMappers(), isSystem(), isActive(), isInclude(),
2639 getInitParams(), getExpCache(), getPortletModes(),
2640 getWindowStates(), getSupportedLocales(), getResourceBundle(),
2641 getPortletInfo(), getPortletFilters(), getProcessingEvents(),
2642 getPublishingEvents(), getPublicRenderParameters(),
2643 getPortletApp());
2644
2645 portlet.setId(getId());
2646
2647 return portlet;
2648 }
2649
2650 /**
2651 * Compares this portlet to the specified object.
2652 *
2653 * @param portlet the portlet to compare this portlet against
2654 * @return the value 0 if the argument portlet is equal to this
2655 * portlet; a value less than -1 if this portlet is less than
2656 * the portlet argument; and 1 if this portlet is greater than
2657 * the portlet argument
2658 */
2659 public int compareTo(Portlet portlet) {
2660 return getPortletId().compareTo(portlet.getPortletId());
2661 }
2662
2663 /**
2664 * Checks whether this portlet is equal to the specified object.
2665 *
2666 * @param obj the object to compare this portlet against
2667 * @return true if the portlet is equal to the specified object
2668 */
2669 public boolean equals(Object obj) {
2670 Portlet portlet = (Portlet)obj;
2671
2672 return getPortletId().equals(portlet.getPortletId());
2673 }
2674
2675 /**
2676 * Log instance for this class.
2677 */
2678 private static Log _log = LogFactoryUtil.getLog(PortletImpl.class);
2679
2680 /**
2681 * Package this plugin belongs to.
2682 */
2683 private PluginPackage _pluginPackage;
2684
2685 /**
2686 * Plugin settings associated with the portlet.
2687 */
2688 private PluginSetting _defaultPluginSetting;
2689
2690 /**
2691 * The timestamp of the portlet.
2692 */
2693 private long _timestamp;
2694
2695 /**
2696 * The icon of the portlet.
2697 */
2698 private String _icon;
2699
2700 /**
2701 * The virtual path of the portlet.
2702 */
2703 private String _virtualPath;
2704
2705 /**
2706 * The struts path of the portlet.
2707 */
2708 private String _strutsPath;
2709
2710 /**
2711 * The name of the portlet.
2712 */
2713 private String _portletName;
2714
2715 /**
2716 * The display name of the portlet.
2717 */
2718 private String _displayName;
2719
2720 /**
2721 * The name of the portlet class of the portlet.
2722 */
2723 private String _portletClass;
2724
2725 /**
2726 * The configuration action class of the portlet.
2727 */
2728 private String _configurationActionClass;
2729
2730 /**
2731 * The name of the indexer class of the portlet.
2732 */
2733 private String _indexerClass;
2734
2735 /**
2736 * The name of the open search class of the portlet.
2737 */
2738 private String _openSearchClass;
2739
2740 /**
2741 * The name of the scheduler class of the portlet.
2742 */
2743 private String _schedulerClass;
2744
2745 /**
2746 * The name of the portlet URL class of the portlet.
2747 */
2748 private String _portletURLClass;
2749
2750 /**
2751 * The name of the friendly URL mapper class of the portlet.
2752 */
2753 private String _friendlyURLMapperClass;
2754
2755 /**
2756 * The name of the URL encoder class of the portlet.
2757 */
2758 private String _urlEncoderClass;
2759
2760 /**
2761 * The name of the portlet data handler class of the portlet.
2762 */
2763 private String _portletDataHandlerClass;
2764
2765 /**
2766 * The name of the portlet data layout listener class of the portlet.
2767 */
2768 private String _portletLayoutListenerClass;
2769
2770 /**
2771 * The name of the poller processor class of the portlet.
2772 */
2773 private String _pollerProcessorClass;
2774
2775 /**
2776 * The name of the POP message listener class of the portlet.
2777 */
2778 private String _popMessageListenerClass;
2779
2780 /**
2781 * The name of the social activity interpreter class of the portlet.
2782 */
2783 private String _socialActivityInterpreterClass;
2784
2785 /**
2786 * The name of the social request interpreter class of the portlet.
2787 */
2788 private String _socialRequestInterpreterClass;
2789
2790 /**
2791 * The default preferences of the portlet.
2792 */
2793 private String _defaultPreferences;
2794
2795 /**
2796 * The name of the preferences validator class of the portlet.
2797 */
2798 private String _prefsValidator;
2799
2800 /**
2801 * True if preferences are shared across the entire company.
2802 */
2803 private boolean _prefsCompanyWide;
2804
2805 /**
2806 * True if preferences are unique per layout.
2807 */
2808 private boolean _prefsUniquePerLayout = true;
2809
2810 /**
2811 * True if preferences are owned by the group when the portlet is shown in a
2812 * group layout. False if preferences are owned by the user at all times.
2813 */
2814 private boolean _prefsOwnedByGroup = true;
2815
2816 /**
2817 * True if the portlet uses the default template.
2818 */
2819 private boolean _useDefaultTemplate = true;
2820
2821 /**
2822 * True if users are shown that they do not have access to the portlet.
2823 */
2824 private boolean _showPortletAccessDenied =
2825 PropsValues.LAYOUT_SHOW_PORTLET_ACCESS_DENIED;
2826
2827 /**
2828 * True if users are shown that the portlet is inactive.
2829 */
2830 private boolean _showPortletInactive =
2831 PropsValues.LAYOUT_SHOW_PORTLET_INACTIVE;
2832
2833 /**
2834 * True if an action URL for this portlet should cause an auto redirect.
2835 */
2836 private boolean _actionURLRedirect;
2837
2838 /**
2839 * True if the portlet restores to the current view from the maximized
2840 * state.
2841 */
2842 private boolean _restoreCurrentView = true;
2843
2844 /**
2845 * True if the portlet goes into the maximized state when the user goes into
2846 * the edit mode.
2847 */
2848 private boolean _maximizeEdit;
2849
2850 /**
2851 * True if the portlet goes into the maximized state when the user goes into
2852 * the help mode.
2853 */
2854 private boolean _maximizeHelp;
2855
2856 /**
2857 * True if the portlet goes into the pop up state when the user goes into
2858 * the print mode.
2859 */
2860 private boolean _popUpPrint = true;
2861
2862 /**
2863 * True if the portlet can be cached within the layout.
2864 */
2865 private boolean _layoutCacheable;
2866
2867 /**
2868 * True if the portlet can be added multiple times to a layout.
2869 */
2870 private boolean _instanceable;
2871
2872 /**
2873 * The user principal strategy of the portlet.
2874 */
2875 private String _userPrincipalStrategy =
2876 PortletConstants.USER_PRINCIPAL_STRATEGY_USER_ID;
2877
2878 /**
2879 * True if the portlet does not share request attributes with the portal or
2880 * portlets from another WAR.
2881 */
2882 private boolean _privateRequestAttributes = true;
2883
2884 /**
2885 * True if the portlet does not share session attributes with the portal.
2886 */
2887 private boolean _privateSessionAttributes = true;
2888
2889 /**
2890 * Render weight of the portlet.
2891 */
2892 private int _renderWeight = 1;
2893
2894 /**
2895 * True if the portlet can be displayed via Ajax.
2896 */
2897 private boolean _ajaxable = true;
2898
2899 /**
2900 * A list of CSS files that will be referenced from the page's header
2901 * relative to the portal's context path.
2902 */
2903 private List<String> _headerPortalCss;
2904
2905 /**
2906 * A list of CSS files that will be referenced from the page's header
2907 * relative to the portlet's context path.
2908 */
2909 private List<String> _headerPortletCss;
2910
2911 /**
2912 * A list of JavaScript files that will be referenced from the page's header
2913 * relative to the portal's context path.
2914 */
2915 private List<String> _headerPortalJavaScript;
2916
2917 /**
2918 * A list of JavaScript files that will be referenced from the page's header
2919 * relative to the portlet's context path.
2920 */
2921 private List<String> _headerPortletJavaScript;
2922
2923 /**
2924 * A list of CSS files that will be referenced from the page's footer
2925 * relative to the portal's context path.
2926 */
2927 private List<String> _footerPortalCss;
2928
2929 /**
2930 * A list of CSS files that will be referenced from the page's footer
2931 * relative to the portlet's context path.
2932 */
2933 private List<String> _footerPortletCss;
2934
2935 /**
2936 * A list of JavaScript files that will be referenced from the page's footer
2937 * relative to the portal's context path.
2938 */
2939 private List<String> _footerPortalJavaScript;
2940
2941 /**
2942 * A list of JavaScript files that will be referenced from the page's footer
2943 * relative to the portlet's context path.
2944 */
2945 private List<String> _footerPortletJavaScript;
2946
2947 /**
2948 * The name of the CSS class that will be injected in the DIV that wraps
2949 * this portlet.
2950 */
2951 private String _cssClassWrapper = StringPool.BLANK;
2952
2953 /**
2954 * The Facebook integration method of the portlet.
2955 */
2956 private String _facebookIntegration =
2957 PortletConstants.FACEBOOK_INTEGRATION_IFRAME;
2958
2959 /**
2960 * True if default resources for the portlet are added to a page.
2961 */
2962 private boolean _addDefaultResource;
2963
2964 /**
2965 * An array of required roles of the portlet.
2966 */
2967 private String[] _rolesArray;
2968
2969 /**
2970 * The unlinked roles of the portlet.
2971 */
2972 private Set<String> _unlinkedRoles;
2973
2974 /**
2975 * The role mappers of the portlet.
2976 */
2977 private Map<String, String> _roleMappers;
2978
2979 /**
2980 * True if the portlet is a system portlet that a user cannot manually add
2981 * to their page.
2982 */
2983 private boolean _system;
2984
2985 /**
2986 * True to include the portlet and make it available to be made active.
2987 */
2988 private boolean _include = true;
2989
2990 /**
2991 * The init parameters of the portlet.
2992 */
2993 private Map<String, String> _initParams;
2994
2995 /**
2996 * The expiration cache of the portlet.
2997 */
2998 private Integer _expCache;
2999
3000 /**
3001 * The portlet modes of the portlet.
3002 */
3003 private Map<String, Set<String>> _portletModes;
3004
3005 /**
3006 * The window states of the portlet.
3007 */
3008 private Map<String, Set<String>> _windowStates;
3009
3010 /**
3011 * The supported locales of the portlet.
3012 */
3013 private Set<String> _supportedLocales;
3014
3015 /**
3016 * The resource bundle of the portlet.
3017 */
3018 private String _resourceBundle;
3019
3020 /**
3021 * The portlet info of the portlet.
3022 */
3023 private PortletInfo _portletInfo;
3024
3025 /**
3026 * The filters of the portlet.
3027 */
3028 private Map<String, PortletFilter> _portletFilters;
3029
3030 /**
3031 * The supported processing events of the portlet.
3032 */
3033 private Set<QName> _processingEvents = new HashSet<QName>();
3034
3035 /**
3036 * Map of the supported processing events of the portlet keyed by the QName.
3037 */
3038 private Map<String, QName> _processingEventsByQName =
3039 new HashMap<String, QName>();
3040
3041 /**
3042 * The supported publishing events of the portlet.
3043 */
3044 private Set<QName> _publishingEvents = new HashSet<QName>();
3045
3046 /**
3047 * The supported public render parameters of the portlet.
3048 */
3049 private Set<PublicRenderParameter> _publicRenderParameters =
3050 new HashSet<PublicRenderParameter>();
3051
3052 /**
3053 * Map of the supported public render parameters of the portlet keyed by the
3054 * identifier.
3055 */
3056 private Map<String, PublicRenderParameter>
3057 _publicRenderParametersByIdentifier =
3058 new HashMap<String, PublicRenderParameter>();
3059
3060 /**
3061 * Map of the supported public render parameters of the portlet keyed by the
3062 * QName.
3063 */
3064 private Map<String, PublicRenderParameter>
3065 _publicRenderParametersByQName =
3066 new HashMap<String, PublicRenderParameter>();
3067
3068 /**
3069 * The application this portlet belongs to.
3070 */
3071 private PortletApp _portletApp;
3072
3073 /**
3074 * The cloned instances of the portlet.
3075 */
3076 private Map<String, Portlet> _clonedInstances;
3077
3078 /**
3079 * True if the portlet is a static portlet that is cannot be moved.
3080 */
3081 private boolean _staticPortlet;
3082
3083 /**
3084 * True if the portlet is a static portlet at the start of a list of
3085 * portlets.
3086 */
3087 private boolean _staticPortletStart;
3088
3089}