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