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