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