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