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