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