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