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