001    /**
002     * Copyright (c) 2000-present 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.asset.kernel.model.AssetRendererFactory;
018    import com.liferay.expando.kernel.model.CustomAttributesDisplay;
019    import com.liferay.exportimport.kernel.lar.PortletDataHandler;
020    import com.liferay.exportimport.kernel.lar.StagedModelDataHandler;
021    import com.liferay.portal.kernel.application.type.ApplicationType;
022    import com.liferay.portal.kernel.atom.AtomCollectionAdapter;
023    import com.liferay.portal.kernel.log.Log;
024    import com.liferay.portal.kernel.log.LogFactoryUtil;
025    import com.liferay.portal.kernel.model.Plugin;
026    import com.liferay.portal.kernel.model.PluginSetting;
027    import com.liferay.portal.kernel.model.Portlet;
028    import com.liferay.portal.kernel.model.PortletApp;
029    import com.liferay.portal.kernel.model.PortletConstants;
030    import com.liferay.portal.kernel.model.PortletFilter;
031    import com.liferay.portal.kernel.model.PortletInfo;
032    import com.liferay.portal.kernel.model.PublicRenderParameter;
033    import com.liferay.portal.kernel.model.User;
034    import com.liferay.portal.kernel.notifications.UserNotificationHandler;
035    import com.liferay.portal.kernel.plugin.PluginPackage;
036    import com.liferay.portal.kernel.poller.PollerProcessor;
037    import com.liferay.portal.kernel.pop.MessageListener;
038    import com.liferay.portal.kernel.portlet.ConfigurationAction;
039    import com.liferay.portal.kernel.portlet.ControlPanelEntry;
040    import com.liferay.portal.kernel.portlet.FriendlyURLMapper;
041    import com.liferay.portal.kernel.portlet.FriendlyURLMapperTracker;
042    import com.liferay.portal.kernel.portlet.PortletBag;
043    import com.liferay.portal.kernel.portlet.PortletBagPool;
044    import com.liferay.portal.kernel.portlet.PortletLayoutListener;
045    import com.liferay.portal.kernel.portlet.PortletQNameUtil;
046    import com.liferay.portal.kernel.scheduler.SchedulerEntry;
047    import com.liferay.portal.kernel.search.Indexer;
048    import com.liferay.portal.kernel.search.OpenSearch;
049    import com.liferay.portal.kernel.security.permission.ActionKeys;
050    import com.liferay.portal.kernel.security.permission.PermissionChecker;
051    import com.liferay.portal.kernel.security.permission.PermissionCheckerFactoryUtil;
052    import com.liferay.portal.kernel.security.permission.PermissionPropagator;
053    import com.liferay.portal.kernel.security.permission.PermissionThreadLocal;
054    import com.liferay.portal.kernel.service.UserLocalServiceUtil;
055    import com.liferay.portal.kernel.service.permission.PortletPermissionUtil;
056    import com.liferay.portal.kernel.servlet.ServletContextUtil;
057    import com.liferay.portal.kernel.servlet.URLEncoder;
058    import com.liferay.portal.kernel.template.TemplateHandler;
059    import com.liferay.portal.kernel.trash.TrashHandler;
060    import com.liferay.portal.kernel.util.ArrayUtil;
061    import com.liferay.portal.kernel.util.ContentTypes;
062    import com.liferay.portal.kernel.util.PortalUtil;
063    import com.liferay.portal.kernel.util.StringPool;
064    import com.liferay.portal.kernel.util.StringUtil;
065    import com.liferay.portal.kernel.util.Validator;
066    import com.liferay.portal.kernel.webdav.WebDAVStorage;
067    import com.liferay.portal.kernel.workflow.WorkflowHandler;
068    import com.liferay.portal.kernel.xml.QName;
069    import com.liferay.portal.kernel.xmlrpc.Method;
070    import com.liferay.portal.util.PropsValues;
071    import com.liferay.portlet.DefaultControlPanelEntryFactory;
072    import com.liferay.registry.Registry;
073    import com.liferay.registry.RegistryUtil;
074    import com.liferay.registry.ServiceRegistrar;
075    import com.liferay.social.kernel.model.SocialActivityInterpreter;
076    import com.liferay.social.kernel.model.SocialRequestInterpreter;
077    
078    import java.util.ArrayList;
079    import java.util.Arrays;
080    import java.util.HashMap;
081    import java.util.HashSet;
082    import java.util.LinkedHashMap;
083    import java.util.LinkedHashSet;
084    import java.util.List;
085    import java.util.Map;
086    import java.util.Set;
087    import java.util.TreeSet;
088    import java.util.concurrent.ConcurrentHashMap;
089    
090    import javax.portlet.PortletMode;
091    import javax.portlet.WindowState;
092    
093    import javax.servlet.ServletContext;
094    
095    /**
096     * @author Brian Wing Shun Chan
097     */
098    public class PortletImpl extends PortletBaseImpl {
099    
100            /**
101             * Constructs a portlet with no parameters.
102             */
103            public PortletImpl() {
104                    this(0, null);
105            }
106    
107            /**
108             * Constructs a portlet with the specified parameters.
109             */
110            public PortletImpl(long companyId, String portletId) {
111                    setCompanyId(companyId);
112                    setPortletId(portletId);
113    
114                    setActive(true);
115                    setStrutsPath(portletId);
116    
117                    _assetRendererFactoryClasses = new ArrayList<>();
118                    _atomCollectionAdapterClasses = new ArrayList<>();
119                    _autopropagatedParameters = new LinkedHashSet<>();
120                    _customAttributesDisplayClasses = new ArrayList<>();
121                    _footerPortalCss = new ArrayList<>();
122                    _footerPortalJavaScript = new ArrayList<>();
123                    _footerPortletCss = new ArrayList<>();
124                    _footerPortletJavaScript = new ArrayList<>();
125                    _headerPortalCss = new ArrayList<>();
126                    _headerPortalJavaScript = new ArrayList<>();
127                    _headerPortletCss = new ArrayList<>();
128                    _headerPortletJavaScript = new ArrayList<>();
129                    _indexerClasses = new ArrayList<>();
130                    _initParams = new HashMap<>();
131                    _portletFilters = new LinkedHashMap<>();
132                    _portletModes = new HashMap<>();
133                    _roleMappers = new LinkedHashMap<>();
134                    _rootPortlet = this;
135                    _schedulerEntries = new ArrayList<>();
136                    _socialActivityInterpreterClasses = new ArrayList<>();
137                    _stagedModelDataHandlerClasses = new ArrayList<>();
138                    _supportedLocales = new HashSet<>();
139                    _trashHandlerClasses = new ArrayList<>();
140                    _unlinkedRoles = new HashSet<>();
141                    _userNotificationHandlerClasses = new ArrayList<>();
142                    _windowStates = new HashMap<>();
143                    _workflowHandlerClasses = new ArrayList<>();
144            }
145    
146            /**
147             * Constructs a portlet with the specified parameters.
148             */
149            public PortletImpl(
150                    String portletId, Portlet rootPortlet, PluginPackage pluginPackage,
151                    PluginSetting pluginSetting, long companyId, String icon,
152                    String virtualPath, String strutsPath, String parentStrutsPath,
153                    String portletName, String displayName, String portletClass,
154                    String configurationActionClass, List<String> indexerClasses,
155                    String openSearchClass, List<SchedulerEntry> schedulerEntries,
156                    String portletURLClass, String friendlyURLMapperClass,
157                    String friendlyURLMapping, String friendlyURLRoutes,
158                    String urlEncoderClass, String portletDataHandlerClass,
159                    List<String> stagedModelDataHandlerClasses, String templateHandlerClass,
160                    String portletLayoutListenerClass, String pollerProcessorClass,
161                    String popMessageListenerClass,
162                    List<String> socialActivityInterpreterClasses,
163                    String socialRequestInterpreterClass,
164                    String userNotificationDefinitions,
165                    List<String> userNotificationHandlerClasses, String webDAVStorageToken,
166                    String webDAVStorageClass, String xmlRpcMethodClass,
167                    String controlPanelEntryCategory, double controlPanelEntryWeight,
168                    String controlPanelClass, List<String> assetRendererFactoryClasses,
169                    List<String> atomCollectionAdapterClasses,
170                    List<String> customAttributesDisplayClasses,
171                    String permissionPropagatorClass, List<String> trashHandlerClasses,
172                    List<String> workflowHandlerClasses, String defaultPreferences,
173                    String preferencesValidator, boolean preferencesCompanyWide,
174                    boolean preferencesUniquePerLayout, boolean preferencesOwnedByGroup,
175                    boolean useDefaultTemplate, boolean showPortletAccessDenied,
176                    boolean showPortletInactive, boolean actionURLRedirect,
177                    boolean restoreCurrentView, boolean maximizeEdit, boolean maximizeHelp,
178                    boolean popUpPrint, boolean layoutCacheable, boolean instanceable,
179                    boolean remoteable, boolean scopeable, boolean singlePageApplication,
180                    String userPrincipalStrategy, boolean privateRequestAttributes,
181                    boolean privateSessionAttributes, Set<String> autopropagatedParameters,
182                    boolean requiresNamespacedParameters, int actionTimeout,
183                    int renderTimeout, int renderWeight, boolean ajaxable,
184                    List<String> headerPortalCss, List<String> headerPortletCss,
185                    List<String> headerPortalJavaScript,
186                    List<String> headerPortletJavaScript, List<String> footerPortalCss,
187                    List<String> footerPortletCss, List<String> footerPortalJavaScript,
188                    List<String> footerPortletJavaScript, String cssClassWrapper,
189                    String facebookIntegration, boolean addDefaultResource, String roles,
190                    Set<String> unlinkedRoles, Map<String, String> roleMappers,
191                    boolean system, boolean active, boolean include,
192                    Map<String, String> initParams, Integer expCache,
193                    Map<String, Set<String>> portletModes,
194                    Map<String, Set<String>> windowStates, Set<String> supportedLocales,
195                    String resourceBundle, PortletInfo portletInfo,
196                    Map<String, PortletFilter> portletFilters, Set<QName> processingEvents,
197                    Set<QName> publishingEvents,
198                    Set<PublicRenderParameter> publicRenderParameters,
199                    PortletApp portletApp) {
200    
201                    setPortletId(portletId);
202                    setCompanyId(companyId);
203                    setRoles(roles);
204                    setActive(active);
205                    setProcessingEvents(processingEvents);
206                    setPublishingEvents(publishingEvents);
207                    setPublicRenderParameters(publicRenderParameters);
208    
209                    _rootPortlet = rootPortlet;
210                    _pluginPackage = pluginPackage;
211                    _defaultPluginSetting = pluginSetting;
212                    _icon = icon;
213                    _virtualPath = virtualPath;
214                    _strutsPath = strutsPath;
215                    _parentStrutsPath = parentStrutsPath;
216                    _portletName = portletName;
217                    _displayName = displayName;
218                    _portletClass = portletClass;
219                    _configurationActionClass = configurationActionClass;
220                    _indexerClasses = indexerClasses;
221                    _openSearchClass = openSearchClass;
222                    _schedulerEntries = schedulerEntries;
223                    _portletURLClass = portletURLClass;
224                    _friendlyURLMapperClass = friendlyURLMapperClass;
225                    _friendlyURLMapping = friendlyURLMapping;
226                    _friendlyURLRoutes = friendlyURLRoutes;
227                    _urlEncoderClass = urlEncoderClass;
228                    _portletDataHandlerClass = portletDataHandlerClass;
229                    _stagedModelDataHandlerClasses = stagedModelDataHandlerClasses;
230                    _templateHandlerClass = templateHandlerClass;
231                    _portletLayoutListenerClass = portletLayoutListenerClass;
232                    _pollerProcessorClass = pollerProcessorClass;
233                    _popMessageListenerClass = popMessageListenerClass;
234                    _socialActivityInterpreterClasses = socialActivityInterpreterClasses;
235                    _socialRequestInterpreterClass = socialRequestInterpreterClass;
236                    _userNotificationDefinitions = userNotificationDefinitions;
237                    _userNotificationHandlerClasses = userNotificationHandlerClasses;
238                    _webDAVStorageToken = webDAVStorageToken;
239                    _webDAVStorageClass = webDAVStorageClass;
240                    _xmlRpcMethodClass = xmlRpcMethodClass;
241                    _controlPanelEntryCategory = controlPanelEntryCategory;
242                    _controlPanelEntryWeight = controlPanelEntryWeight;
243                    _controlPanelEntryClass = controlPanelClass;
244                    _assetRendererFactoryClasses = assetRendererFactoryClasses;
245                    _atomCollectionAdapterClasses = atomCollectionAdapterClasses;
246                    _customAttributesDisplayClasses = customAttributesDisplayClasses;
247                    _permissionPropagatorClass = permissionPropagatorClass;
248                    _trashHandlerClasses = trashHandlerClasses;
249                    _workflowHandlerClasses = workflowHandlerClasses;
250                    _defaultPreferences = defaultPreferences;
251                    _preferencesValidator = preferencesValidator;
252                    _preferencesCompanyWide = preferencesCompanyWide;
253                    _preferencesUniquePerLayout = preferencesUniquePerLayout;
254                    _preferencesOwnedByGroup = preferencesOwnedByGroup;
255                    _useDefaultTemplate = useDefaultTemplate;
256                    _showPortletAccessDenied = showPortletAccessDenied;
257                    _showPortletInactive = showPortletInactive;
258                    _actionURLRedirect = actionURLRedirect;
259                    _restoreCurrentView = restoreCurrentView;
260                    _maximizeEdit = maximizeEdit;
261                    _maximizeHelp = maximizeHelp;
262                    _popUpPrint = popUpPrint;
263                    _layoutCacheable = layoutCacheable;
264                    _instanceable = instanceable;
265                    _remoteable = remoteable;
266                    _scopeable = scopeable;
267                    _singlePageApplication = singlePageApplication;
268                    _userPrincipalStrategy = userPrincipalStrategy;
269                    _privateRequestAttributes = privateRequestAttributes;
270                    _privateSessionAttributes = privateSessionAttributes;
271                    _autopropagatedParameters = autopropagatedParameters;
272                    _requiresNamespacedParameters = requiresNamespacedParameters;
273                    _actionTimeout = actionTimeout;
274                    _renderTimeout = renderTimeout;
275                    _renderWeight = renderWeight;
276                    _ajaxable = ajaxable;
277                    _headerPortalCss = headerPortalCss;
278                    _headerPortletCss = headerPortletCss;
279                    _headerPortalJavaScript = headerPortalJavaScript;
280                    _headerPortletJavaScript = headerPortletJavaScript;
281                    _footerPortalCss = footerPortalCss;
282                    _footerPortletCss = footerPortletCss;
283                    _footerPortalJavaScript = footerPortalJavaScript;
284                    _footerPortletJavaScript = footerPortletJavaScript;
285                    _cssClassWrapper = cssClassWrapper;
286                    _facebookIntegration = facebookIntegration;
287                    _addDefaultResource = addDefaultResource;
288                    _unlinkedRoles = unlinkedRoles;
289                    _roleMappers = roleMappers;
290                    _system = system;
291                    _include = include;
292                    _initParams = initParams;
293                    _expCache = expCache;
294                    _portletModes = portletModes;
295                    _windowStates = windowStates;
296                    _supportedLocales = supportedLocales;
297                    _resourceBundle = resourceBundle;
298                    _portletInfo = portletInfo;
299                    _portletFilters = portletFilters;
300                    _portletApp = portletApp;
301            }
302    
303            /**
304             * Adds an application type.
305             *
306             * @param applicationType an application type
307             */
308            @Override
309            public void addApplicationType(ApplicationType applicationType) {
310                    _applicationTypes.add(applicationType);
311            }
312    
313            /**
314             * Adds a processing event.
315             */
316            @Override
317            public void addProcessingEvent(QName processingEvent) {
318                    _processingEvents.add(processingEvent);
319                    _processingEventsByQName.put(
320                            PortletQNameUtil.getKey(processingEvent), processingEvent);
321            }
322    
323            /**
324             * Adds a public render parameter.
325             *
326             * @param publicRenderParameter a public render parameter
327             */
328            @Override
329            public void addPublicRenderParameter(
330                    PublicRenderParameter publicRenderParameter) {
331    
332                    _publicRenderParameters.add(publicRenderParameter);
333    
334                    String identifier = publicRenderParameter.getIdentifier();
335    
336                    _publicRenderParametersByIdentifier.put(
337                            identifier, publicRenderParameter);
338    
339                    QName qName = publicRenderParameter.getQName();
340    
341                    _publicRenderParametersByQName.put(
342                            PortletQNameUtil.getKey(qName), publicRenderParameter);
343    
344                    String publicRenderParameterName =
345                            PortletQNameUtil.getPublicRenderParameterName(qName);
346    
347                    PortletQNameUtil.setPublicRenderParameterIdentifier(
348                            publicRenderParameterName, identifier);
349            }
350    
351            /**
352             * Adds a publishing event.
353             */
354            @Override
355            public void addPublishingEvent(QName publishingEvent) {
356                    _publishingEvents.add(publishingEvent);
357            }
358    
359            /**
360             * Adds a scheduler entry.
361             */
362            @Override
363            public void addSchedulerEntry(SchedulerEntry schedulerEntry) {
364                    _schedulerEntries.add(schedulerEntry);
365            }
366    
367            /**
368             * Creates and returns a copy of this object.
369             *
370             * @return a copy of this object
371             */
372            @Override
373            public Object clone() {
374                    Portlet portlet = new PortletImpl(
375                            getPortletId(), getRootPortlet(), getPluginPackage(),
376                            getDefaultPluginSetting(), getCompanyId(), getIcon(),
377                            getVirtualPath(), getStrutsPath(), getParentStrutsPath(),
378                            getPortletName(), getDisplayName(), getPortletClass(),
379                            getConfigurationActionClass(), getIndexerClasses(),
380                            getOpenSearchClass(), getSchedulerEntries(), getPortletURLClass(),
381                            getFriendlyURLMapperClass(), getFriendlyURLMapping(),
382                            getFriendlyURLRoutes(), getURLEncoderClass(),
383                            getPortletDataHandlerClass(), getStagedModelDataHandlerClasses(),
384                            getTemplateHandlerClass(), getPortletLayoutListenerClass(),
385                            getPollerProcessorClass(), getPopMessageListenerClass(),
386                            getSocialActivityInterpreterClasses(),
387                            getSocialRequestInterpreterClass(),
388                            getUserNotificationDefinitions(),
389                            getUserNotificationHandlerClasses(), getWebDAVStorageToken(),
390                            getWebDAVStorageClass(), getXmlRpcMethodClass(),
391                            getControlPanelEntryCategory(), getControlPanelEntryWeight(),
392                            getControlPanelEntryClass(), getAssetRendererFactoryClasses(),
393                            getAtomCollectionAdapterClasses(),
394                            getCustomAttributesDisplayClasses(), getPermissionPropagatorClass(),
395                            getTrashHandlerClasses(), getWorkflowHandlerClasses(),
396                            getDefaultPreferences(), getPreferencesValidator(),
397                            isPreferencesCompanyWide(), isPreferencesUniquePerLayout(),
398                            isPreferencesOwnedByGroup(), isUseDefaultTemplate(),
399                            isShowPortletAccessDenied(), isShowPortletInactive(),
400                            isActionURLRedirect(), isRestoreCurrentView(), isMaximizeEdit(),
401                            isMaximizeHelp(), isPopUpPrint(), isLayoutCacheable(),
402                            isInstanceable(), isRemoteable(), isScopeable(),
403                            isSinglePageApplication(), getUserPrincipalStrategy(),
404                            isPrivateRequestAttributes(), isPrivateSessionAttributes(),
405                            getAutopropagatedParameters(), isRequiresNamespacedParameters(),
406                            getActionTimeout(), getRenderTimeout(), getRenderWeight(),
407                            isAjaxable(), getHeaderPortalCss(), getHeaderPortletCss(),
408                            getHeaderPortalJavaScript(), getHeaderPortletJavaScript(),
409                            getFooterPortalCss(), getFooterPortletCss(),
410                            getFooterPortalJavaScript(), getFooterPortletJavaScript(),
411                            getCssClassWrapper(), getFacebookIntegration(),
412                            isAddDefaultResource(), getRoles(), getUnlinkedRoles(),
413                            getRoleMappers(), isSystem(), isActive(), isInclude(),
414                            getInitParams(), getExpCache(), getPortletModes(),
415                            getWindowStates(), getSupportedLocales(), getResourceBundle(),
416                            getPortletInfo(), getPortletFilters(), getProcessingEvents(),
417                            getPublishingEvents(), getPublicRenderParameters(),
418                            getPortletApp());
419    
420                    portlet.setApplicationTypes(getApplicationTypes());
421                    portlet.setId(getId());
422                    portlet.setUndeployedPortlet(isUndeployedPortlet());
423    
424                    return portlet;
425            }
426    
427            /**
428             * Compares this portlet to the specified object.
429             *
430             * @param  portlet the portlet to compare this portlet against
431             * @return the value 0 if the argument portlet is equal to this portlet; a
432             *         value less than -1 if this portlet is less than the portlet
433             *         argument; and 1 if this portlet is greater than the portlet
434             *         argument
435             */
436            @Override
437            public int compareTo(Portlet portlet) {
438                    String portletId = getPortletId();
439    
440                    return portletId.compareTo(portlet.getPortletId());
441            }
442    
443            /**
444             * Checks whether this portlet is equal to the specified object.
445             *
446             * @param  obj the object to compare this portlet against
447             * @return <code>true</code> if the portlet is equal to the specified object
448             */
449            @Override
450            public boolean equals(Object obj) {
451                    if (this == obj) {
452                            return true;
453                    }
454    
455                    if (!(obj instanceof Portlet)) {
456                            return false;
457                    }
458    
459                    Portlet portlet = (Portlet)obj;
460    
461                    String portletId = getPortletId();
462    
463                    return portletId.equals(portlet.getPortletId());
464            }
465    
466            /**
467             * Returns the action timeout of the portlet.
468             *
469             * @return the action timeout of the portlet
470             */
471            @Override
472            public int getActionTimeout() {
473                    return _actionTimeout;
474            }
475    
476            /**
477             * Returns <code>true</code> if an action URL for this portlet should cause
478             * an auto redirect.
479             *
480             * @return <code>true</code> if an action URL for this portlet should cause
481             *         an auto redirect
482             */
483            @Override
484            public boolean getActionURLRedirect() {
485                    return _actionURLRedirect;
486            }
487    
488            /**
489             * Returns <code>true</code> if default resources for the portlet are added
490             * to a page.
491             *
492             * @return <code>true</code> if default resources for the portlet are added
493             *         to a page
494             */
495            @Override
496            public boolean getAddDefaultResource() {
497                    return _addDefaultResource;
498            }
499    
500            /**
501             * Returns <code>true</code> if the portlet can be displayed via Ajax.
502             *
503             * @return <code>true</code> if the portlet can be displayed via Ajax
504             */
505            @Override
506            public boolean getAjaxable() {
507                    return _ajaxable;
508            }
509    
510            /**
511             * Returns the portlet modes of the portlet.
512             *
513             * @return the portlet modes of the portlet
514             */
515            @Override
516            public Set<String> getAllPortletModes() {
517                    Set<String> allPortletModes = new TreeSet<>();
518    
519                    for (Map.Entry<String, Set<String>> entry : _portletModes.entrySet()) {
520                            Set<String> mimeTypePortletModes = entry.getValue();
521    
522                            for (String portletMode : mimeTypePortletModes) {
523                                    allPortletModes.add(portletMode);
524                            }
525                    }
526    
527                    return allPortletModes;
528            }
529    
530            /**
531             * Returns the window states of the portlet.
532             *
533             * @return the window states of the portlet
534             */
535            @Override
536            public Set<String> getAllWindowStates() {
537                    Set<String> allWindowStates = new TreeSet<>();
538    
539                    for (Map.Entry<String, Set<String>> entry : _windowStates.entrySet()) {
540                            Set<String> mimeTypeWindowStates = entry.getValue();
541    
542                            for (String windowState : mimeTypeWindowStates) {
543                                    allWindowStates.add(windowState);
544                            }
545                    }
546    
547                    return allWindowStates;
548            }
549    
550            /**
551             * Returns the application types of the portlet.
552             *
553             * @return the application types of the portlet
554             */
555            @Override
556            public Set<ApplicationType> getApplicationTypes() {
557                    return _applicationTypes;
558            }
559    
560            /**
561             * Returns the names of the classes that represent asset types associated
562             * with the portlet.
563             *
564             * @return the names of the classes that represent asset types associated
565             *         with the portlet
566             */
567            @Override
568            public List<String> getAssetRendererFactoryClasses() {
569                    return _assetRendererFactoryClasses;
570            }
571    
572            /**
573             * Returns the asset type instances of the portlet.
574             *
575             * @return the asset type instances of the portlet
576             */
577            @Override
578            public List<AssetRendererFactory<?>> getAssetRendererFactoryInstances() {
579                    if (_assetRendererFactoryClasses.isEmpty()) {
580                            return null;
581                    }
582    
583                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
584    
585                    return portletBag.getAssetRendererFactoryInstances();
586            }
587    
588            /**
589             * Returns the names of the classes that represent atom collection adapters
590             * associated with the portlet.
591             *
592             * @return the names of the classes that represent atom collection adapters
593             *         associated with the portlet
594             */
595            @Override
596            public List<String> getAtomCollectionAdapterClasses() {
597                    return _atomCollectionAdapterClasses;
598            }
599    
600            /**
601             * Returns the atom collection adapter instances of the portlet.
602             *
603             * @return the atom collection adapter instances of the portlet
604             */
605            @Override
606            public List<AtomCollectionAdapter<?>> getAtomCollectionAdapterInstances() {
607                    if (_atomCollectionAdapterClasses.isEmpty()) {
608                            return null;
609                    }
610    
611                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
612    
613                    return portletBag.getAtomCollectionAdapterInstances();
614            }
615    
616            /**
617             * Returns the names of the parameters that will be automatically propagated
618             * through the portlet.
619             *
620             * @return the names of the parameters that will be automatically propagated
621             *         through the portlet
622             */
623            @Override
624            public Set<String> getAutopropagatedParameters() {
625                    return _autopropagatedParameters;
626            }
627    
628            /**
629             * Returns <code>true</code> if the portlet is found in a WAR file.
630             *
631             * @param  portletId the cloned instance portlet ID
632             * @return a cloned instance of the portlet
633             */
634            @Override
635            public Portlet getClonedInstance(String portletId) {
636                    Portlet portlet = (Portlet)clone();
637    
638                    portlet.setPortletId(portletId);
639    
640                    return portlet;
641            }
642    
643            /**
644             * Returns the configuration action class of the portlet.
645             *
646             * @return the configuration action class of the portlet
647             */
648            @Override
649            public String getConfigurationActionClass() {
650                    return _configurationActionClass;
651            }
652    
653            /**
654             * Returns the configuration action instance of the portlet.
655             *
656             * @return the configuration action instance of the portlet
657             */
658            @Override
659            public ConfigurationAction getConfigurationActionInstance() {
660                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
661    
662                    List<ConfigurationAction> configurationActionInstances =
663                            portletBag.getConfigurationActionInstances();
664    
665                    if (configurationActionInstances.isEmpty()) {
666                            return null;
667                    }
668    
669                    return configurationActionInstances.get(0);
670            }
671    
672            /**
673             * Returns the servlet context name of the portlet.
674             *
675             * @return the servlet context name of the portlet
676             */
677            @Override
678            public String getContextName() {
679                    if (!_portletApp.isWARFile()) {
680                            return PortalUtil.getServletContextName();
681                    }
682    
683                    return _portletApp.getServletContextName();
684            }
685    
686            /**
687             * Returns the servlet context path of the portlet.
688             *
689             * @return the servlet context path of the portlet
690             */
691            @Override
692            public String getContextPath() {
693                    return _portletApp.getContextPath();
694            }
695    
696            /**
697             * Returns the name of the category of the Control Panel where the portlet
698             * will be shown.
699             *
700             * @return the name of the category of the Control Panel where the portlet
701             *         will be shown
702             */
703            @Override
704            public String getControlPanelEntryCategory() {
705                    return _controlPanelEntryCategory;
706            }
707    
708            /**
709             * Returns the name of the class that will control when the portlet will be
710             * shown in the Control Panel.
711             *
712             * @return the name of the class that will control when the portlet will be
713             *         shown in the Control Panel
714             */
715            @Override
716            public String getControlPanelEntryClass() {
717                    return _controlPanelEntryClass;
718            }
719    
720            /**
721             * Returns an instance of the class that will control when the portlet will
722             * be shown in the Control Panel.
723             *
724             * @return the instance of the class that will control when the portlet will
725             *         be shown in the Control Panel
726             */
727            @Override
728            public ControlPanelEntry getControlPanelEntryInstance() {
729                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
730    
731                    List<ControlPanelEntry> controlPanelEntryInstances =
732                            portletBag.getControlPanelEntryInstances();
733    
734                    if (controlPanelEntryInstances.isEmpty()) {
735                            return DefaultControlPanelEntryFactory.getInstance();
736                    }
737    
738                    return controlPanelEntryInstances.get(0);
739            }
740    
741            /**
742             * Returns the relative weight of the portlet with respect to the other
743             * portlets in the same category of the Control Panel.
744             *
745             * @return the relative weight of the portlet with respect to the other
746             *         portlets in the same category of the Control Panel
747             */
748            @Override
749            public double getControlPanelEntryWeight() {
750                    return _controlPanelEntryWeight;
751            }
752    
753            /**
754             * Returns the name of the CSS class that will be injected in the DIV that
755             * wraps this portlet.
756             *
757             * @return the name of the CSS class that will be injected in the DIV that
758             *         wraps this portlet
759             */
760            @Override
761            public String getCssClassWrapper() {
762                    return _cssClassWrapper;
763            }
764    
765            /**
766             * Returns the names of the classes that represent custom attribute displays
767             * associated with the portlet.
768             *
769             * @return the names of the classes that represent asset types associated
770             *         with the portlet
771             */
772            @Override
773            public List<String> getCustomAttributesDisplayClasses() {
774                    return _customAttributesDisplayClasses;
775            }
776    
777            /**
778             * Returns the custom attribute display instances of the portlet.
779             *
780             * @return the custom attribute display instances of the portlet
781             */
782            @Override
783            public List<CustomAttributesDisplay> getCustomAttributesDisplayInstances() {
784                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
785    
786                    return portletBag.getCustomAttributesDisplayInstances();
787            }
788    
789            /**
790             * Get the default plugin settings of the portlet.
791             *
792             * @return the plugin settings
793             */
794            @Override
795            public PluginSetting getDefaultPluginSetting() {
796                    return _defaultPluginSetting;
797            }
798    
799            /**
800             * Returns the default preferences of the portlet.
801             *
802             * @return the default preferences of the portlet
803             */
804            @Override
805            public String getDefaultPreferences() {
806                    if (Validator.isNull(_defaultPreferences)) {
807                            return PortletConstants.DEFAULT_PREFERENCES;
808                    }
809                    else {
810                            return _defaultPreferences;
811                    }
812            }
813    
814            /**
815             * Returns the display name of the portlet.
816             *
817             * @return the display name of the portlet
818             */
819            @Override
820            public String getDisplayName() {
821                    return _displayName;
822            }
823    
824            /**
825             * Returns expiration cache of the portlet.
826             *
827             * @return expiration cache of the portlet
828             */
829            @Override
830            public Integer getExpCache() {
831                    return _expCache;
832            }
833    
834            /**
835             * Returns the Facebook integration method of the portlet.
836             *
837             * @return the Facebook integration method of the portlet
838             */
839            @Override
840            public String getFacebookIntegration() {
841                    return _facebookIntegration;
842            }
843    
844            /**
845             * Returns a list of CSS files that will be referenced from the page's
846             * footer relative to the portal's context path.
847             *
848             * @return a list of CSS files that will be referenced from the page's
849             *         footer relative to the portal's context path
850             */
851            @Override
852            public List<String> getFooterPortalCss() {
853                    return _footerPortalCss;
854            }
855    
856            /**
857             * Returns a list of JavaScript files that will be referenced from the
858             * page's footer relative to the portal's context path.
859             *
860             * @return a list of JavaScript files that will be referenced from the
861             *         page's footer relative to the portal's context path
862             */
863            @Override
864            public List<String> getFooterPortalJavaScript() {
865                    return _footerPortalJavaScript;
866            }
867    
868            /**
869             * Returns a list of CSS files that will be referenced from the page's
870             * footer relative to the portlet's context path.
871             *
872             * @return a list of CSS files that will be referenced from the page's
873             *         footer relative to the portlet's context path
874             */
875            @Override
876            public List<String> getFooterPortletCss() {
877                    return _footerPortletCss;
878            }
879    
880            /**
881             * Returns a list of JavaScript files that will be referenced from the
882             * page's footer relative to the portlet's context path.
883             *
884             * @return a list of JavaScript files that will be referenced from the
885             *         page's footer relative to the portlet's context path
886             */
887            @Override
888            public List<String> getFooterPortletJavaScript() {
889                    return _footerPortletJavaScript;
890            }
891    
892            /**
893             * Returns the name of the friendly URL mapper class of the portlet.
894             *
895             * @return the name of the friendly URL mapper class of the portlet
896             */
897            @Override
898            public String getFriendlyURLMapperClass() {
899                    return _friendlyURLMapperClass;
900            }
901    
902            /**
903             * Returns the friendly URL mapper instance of the portlet.
904             *
905             * @return the friendly URL mapper instance of the portlet
906             */
907            @Override
908            public FriendlyURLMapper getFriendlyURLMapperInstance() {
909                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
910    
911                    FriendlyURLMapperTracker friendlyURLMapperTracker =
912                            portletBag.getFriendlyURLMapperTracker();
913    
914                    return friendlyURLMapperTracker.getFriendlyURLMapper();
915            }
916    
917            /**
918             * Returns the name of the friendly URL mapping of the portlet.
919             *
920             * @return the name of the friendly URL mapping of the portlet
921             */
922            @Override
923            public String getFriendlyURLMapping() {
924                    return _friendlyURLMapping;
925            }
926    
927            /**
928             * Returns the class loader resource path to the friendly URL routes of the
929             * portlet.
930             *
931             * @return the class loader resource path to the friendly URL routes of the
932             *         portlet
933             */
934            @Override
935            public String getFriendlyURLRoutes() {
936                    return _friendlyURLRoutes;
937            }
938    
939            /**
940             * Returns a list of CSS files that will be referenced from the page's
941             * header relative to the portal's context path.
942             *
943             * @return a list of CSS files that will be referenced from the page's
944             *         header relative to the portal's context path
945             */
946            @Override
947            public List<String> getHeaderPortalCss() {
948                    return _headerPortalCss;
949            }
950    
951            /**
952             * Returns a list of JavaScript files that will be referenced from the
953             * page's header relative to the portal's context path.
954             *
955             * @return a list of JavaScript files that will be referenced from the
956             *         page's header relative to the portal's context path
957             */
958            @Override
959            public List<String> getHeaderPortalJavaScript() {
960                    return _headerPortalJavaScript;
961            }
962    
963            /**
964             * Returns a list of CSS files that will be referenced from the page's
965             * header relative to the portlet's context path.
966             *
967             * @return a list of CSS files that will be referenced from the page's
968             *         header relative to the portlet's context path
969             */
970            @Override
971            public List<String> getHeaderPortletCss() {
972                    return _headerPortletCss;
973            }
974    
975            /**
976             * Returns a list of JavaScript files that will be referenced from the
977             * page's header relative to the portlet's context path.
978             *
979             * @return a list of JavaScript files that will be referenced from the
980             *         page's header relative to the portlet's context path
981             */
982            @Override
983            public List<String> getHeaderPortletJavaScript() {
984                    return _headerPortletJavaScript;
985            }
986    
987            /**
988             * Returns the icon of the portlet.
989             *
990             * @return the icon of the portlet
991             */
992            @Override
993            public String getIcon() {
994                    return _icon;
995            }
996    
997            /**
998             * Returns <code>true</code> to include the portlet and make it available to
999             * be made active.
1000             *
1001             * @return <code>true</code> to include the portlet and make it available to
1002             *         be made active
1003             */
1004            @Override
1005            public boolean getInclude() {
1006                    return _include;
1007            }
1008    
1009            /**
1010             * Returns the names of the classes that represent indexers associated with
1011             * the portlet.
1012             *
1013             * @return the names of the classes that represent indexers associated with
1014             *         the portlet
1015             */
1016            @Override
1017            public List<String> getIndexerClasses() {
1018                    return _indexerClasses;
1019            }
1020    
1021            /**
1022             * Returns the indexer instances of the portlet.
1023             *
1024             * @return the indexer instances of the portlet
1025             */
1026            @Override
1027            public List<Indexer<?>> getIndexerInstances() {
1028                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1029    
1030                    return portletBag.getIndexerInstances();
1031            }
1032    
1033            /**
1034             * Returns the init parameters of the portlet.
1035             *
1036             * @return init parameters of the portlet
1037             */
1038            @Override
1039            public Map<String, String> getInitParams() {
1040                    return _initParams;
1041            }
1042    
1043            /**
1044             * Returns <code>true</code> if the portlet can be added multiple times to a
1045             * layout.
1046             *
1047             * @return <code>true</code> if the portlet can be added multiple times to a
1048             *         layout
1049             */
1050            @Override
1051            public boolean getInstanceable() {
1052                    return _instanceable;
1053            }
1054    
1055            /**
1056             * Returns the instance ID of the portlet.
1057             *
1058             * @return the instance ID of the portlet
1059             */
1060            @Override
1061            public String getInstanceId() {
1062                    return PortletConstants.getInstanceId(getPortletId());
1063            }
1064    
1065            /**
1066             * Returns <code>true</code> to allow the portlet to be cached within the
1067             * layout.
1068             *
1069             * @return <code>true</code> if the portlet can be cached within the layout
1070             */
1071            @Override
1072            public boolean getLayoutCacheable() {
1073                    return _layoutCacheable;
1074            }
1075    
1076            /**
1077             * Returns <code>true</code> if the portlet goes into the maximized state
1078             * when the user goes into the edit mode.
1079             *
1080             * @return <code>true</code> if the portlet goes into the maximized state
1081             *         when the user goes into the edit mode
1082             */
1083            @Override
1084            public boolean getMaximizeEdit() {
1085                    return _maximizeEdit;
1086            }
1087    
1088            /**
1089             * Returns <code>true</code> if the portlet goes into the maximized state
1090             * when the user goes into the help mode.
1091             *
1092             * @return <code>true</code> if the portlet goes into the maximized state
1093             *         when the user goes into the help mode
1094             */
1095            @Override
1096            public boolean getMaximizeHelp() {
1097                    return _maximizeHelp;
1098            }
1099    
1100            /**
1101             * Returns the name of the open search class of the portlet.
1102             *
1103             * @return the name of the open search class of the portlet
1104             */
1105            @Override
1106            public String getOpenSearchClass() {
1107                    return _openSearchClass;
1108            }
1109    
1110            /**
1111             * Returns the indexer instance of the portlet.
1112             *
1113             * @return the indexer instance of the portlet
1114             */
1115            @Override
1116            public OpenSearch getOpenSearchInstance() {
1117                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1118    
1119                    List<OpenSearch> openSearchInstances =
1120                            portletBag.getOpenSearchInstances();
1121    
1122                    if (openSearchInstances.isEmpty()) {
1123                            return null;
1124                    }
1125    
1126                    return openSearchInstances.get(0);
1127            }
1128    
1129            /**
1130             * Returns the parent struts path of the portlet.
1131             *
1132             * @return the parent struts path of the portlet.
1133             */
1134            @Override
1135            public String getParentStrutsPath() {
1136                    return _parentStrutsPath;
1137            }
1138    
1139            /**
1140             * Returns the name of the permission propagator class of the portlet.
1141             *
1142             * @return the name of the permission propagator class of the portlet
1143             */
1144            @Override
1145            public String getPermissionPropagatorClass() {
1146                    return _permissionPropagatorClass;
1147            }
1148    
1149            /**
1150             * Returns the permission propagator instance of the portlet.
1151             *
1152             * @return the permission propagator instance of the portlet
1153             */
1154            @Override
1155            public PermissionPropagator getPermissionPropagatorInstance() {
1156                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1157    
1158                    List<PermissionPropagator> permissionPropagatorInstances =
1159                            portletBag.getPermissionPropagatorInstances();
1160    
1161                    if (permissionPropagatorInstances.isEmpty()) {
1162                            return null;
1163                    }
1164    
1165                    return permissionPropagatorInstances.get(0);
1166            }
1167    
1168            /**
1169             * Returns the plugin ID of the portlet.
1170             *
1171             * @return the plugin ID of the portlet
1172             */
1173            @Override
1174            public String getPluginId() {
1175                    return getRootPortletId();
1176            }
1177    
1178            /**
1179             * Returns this portlet's plugin package.
1180             *
1181             * @return this portlet's plugin package
1182             */
1183            @Override
1184            public PluginPackage getPluginPackage() {
1185                    return _pluginPackage;
1186            }
1187    
1188            /**
1189             * Returns the plugin type of the portlet.
1190             *
1191             * @return the plugin type of the portlet
1192             */
1193            @Override
1194            public String getPluginType() {
1195                    return Plugin.TYPE_PORTLET;
1196            }
1197    
1198            /**
1199             * Returns the name of the poller processor class of the portlet.
1200             *
1201             * @return the name of the poller processor class of the portlet
1202             */
1203            @Override
1204            public String getPollerProcessorClass() {
1205                    return _pollerProcessorClass;
1206            }
1207    
1208            /**
1209             * Returns the poller processor instance of the portlet.
1210             *
1211             * @return the poller processor instance of the portlet
1212             */
1213            @Override
1214            public PollerProcessor getPollerProcessorInstance() {
1215                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1216    
1217                    List<PollerProcessor> pollerProcessorInstances =
1218                            portletBag.getPollerProcessorInstances();
1219    
1220                    if (pollerProcessorInstances.isEmpty()) {
1221                            return null;
1222                    }
1223    
1224                    return pollerProcessorInstances.get(0);
1225            }
1226    
1227            /**
1228             * Returns the name of the POP message listener class of the portlet.
1229             *
1230             * @return the name of the POP message listener class of the portlet
1231             */
1232            @Override
1233            public String getPopMessageListenerClass() {
1234                    return _popMessageListenerClass;
1235            }
1236    
1237            /**
1238             * Returns the POP message listener instance of the portlet.
1239             *
1240             * @return the POP message listener instance of the portlet
1241             */
1242            @Override
1243            public MessageListener getPopMessageListenerInstance() {
1244                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1245    
1246                    List<MessageListener> popMessageListenerInstances =
1247                            portletBag.getPopMessageListenerInstances();
1248    
1249                    if (popMessageListenerInstances.isEmpty()) {
1250                            return null;
1251                    }
1252    
1253                    return popMessageListenerInstances.get(0);
1254            }
1255    
1256            /**
1257             * Returns <code>true</code> if the portlet goes into the pop up state when
1258             * the user goes into the print mode.
1259             *
1260             * @return <code>true</code> if the portlet goes into the pop up state when
1261             *         the user goes into the print mode
1262             */
1263            @Override
1264            public boolean getPopUpPrint() {
1265                    return _popUpPrint;
1266            }
1267    
1268            /**
1269             * Returns this portlet's application.
1270             *
1271             * @return this portlet's application
1272             */
1273            @Override
1274            public PortletApp getPortletApp() {
1275                    return _portletApp;
1276            }
1277    
1278            /**
1279             * Returns the name of the portlet class of the portlet.
1280             *
1281             * @return the name of the portlet class of the portlet
1282             */
1283            @Override
1284            public String getPortletClass() {
1285                    return _portletClass;
1286            }
1287    
1288            /**
1289             * Returns the name of the portlet data handler class of the portlet.
1290             *
1291             * @return the name of the portlet data handler class of the portlet
1292             */
1293            @Override
1294            public String getPortletDataHandlerClass() {
1295                    return _portletDataHandlerClass;
1296            }
1297    
1298            /**
1299             * Returns the portlet data handler instance of the portlet.
1300             *
1301             * @return the portlet data handler instance of the portlet
1302             */
1303            @Override
1304            public PortletDataHandler getPortletDataHandlerInstance() {
1305                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1306    
1307                    if (portletBag == null) {
1308                            _log.error("No portlet bag for " + toString());
1309    
1310                            throw new IllegalStateException("No portlet bag for " + toString());
1311                    }
1312    
1313                    List<PortletDataHandler> portletDataHandlerInstances =
1314                            portletBag.getPortletDataHandlerInstances();
1315    
1316                    if (portletDataHandlerInstances.isEmpty()) {
1317                            return null;
1318                    }
1319    
1320                    return portletDataHandlerInstances.get(0);
1321            }
1322    
1323            /**
1324             * Returns the filters of the portlet.
1325             *
1326             * @return filters of the portlet
1327             */
1328            @Override
1329            public Map<String, PortletFilter> getPortletFilters() {
1330                    return _portletFilters;
1331            }
1332    
1333            /**
1334             * Returns the portlet info of the portlet.
1335             *
1336             * @return portlet info of the portlet
1337             */
1338            @Override
1339            public PortletInfo getPortletInfo() {
1340                    return _portletInfo;
1341            }
1342    
1343            /**
1344             * Returns the name of the portlet layout listener class of the portlet.
1345             *
1346             * @return the name of the portlet layout listener class of the portlet
1347             */
1348            @Override
1349            public String getPortletLayoutListenerClass() {
1350                    return _portletLayoutListenerClass;
1351            }
1352    
1353            /**
1354             * Returns the portlet layout listener instance of the portlet.
1355             *
1356             * @return the portlet layout listener instance of the portlet
1357             */
1358            @Override
1359            public PortletLayoutListener getPortletLayoutListenerInstance() {
1360                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1361    
1362                    if (portletBag == null) {
1363                            return null;
1364                    }
1365    
1366                    List<PortletLayoutListener> portletLayoutListenerInstances =
1367                            portletBag.getPortletLayoutListenerInstances();
1368    
1369                    if (portletLayoutListenerInstances.isEmpty()) {
1370                            return null;
1371                    }
1372    
1373                    return portletLayoutListenerInstances.get(0);
1374            }
1375    
1376            /**
1377             * Returns the portlet modes of the portlet.
1378             *
1379             * @return portlet modes of the portlet
1380             */
1381            @Override
1382            public Map<String, Set<String>> getPortletModes() {
1383                    return _portletModes;
1384            }
1385    
1386            /**
1387             * Returns the name of the portlet.
1388             *
1389             * @return the display name of the portlet
1390             */
1391            @Override
1392            public String getPortletName() {
1393                    return _portletName;
1394            }
1395    
1396            /**
1397             * Returns the name of the portlet URL class of the portlet.
1398             *
1399             * @return the name of the portlet URL class of the portlet
1400             */
1401            @Override
1402            public String getPortletURLClass() {
1403                    return _portletURLClass;
1404            }
1405    
1406            /**
1407             * Returns <code>true</code> if preferences are shared across the entire
1408             * company.
1409             *
1410             * @return <code>true</code> if preferences are shared across the entire
1411             *         company
1412             */
1413            @Override
1414            public boolean getPreferencesCompanyWide() {
1415                    return _preferencesCompanyWide;
1416            }
1417    
1418            /**
1419             * Returns <code>true</code> if preferences are owned by the group when the
1420             * portlet is shown in a group layout. Returns <code>false</code> if
1421             * preferences are owned by the user at all times.
1422             *
1423             * @return <code>true</code> if preferences are owned by the group when the
1424             *         portlet is shown in a group layout; <code>false</code> if
1425             *         preferences are owned by the user at all times.
1426             */
1427            @Override
1428            public boolean getPreferencesOwnedByGroup() {
1429                    return _preferencesOwnedByGroup;
1430            }
1431    
1432            /**
1433             * Returns <code>true</code> if preferences are unique per layout.
1434             *
1435             * @return <code>true</code> if preferences are unique per layout
1436             */
1437            @Override
1438            public boolean getPreferencesUniquePerLayout() {
1439                    return _preferencesUniquePerLayout;
1440            }
1441    
1442            /**
1443             * Returns the name of the preferences validator class of the portlet.
1444             *
1445             * @return the name of the preferences validator class of the portlet
1446             */
1447            @Override
1448            public String getPreferencesValidator() {
1449                    return _preferencesValidator;
1450            }
1451    
1452            /**
1453             * Returns <code>true</code> if the portlet does not share request
1454             * attributes with the portal or portlets from another WAR.
1455             *
1456             * @return <code>true</code> if the portlet does not share request
1457             *         attributes with the portal or portlets from another WAR
1458             */
1459            @Override
1460            public boolean getPrivateRequestAttributes() {
1461                    return _privateRequestAttributes;
1462            }
1463    
1464            /**
1465             * Returns <code>true</code> if the portlet does not share session
1466             * attributes with the portal.
1467             *
1468             * @return <code>true</code> if the portlet does not share session
1469             *         attributes with the portal
1470             */
1471            @Override
1472            public boolean getPrivateSessionAttributes() {
1473                    return _privateSessionAttributes;
1474            }
1475    
1476            /**
1477             * Returns the processing event from a namespace URI and a local part.
1478             *
1479             * @param  uri the namespace URI
1480             * @param  localPart the local part
1481             * @return the processing event from a namespace URI and a local part
1482             */
1483            @Override
1484            public QName getProcessingEvent(String uri, String localPart) {
1485                    return _processingEventsByQName.get(
1486                            PortletQNameUtil.getKey(uri, localPart));
1487            }
1488    
1489            /**
1490             * Returns the processing events of the portlet.
1491             *
1492             * @return the processing events of the portlet
1493             */
1494            @Override
1495            public Set<QName> getProcessingEvents() {
1496                    return _processingEvents;
1497            }
1498    
1499            /**
1500             * Returns the public render parameter from an identifier.
1501             *
1502             * @param  identifier the identifier
1503             * @return the public render parameter from an identifier
1504             */
1505            @Override
1506            public PublicRenderParameter getPublicRenderParameter(String identifier) {
1507                    return _publicRenderParametersByIdentifier.get(identifier);
1508            }
1509    
1510            /**
1511             * Returns the spublic render parameter from a namespace URI and a local
1512             * part.
1513             *
1514             * @param  uri the namespace URI
1515             * @param  localPart the local part
1516             * @return the spublic render parameter from a namespace URI and a local
1517             *         part
1518             */
1519            @Override
1520            public PublicRenderParameter getPublicRenderParameter(
1521                    String uri, String localPart) {
1522    
1523                    return _publicRenderParametersByQName.get(
1524                            PortletQNameUtil.getKey(uri, localPart));
1525            }
1526    
1527            /**
1528             * Returns the public render parameters of the portlet.
1529             *
1530             * @return the public render parameters of the portlet
1531             */
1532            @Override
1533            public Set<PublicRenderParameter> getPublicRenderParameters() {
1534                    return _publicRenderParameters;
1535            }
1536    
1537            /**
1538             * Returns the publishing events of the portlet.
1539             *
1540             * @return the publishing events of the portlet
1541             */
1542            @Override
1543            public Set<QName> getPublishingEvents() {
1544                    return _publishingEvents;
1545            }
1546    
1547            /**
1548             * Returns <code>true</code> if the portlet is ready to be used.
1549             *
1550             * @return <code>true</code> if the portlet is ready to be used
1551             */
1552            @Override
1553            public boolean getReady() {
1554                    return isReady();
1555            }
1556    
1557            /**
1558             * Returns <code>true</code> if the portlet supports remoting.
1559             *
1560             * @return <code>true</code> if the portlet supports remoting
1561             */
1562            @Override
1563            public boolean getRemoteable() {
1564                    return _remoteable;
1565            }
1566    
1567            /**
1568             * Returns the render timeout of the portlet.
1569             *
1570             * @return the render timeout of the portlet
1571             */
1572            @Override
1573            public int getRenderTimeout() {
1574                    return _renderTimeout;
1575            }
1576    
1577            /**
1578             * Returns the render weight of the portlet.
1579             *
1580             * @return the render weight of the portlet
1581             */
1582            @Override
1583            public int getRenderWeight() {
1584                    return _renderWeight;
1585            }
1586    
1587            /**
1588             * Returns the resource bundle of the portlet.
1589             *
1590             * @return resource bundle of the portlet
1591             */
1592            @Override
1593            public String getResourceBundle() {
1594                    return _resourceBundle;
1595            }
1596    
1597            /**
1598             * Returns <code>true</code> if the portlet restores to the current view
1599             * from the maximized state.
1600             *
1601             * @return <code>true</code> if the portlet restores to the current view
1602             *         from the maximized state
1603             */
1604            @Override
1605            public boolean getRestoreCurrentView() {
1606                    return _restoreCurrentView;
1607            }
1608    
1609            /**
1610             * Returns the role mappers of the portlet.
1611             *
1612             * @return role mappers of the portlet
1613             */
1614            @Override
1615            public Map<String, String> getRoleMappers() {
1616                    return _roleMappers;
1617            }
1618    
1619            /**
1620             * Returns an array of required roles of the portlet.
1621             *
1622             * @return an array of required roles of the portlet
1623             */
1624            @Override
1625            public String[] getRolesArray() {
1626                    return _rolesArray;
1627            }
1628    
1629            /**
1630             * Returns the root portlet of this portlet instance.
1631             *
1632             * @return the root portlet of this portlet instance
1633             */
1634            @Override
1635            public Portlet getRootPortlet() {
1636                    return _rootPortlet;
1637            }
1638    
1639            /**
1640             * Returns the root portlet ID of the portlet.
1641             *
1642             * @return the root portlet ID of the portlet
1643             */
1644            @Override
1645            public String getRootPortletId() {
1646                    return PortletConstants.getRootPortletId(getPortletId());
1647            }
1648    
1649            /**
1650             * Returns the scheduler entries of the portlet.
1651             *
1652             * @return the scheduler entries of the portlet
1653             */
1654            @Override
1655            public List<SchedulerEntry> getSchedulerEntries() {
1656                    return _schedulerEntries;
1657            }
1658    
1659            /**
1660             * Returns <code>true</code> if the portlet supports scoping of data.
1661             *
1662             * @return <code>true</code> if the portlet supports scoping of data
1663             */
1664            @Override
1665            public boolean getScopeable() {
1666                    return _scopeable;
1667            }
1668    
1669            /**
1670             * Returns <code>true</code> if users are shown that they do not have access
1671             * to the portlet.
1672             *
1673             * @return <code>true</code> if users are shown that they do not have access
1674             *         to the portlet
1675             */
1676            @Override
1677            public boolean getShowPortletAccessDenied() {
1678                    return _showPortletAccessDenied;
1679            }
1680    
1681            /**
1682             * Returns <code>true</code> if users are shown that the portlet is
1683             * inactive.
1684             *
1685             * @return <code>true</code> if users are shown that the portlet is inactive
1686             */
1687            @Override
1688            public boolean getShowPortletInactive() {
1689                    return _showPortletInactive;
1690            }
1691    
1692            /**
1693             * Returns <code>true</code> if the portlet uses Single Page Application.
1694             *
1695             * @return <code>true</code> if the portlet uses Single Page Application
1696             */
1697            @Override
1698            public boolean getSinglePageApplication() {
1699                    return _singlePageApplication;
1700            }
1701    
1702            /**
1703             * Returns the names of the classes that represent social activity
1704             * interpreters associated with the portlet.
1705             *
1706             * @return the names of the classes that represent social activity
1707             *         interpreters associated with the portlet
1708             */
1709            @Override
1710            public List<String> getSocialActivityInterpreterClasses() {
1711                    return _socialActivityInterpreterClasses;
1712            }
1713    
1714            /**
1715             * Returns the social activity interpreter instances of the portlet.
1716             *
1717             * @return the social activity interpreter instances of the portlet
1718             */
1719            @Override
1720            public List<SocialActivityInterpreter>
1721                    getSocialActivityInterpreterInstances() {
1722    
1723                    if (_socialActivityInterpreterClasses.isEmpty()) {
1724                            return null;
1725                    }
1726    
1727                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1728    
1729                    return portletBag.getSocialActivityInterpreterInstances();
1730            }
1731    
1732            /**
1733             * Returns the name of the social request interpreter class of the portlet.
1734             *
1735             * @return the name of the social request interpreter class of the portlet
1736             */
1737            @Override
1738            public String getSocialRequestInterpreterClass() {
1739                    return _socialRequestInterpreterClass;
1740            }
1741    
1742            /**
1743             * Returns the name of the social request interpreter instance of the
1744             * portlet.
1745             *
1746             * @return the name of the social request interpreter instance of the
1747             *         portlet
1748             */
1749            @Override
1750            public SocialRequestInterpreter getSocialRequestInterpreterInstance() {
1751                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1752    
1753                    List<SocialRequestInterpreter> socialRequestInterpreterInstances =
1754                            portletBag.getSocialRequestInterpreterInstances();
1755    
1756                    if (socialRequestInterpreterInstances.isEmpty()) {
1757                            return null;
1758                    }
1759    
1760                    return socialRequestInterpreterInstances.get(0);
1761            }
1762    
1763            /**
1764             * Returns the names of the classes that represent staged model data
1765             * handlers associated with the portlet.
1766             *
1767             * @return the names of the classes that represent staged model data
1768             *         handlers associated with the portlet
1769             */
1770            @Override
1771            public List<String> getStagedModelDataHandlerClasses() {
1772                    return _stagedModelDataHandlerClasses;
1773            }
1774    
1775            /**
1776             * Returns the staged model data handler instances of the portlet.
1777             *
1778             * @return the staged model data handler instances of the portlet
1779             */
1780            @Override
1781            public List<StagedModelDataHandler<?>>
1782                    getStagedModelDataHandlerInstances() {
1783    
1784                    if (_stagedModelDataHandlerClasses.isEmpty()) {
1785                            return null;
1786                    }
1787    
1788                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1789    
1790                    return portletBag.getStagedModelDataHandlerInstances();
1791            }
1792    
1793            /**
1794             * Returns <code>true</code> if the portlet is a static portlet that is
1795             * cannot be moved.
1796             *
1797             * @return <code>true</code> if the portlet is a static portlet that is
1798             *         cannot be moved
1799             */
1800            @Override
1801            public boolean getStatic() {
1802                    return _staticPortlet;
1803            }
1804    
1805            /**
1806             * Returns <code>true</code> if the portlet is a static portlet at the end
1807             * of a list of portlets.
1808             *
1809             * @return <code>true</code> if the portlet is a static portlet at the end
1810             *         of a list of portlets
1811             */
1812            @Override
1813            public boolean getStaticEnd() {
1814                    return !_staticPortletStart;
1815            }
1816    
1817            /**
1818             * Returns the path for static resources served by this portlet.
1819             *
1820             * @return the path for static resources served by this portlet
1821             */
1822            @Override
1823            public String getStaticResourcePath() {
1824                    String proxyPath = PortalUtil.getPathProxy();
1825    
1826                    String virtualPath = getVirtualPath();
1827    
1828                    if (Validator.isNotNull(virtualPath)) {
1829                            return proxyPath.concat(virtualPath);
1830                    }
1831    
1832                    String contextPath = getContextPath();
1833    
1834                    if (!_portletApp.isWARFile()) {
1835                            return contextPath;
1836                    }
1837    
1838                    return proxyPath.concat(contextPath);
1839            }
1840    
1841            /**
1842             * Returns <code>true</code> if the portlet is a static portlet at the start
1843             * of a list of portlets.
1844             *
1845             * @return <code>true</code> if the portlet is a static portlet at the start
1846             *         of a list of portlets
1847             */
1848            @Override
1849            public boolean getStaticStart() {
1850                    return _staticPortletStart;
1851            }
1852    
1853            /**
1854             * Returns the struts path of the portlet.
1855             *
1856             * @return the struts path of the portlet
1857             */
1858            @Override
1859            public String getStrutsPath() {
1860                    return _strutsPath;
1861            }
1862    
1863            /**
1864             * Returns the supported locales of the portlet.
1865             *
1866             * @return the supported locales of the portlet
1867             */
1868            @Override
1869            public Set<String> getSupportedLocales() {
1870                    return _supportedLocales;
1871            }
1872    
1873            /**
1874             * Returns <code>true</code> if the portlet is a system portlet that a user
1875             * cannot manually add to their page.
1876             *
1877             * @return <code>true</code> if the portlet is a system portlet that a user
1878             *         cannot manually add to their page
1879             */
1880            @Override
1881            public boolean getSystem() {
1882                    return _system;
1883            }
1884    
1885            /**
1886             * Returns the name of the template handler class of the portlet.
1887             *
1888             * @return the name of the template handler class of the portlet
1889             */
1890            @Override
1891            public String getTemplateHandlerClass() {
1892                    return _templateHandlerClass;
1893            }
1894    
1895            /**
1896             * Returns the template handler instance of the portlet.
1897             *
1898             * @return the template handler instance of the portlet
1899             */
1900            @Override
1901            public TemplateHandler getTemplateHandlerInstance() {
1902                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1903    
1904                    List<TemplateHandler> templateHandlerInstances =
1905                            portletBag.getTemplateHandlerInstances();
1906    
1907                    if (templateHandlerInstances.isEmpty()) {
1908                            return null;
1909                    }
1910    
1911                    return templateHandlerInstances.get(0);
1912            }
1913    
1914            /**
1915             * Returns the timestamp of the portlet.
1916             *
1917             * @return the timestamp of the portlet
1918             */
1919            @Override
1920            public long getTimestamp() {
1921                    if (_timestamp == null) {
1922                            PortletApp portletApp = getPortletApp();
1923    
1924                            ServletContext servletContext = portletApp.getServletContext();
1925    
1926                            _timestamp = ServletContextUtil.getLastModified(
1927                                    servletContext, StringPool.SLASH, true);
1928                    }
1929    
1930                    return _timestamp;
1931            }
1932    
1933            /**
1934             * Returns the names of the classes that represent trash handlers associated
1935             * with the portlet.
1936             *
1937             * @return the names of the classes that represent trash handlers associated
1938             *         with the portlet
1939             */
1940            @Override
1941            public List<String> getTrashHandlerClasses() {
1942                    return _trashHandlerClasses;
1943            }
1944    
1945            /**
1946             * Returns the trash handler instances of the portlet.
1947             *
1948             * @return the trash handler instances of the portlet
1949             */
1950            @Override
1951            public List<TrashHandler> getTrashHandlerInstances() {
1952                    if (_trashHandlerClasses.isEmpty()) {
1953                            return null;
1954                    }
1955    
1956                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1957    
1958                    return portletBag.getTrashHandlerInstances();
1959            }
1960    
1961            /**
1962             * Returns <code>true</code> if the portlet is an undeployed portlet.
1963             *
1964             * @return <code>true</code> if the portlet is a placeholder of an
1965             *         undeployed portlet
1966             */
1967            @Override
1968            public boolean getUndeployedPortlet() {
1969                    return _undeployedPortlet;
1970            }
1971    
1972            /**
1973             * Returns the unlinked roles of the portlet.
1974             *
1975             * @return unlinked roles of the portlet
1976             */
1977            @Override
1978            public Set<String> getUnlinkedRoles() {
1979                    return _unlinkedRoles;
1980            }
1981    
1982            /**
1983             * Returns the name of the URL encoder class of the portlet.
1984             *
1985             * @return the name of the URL encoder class of the portlet
1986             */
1987            @Override
1988            public String getURLEncoderClass() {
1989                    return _urlEncoderClass;
1990            }
1991    
1992            /**
1993             * Returns the URL encoder instance of the portlet.
1994             *
1995             * @return the URL encoder instance of the portlet
1996             */
1997            @Override
1998            public URLEncoder getURLEncoderInstance() {
1999                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
2000    
2001                    List<URLEncoder> urlEncoderInstances =
2002                            portletBag.getURLEncoderInstances();
2003    
2004                    if (urlEncoderInstances.isEmpty()) {
2005                            return null;
2006                    }
2007    
2008                    return urlEncoderInstances.get(0);
2009            }
2010    
2011            /**
2012             * Returns <code>true</code> if the portlet uses the default template.
2013             *
2014             * @return <code>true</code> if the portlet uses the default template
2015             */
2016            @Override
2017            public boolean getUseDefaultTemplate() {
2018                    return _useDefaultTemplate;
2019            }
2020    
2021            /**
2022             * Returns the user ID of the portlet. This only applies when the portlet is
2023             * added by a user in a customizable layout.
2024             *
2025             * @return the user ID of the portlet
2026             */
2027            @Override
2028            public long getUserId() {
2029                    return PortletConstants.getUserId(getPortletId());
2030            }
2031    
2032            /**
2033             * Returns the class loader resource path to the use notification
2034             * definitions of the portlet.
2035             *
2036             * @return the class loader resource path to the use notification
2037             *         definitions of the portlet
2038             */
2039            @Override
2040            public String getUserNotificationDefinitions() {
2041                    return _userNotificationDefinitions;
2042            }
2043    
2044            /**
2045             * Returns the names of the classes that represent user notification
2046             * handlers associated with the portlet.
2047             *
2048             * @return the names of the classes that represent user notification
2049             *         handlers associated with the portlet
2050             */
2051            @Override
2052            public List<String> getUserNotificationHandlerClasses() {
2053                    return _userNotificationHandlerClasses;
2054            }
2055    
2056            /**
2057             * Returns the user notification handler instances of the portlet.
2058             *
2059             * @return the user notification handler instances of the portlet
2060             */
2061            @Override
2062            public List<UserNotificationHandler>
2063                    getUserNotificationHandlerInstances() {
2064    
2065                    if (_userNotificationHandlerClasses.isEmpty()) {
2066                            return null;
2067                    }
2068    
2069                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
2070    
2071                    return portletBag.getUserNotificationHandlerInstances();
2072            }
2073    
2074            /**
2075             * Returns the user principal strategy of the portlet.
2076             *
2077             * @return the user principal strategy of the portlet
2078             */
2079            @Override
2080            public String getUserPrincipalStrategy() {
2081                    return _userPrincipalStrategy;
2082            }
2083    
2084            /**
2085             * Returns the virtual path of the portlet.
2086             *
2087             * @return the virtual path of the portlet
2088             */
2089            @Override
2090            public String getVirtualPath() {
2091                    return _virtualPath;
2092            }
2093    
2094            /**
2095             * Returns the name of the WebDAV storage class of the portlet.
2096             *
2097             * @return the name of the WebDAV storage class of the portlet
2098             */
2099            @Override
2100            public String getWebDAVStorageClass() {
2101                    return _webDAVStorageClass;
2102            }
2103    
2104            /**
2105             * Returns the name of the WebDAV storage instance of the portlet.
2106             *
2107             * @return the name of the WebDAV storage instance of the portlet
2108             */
2109            @Override
2110            public WebDAVStorage getWebDAVStorageInstance() {
2111                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
2112    
2113                    List<WebDAVStorage> webDAVStorageInstances =
2114                            portletBag.getWebDAVStorageInstances();
2115    
2116                    if (webDAVStorageInstances.isEmpty()) {
2117                            return null;
2118                    }
2119    
2120                    return webDAVStorageInstances.get(0);
2121            }
2122    
2123            /**
2124             * Returns the name of the WebDAV storage token of the portlet.
2125             *
2126             * @return the name of the WebDAV storage token of the portlet
2127             */
2128            @Override
2129            public String getWebDAVStorageToken() {
2130                    return _webDAVStorageToken;
2131            }
2132    
2133            /**
2134             * Returns the window states of the portlet.
2135             *
2136             * @return window states of the portlet
2137             */
2138            @Override
2139            public Map<String, Set<String>> getWindowStates() {
2140                    return _windowStates;
2141            }
2142    
2143            /**
2144             * Returns the names of the classes that represent workflow handlers
2145             * associated with the portlet.
2146             *
2147             * @return the names of the classes that represent workflow handlers
2148             *         associated with the portlet
2149             */
2150            @Override
2151            public List<String> getWorkflowHandlerClasses() {
2152                    return _workflowHandlerClasses;
2153            }
2154    
2155            /**
2156             * Returns the workflow handler instances of the portlet.
2157             *
2158             * @return the workflow handler instances of the portlet
2159             */
2160            @Override
2161            public List<WorkflowHandler<?>> getWorkflowHandlerInstances() {
2162                    if (_workflowHandlerClasses.isEmpty()) {
2163                            return null;
2164                    }
2165    
2166                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
2167    
2168                    return portletBag.getWorkflowHandlerInstances();
2169            }
2170    
2171            /**
2172             * Returns the name of the XML-RPC method class of the portlet.
2173             *
2174             * @return the name of the XML-RPC method class of the portlet
2175             */
2176            @Override
2177            public String getXmlRpcMethodClass() {
2178                    return _xmlRpcMethodClass;
2179            }
2180    
2181            /**
2182             * Returns the name of the XML-RPC method instance of the portlet.
2183             *
2184             * @return the name of the XML-RPC method instance of the portlet
2185             */
2186            @Override
2187            public Method getXmlRpcMethodInstance() {
2188                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
2189    
2190                    List<Method> xmlRpcMethodInstances =
2191                            portletBag.getXmlRpcMethodInstances();
2192    
2193                    if (xmlRpcMethodInstances.isEmpty()) {
2194                            return null;
2195                    }
2196    
2197                    return xmlRpcMethodInstances.get(0);
2198            }
2199    
2200            /**
2201             * Returns <code>true</code> if the user has the permission to add the
2202             * portlet to a layout.
2203             *
2204             * @param  userId the primary key of the user
2205             * @return <code>true</code> if the user has the permission to add the
2206             *         portlet to a layout
2207             */
2208            @Override
2209            public boolean hasAddPortletPermission(long userId) {
2210                    PermissionChecker permissionChecker =
2211                            PermissionThreadLocal.getPermissionChecker();
2212    
2213                    try {
2214                            if ((permissionChecker == null) ||
2215                                    (permissionChecker.getUserId() != userId)) {
2216    
2217                                    User user = UserLocalServiceUtil.getUser(userId);
2218    
2219                                    permissionChecker = PermissionCheckerFactoryUtil.create(user);
2220                            }
2221    
2222                            if (PortletPermissionUtil.contains(
2223                                            permissionChecker, getRootPortletId(),
2224                                            ActionKeys.ADD_TO_PAGE)) {
2225    
2226                                    return true;
2227                            }
2228                    }
2229                    catch (Exception e) {
2230                            _log.error(e, e);
2231                    }
2232    
2233                    return false;
2234            }
2235    
2236            @Override
2237            public boolean hasFooterPortalCss() {
2238                    return !_footerPortalCss.isEmpty();
2239            }
2240    
2241            @Override
2242            public boolean hasFooterPortalJavaScript() {
2243                    return !_footerPortalJavaScript.isEmpty();
2244            }
2245    
2246            @Override
2247            public boolean hasFooterPortletCss() {
2248                    return !_footerPortletCss.isEmpty();
2249            }
2250    
2251            @Override
2252            public boolean hasFooterPortletJavaScript() {
2253                    return !_footerPortletJavaScript.isEmpty();
2254            }
2255    
2256            @Override
2257            public int hashCode() {
2258                    String portletId = getPortletId();
2259    
2260                    return portletId.hashCode();
2261            }
2262    
2263            @Override
2264            public boolean hasHeaderPortalCss() {
2265                    return !_headerPortalCss.isEmpty();
2266            }
2267    
2268            @Override
2269            public boolean hasHeaderPortalJavaScript() {
2270                    return !_headerPortalJavaScript.isEmpty();
2271            }
2272    
2273            @Override
2274            public boolean hasHeaderPortletCss() {
2275                    return !_headerPortletCss.isEmpty();
2276            }
2277    
2278            @Override
2279            public boolean hasHeaderPortletJavaScript() {
2280                    return !_headerPortletJavaScript.isEmpty();
2281            }
2282    
2283            /**
2284             * Returns <code>true</code> if the portlet supports more than one mime
2285             * type.
2286             *
2287             * @return <code>true</code> if the portlet supports more than one mime type
2288             */
2289            @Override
2290            public boolean hasMultipleMimeTypes() {
2291                    if (_portletModes.size() > 1) {
2292                            return true;
2293                    }
2294                    else {
2295                            return false;
2296                    }
2297            }
2298    
2299            /**
2300             * Returns <code>true</code> if the portlet supports the specified mime type
2301             * and portlet mode.
2302             *
2303             * @param  mimeType the mime type
2304             * @param  portletMode the portlet mode
2305             * @return <code>true</code> if the portlet supports the specified mime type
2306             *         and portlet mode
2307             */
2308            @Override
2309            public boolean hasPortletMode(String mimeType, PortletMode portletMode) {
2310                    if (mimeType == null) {
2311                            mimeType = ContentTypes.TEXT_HTML;
2312                    }
2313    
2314                    Set<String> mimeTypePortletModes = _portletModes.get(mimeType);
2315    
2316                    if (mimeTypePortletModes == null) {
2317                            return false;
2318                    }
2319    
2320                    if (mimeTypePortletModes.contains(portletMode.toString())) {
2321                            return true;
2322                    }
2323                    else {
2324                            return false;
2325                    }
2326            }
2327    
2328            /**
2329             * Returns <code>true</code> if the portlet has a role with the specified
2330             * name.
2331             *
2332             * @param  roleName the role name
2333             * @return <code>true</code> if the portlet has a role with the specified
2334             *         name
2335             */
2336            @Override
2337            public boolean hasRoleWithName(String roleName) {
2338                    if (ArrayUtil.isEmpty(_rolesArray)) {
2339                            return false;
2340                    }
2341    
2342                    for (String curRoleName : _rolesArray) {
2343                            if (StringUtil.equalsIgnoreCase(curRoleName, roleName)) {
2344                                    return true;
2345                            }
2346                    }
2347    
2348                    return false;
2349            }
2350    
2351            /**
2352             * Returns <code>true</code> if the portlet supports the specified mime type
2353             * and window state.
2354             *
2355             * @param  mimeType the mime type
2356             * @param  windowState the window state
2357             * @return <code>true</code> if the portlet supports the specified mime type
2358             *         and window state
2359             */
2360            @Override
2361            public boolean hasWindowState(String mimeType, WindowState windowState) {
2362                    if (mimeType == null) {
2363                            mimeType = ContentTypes.TEXT_HTML;
2364                    }
2365    
2366                    Set<String> mimeTypeWindowStates = _windowStates.get(mimeType);
2367    
2368                    if (mimeTypeWindowStates == null) {
2369                            return false;
2370                    }
2371    
2372                    if (mimeTypeWindowStates.contains(windowState.toString())) {
2373                            return true;
2374                    }
2375                    else {
2376                            return false;
2377                    }
2378            }
2379    
2380            /**
2381             * Returns <code>true</code> if an action URL for this portlet should cause
2382             * an auto redirect.
2383             *
2384             * @return <code>true</code> if an action URL for this portlet should cause
2385             *         an auto redirect
2386             */
2387            @Override
2388            public boolean isActionURLRedirect() {
2389                    return _actionURLRedirect;
2390            }
2391    
2392            /**
2393             * Returns <code>true</code> if default resources for the portlet are added
2394             * to a page.
2395             *
2396             * @return <code>true</code> if default resources for the portlet are added
2397             *         to a page
2398             */
2399            @Override
2400            public boolean isAddDefaultResource() {
2401                    return _addDefaultResource;
2402            }
2403    
2404            /**
2405             * Returns <code>true</code> if the portlet can be displayed via Ajax.
2406             *
2407             * @return <code>true</code> if the portlet can be displayed via Ajax
2408             */
2409            @Override
2410            public boolean isAjaxable() {
2411                    return _ajaxable;
2412            }
2413    
2414            @Override
2415            public boolean isFullPageDisplayable() {
2416                    return _applicationTypes.contains(
2417                            ApplicationType.FULL_PAGE_APPLICATION);
2418            }
2419    
2420            /**
2421             * Returns <code>true</code> to include the portlet and make it available to
2422             * be made active.
2423             *
2424             * @return <code>true</code> to include the portlet and make it available to
2425             *         be made active
2426             */
2427            @Override
2428            public boolean isInclude() {
2429                    return _include;
2430            }
2431    
2432            /**
2433             * Returns <code>true</code> if the portlet can be added multiple times to a
2434             * layout.
2435             *
2436             * @return <code>true</code> if the portlet can be added multiple times to a
2437             *         layout
2438             */
2439            @Override
2440            public boolean isInstanceable() {
2441                    return _instanceable;
2442            }
2443    
2444            /**
2445             * Returns <code>true</code> to allow the portlet to be cached within the
2446             * layout.
2447             *
2448             * @return <code>true</code> if the portlet can be cached within the layout
2449             */
2450            @Override
2451            public boolean isLayoutCacheable() {
2452                    return _layoutCacheable;
2453            }
2454    
2455            /**
2456             * Returns <code>true</code> if the portlet goes into the maximized state
2457             * when the user goes into the edit mode.
2458             *
2459             * @return <code>true</code> if the portlet goes into the maximized state
2460             *         when the user goes into the edit mode
2461             */
2462            @Override
2463            public boolean isMaximizeEdit() {
2464                    return _maximizeEdit;
2465            }
2466    
2467            /**
2468             * Returns <code>true</code> if the portlet goes into the maximized state
2469             * when the user goes into the help mode.
2470             *
2471             * @return <code>true</code> if the portlet goes into the maximized state
2472             *         when the user goes into the help mode
2473             */
2474            @Override
2475            public boolean isMaximizeHelp() {
2476                    return _maximizeHelp;
2477            }
2478    
2479            /**
2480             * Returns <code>true</code> if the portlet goes into the pop up state when
2481             * the user goes into the print mode.
2482             *
2483             * @return <code>true</code> if the portlet goes into the pop up state when
2484             *         the user goes into the print mode
2485             */
2486            @Override
2487            public boolean isPopUpPrint() {
2488                    return _popUpPrint;
2489            }
2490    
2491            /**
2492             * Returns <code>true</code> if preferences are shared across the entire
2493             * company.
2494             *
2495             * @return <code>true</code> if preferences are shared across the entire
2496             *         company
2497             */
2498            @Override
2499            public boolean isPreferencesCompanyWide() {
2500                    return _preferencesCompanyWide;
2501            }
2502    
2503            /**
2504             * Returns <code>true</code> if preferences are owned by the group when the
2505             * portlet is shown in a group layout. Returns <code>false</code> if
2506             * preferences are owned by the user at all times.
2507             *
2508             * @return <code>true</code> if preferences are owned by the group when the
2509             *         portlet is shown in a group layout; <code>false</code> if
2510             *         preferences are owned by the user at all times.
2511             */
2512            @Override
2513            public boolean isPreferencesOwnedByGroup() {
2514                    return _preferencesOwnedByGroup;
2515            }
2516    
2517            /**
2518             * Returns <code>true</code> if preferences are unique per layout.
2519             *
2520             * @return <code>true</code> if preferences are unique per layout
2521             */
2522            @Override
2523            public boolean isPreferencesUniquePerLayout() {
2524                    return _preferencesUniquePerLayout;
2525            }
2526    
2527            /**
2528             * Returns <code>true</code> if the portlet does not share request
2529             * attributes with the portal or portlets from another WAR.
2530             *
2531             * @return <code>true</code> if the portlet does not share request
2532             *         attributes with the portal or portlets from another WAR
2533             */
2534            @Override
2535            public boolean isPrivateRequestAttributes() {
2536                    return _privateRequestAttributes;
2537            }
2538    
2539            /**
2540             * Returns <code>true</code> if the portlet does not share session
2541             * attributes with the portal.
2542             *
2543             * @return <code>true</code> if the portlet does not share session
2544             *         attributes with the portal
2545             */
2546            @Override
2547            public boolean isPrivateSessionAttributes() {
2548                    return _privateSessionAttributes;
2549            }
2550    
2551            /**
2552             * Returns <code>true</code> if the portlet is ready to be used.
2553             *
2554             * @return <code>true</code> if the portlet is ready to be used
2555             */
2556            @Override
2557            public boolean isReady() {
2558                    Boolean ready = _readyMap.get(getRootPortletId());
2559    
2560                    if (ready == null) {
2561                            return true;
2562                    }
2563                    else {
2564                            return ready;
2565                    }
2566            }
2567    
2568            /**
2569             * Returns <code>true</code> if the portlet supports remoting.
2570             *
2571             * @return <code>true</code> if the portlet supports remoting
2572             */
2573            @Override
2574            public boolean isRemoteable() {
2575                    return _remoteable;
2576            }
2577    
2578            /**
2579             * Returns <code>true</code> if the portlet will only process namespaced
2580             * parameters.
2581             *
2582             * @return <code>true</code> if the portlet will only process namespaced
2583             *         parameters
2584             */
2585            @Override
2586            public boolean isRequiresNamespacedParameters() {
2587                    return _requiresNamespacedParameters;
2588            }
2589    
2590            /**
2591             * Returns <code>true</code> if the portlet restores to the current view
2592             * from the maximized state.
2593             *
2594             * @return <code>true</code> if the portlet restores to the current view
2595             *         from the maximized state
2596             */
2597            @Override
2598            public boolean isRestoreCurrentView() {
2599                    return _restoreCurrentView;
2600            }
2601    
2602            /**
2603             * Returns <code>true</code> if the portlet supports scoping of data.
2604             *
2605             * @return <code>true</code> if the portlet supports scoping of data
2606             */
2607            @Override
2608            public boolean isScopeable() {
2609                    return _scopeable;
2610            }
2611    
2612            /**
2613             * Returns <code>true</code> if users are shown that they do not have access
2614             * to the portlet.
2615             *
2616             * @return <code>true</code> if users are shown that they do not have access
2617             *         to the portlet
2618             */
2619            @Override
2620            public boolean isShowPortletAccessDenied() {
2621                    return _showPortletAccessDenied;
2622            }
2623    
2624            /**
2625             * Returns <code>true</code> if users are shown that the portlet is
2626             * inactive.
2627             *
2628             * @return <code>true</code> if users are shown that the portlet is inactive
2629             */
2630            @Override
2631            public boolean isShowPortletInactive() {
2632                    return _showPortletInactive;
2633            }
2634    
2635            /**
2636             * Returns <code>true</code> if the portlet uses Single Page Application.
2637             *
2638             * @return <code>true</code> if the portlet uses Single Page Application
2639             */
2640            @Override
2641            public boolean isSinglePageApplication() {
2642                    return _singlePageApplication;
2643            }
2644    
2645            /**
2646             * Returns <code>true</code> if the portlet is a static portlet that is
2647             * cannot be moved.
2648             *
2649             * @return <code>true</code> if the portlet is a static portlet that is
2650             *         cannot be moved
2651             */
2652            @Override
2653            public boolean isStatic() {
2654                    return _staticPortlet;
2655            }
2656    
2657            /**
2658             * Returns <code>true</code> if the portlet is a static portlet at the end
2659             * of a list of portlets.
2660             *
2661             * @return <code>true</code> if the portlet is a static portlet at the end
2662             *         of a list of portlets
2663             */
2664            @Override
2665            public boolean isStaticEnd() {
2666                    return !_staticPortletStart;
2667            }
2668    
2669            /**
2670             * Returns <code>true</code> if the portlet is a static portlet at the start
2671             * of a list of portlets.
2672             *
2673             * @return <code>true</code> if the portlet is a static portlet at the start
2674             *         of a list of portlets
2675             */
2676            @Override
2677            public boolean isStaticStart() {
2678                    return _staticPortletStart;
2679            }
2680    
2681            /**
2682             * Returns <code>true</code> if the portlet is a system portlet that a user
2683             * cannot manually add to their page.
2684             *
2685             * @return <code>true</code> if the portlet is a system portlet that a user
2686             *         cannot manually add to their page
2687             */
2688            @Override
2689            public boolean isSystem() {
2690                    return _system;
2691            }
2692    
2693            /**
2694             * Returns <code>true</code> if the portlet is an undeployed portlet.
2695             *
2696             * @return <code>true</code> if the portlet is a placeholder of an
2697             *         undeployed portlet
2698             */
2699            @Override
2700            public boolean isUndeployedPortlet() {
2701                    return _undeployedPortlet;
2702            }
2703    
2704            /**
2705             * Returns <code>true</code> if the portlet uses the default template.
2706             *
2707             * @return <code>true</code> if the portlet uses the default template
2708             */
2709            @Override
2710            public boolean isUseDefaultTemplate() {
2711                    return _useDefaultTemplate;
2712            }
2713    
2714            /**
2715             * Link the role names set in portlet.xml with the Liferay roles set in
2716             * liferay-portlet.xml.
2717             */
2718            @Override
2719            public void linkRoles() {
2720                    List<String> linkedRoles = new ArrayList<>();
2721    
2722                    for (String unlinkedRole : _unlinkedRoles) {
2723                            String roleLink = _roleMappers.get(unlinkedRole);
2724    
2725                            if (Validator.isNotNull(roleLink)) {
2726                                    if (_log.isDebugEnabled()) {
2727                                            _log.debug(
2728                                                    "Linking role for portlet [" + getPortletId() +
2729                                                            "] with role-name [" + unlinkedRole +
2730                                                                    "] to role-link [" + roleLink + "]");
2731                                    }
2732    
2733                                    linkedRoles.add(roleLink);
2734                            }
2735                            else {
2736                                    _log.error(
2737                                            "Unable to link role for portlet [" + getPortletId() +
2738                                                    "] with role-name [" + unlinkedRole +
2739                                                            "] because role-link is null");
2740                            }
2741                    }
2742    
2743                    String[] array = linkedRoles.toArray(new String[linkedRoles.size()]);
2744    
2745                    Arrays.sort(array);
2746    
2747                    setRolesArray(array);
2748            }
2749    
2750            /**
2751             * Sets the action timeout of the portlet.
2752             *
2753             * @param actionTimeout the action timeout of the portlet
2754             */
2755            @Override
2756            public void setActionTimeout(int actionTimeout) {
2757                    _actionTimeout = actionTimeout;
2758            }
2759    
2760            /**
2761             * Set to <code>true</code> if an action URL for this portlet should cause
2762             * an auto redirect.
2763             *
2764             * @param actionURLRedirect boolean value for whether an action URL for this
2765             *        portlet should cause an auto redirect
2766             */
2767            @Override
2768            public void setActionURLRedirect(boolean actionURLRedirect) {
2769                    _actionURLRedirect = actionURLRedirect;
2770            }
2771    
2772            /**
2773             * Set to <code>true</code> if default resources for the portlet are added
2774             * to a page.
2775             *
2776             * @param addDefaultResource boolean value for whether or not default
2777             *        resources for the portlet are added to a page
2778             */
2779            @Override
2780            public void setAddDefaultResource(boolean addDefaultResource) {
2781                    _addDefaultResource = addDefaultResource;
2782            }
2783    
2784            /**
2785             * Set to <code>true</code> if the portlet can be displayed via Ajax.
2786             *
2787             * @param ajaxable boolean value for whether the portlet can be displayed
2788             *        via Ajax
2789             */
2790            @Override
2791            public void setAjaxable(boolean ajaxable) {
2792                    _ajaxable = ajaxable;
2793            }
2794    
2795            /**
2796             * Sets the application types of the portlet.
2797             *
2798             * @param applicationTypes the application types of the portlet
2799             */
2800            @Override
2801            public void setApplicationTypes(Set<ApplicationType> applicationTypes) {
2802                    for (ApplicationType applicationType : applicationTypes) {
2803                            addApplicationType(applicationType);
2804                    }
2805            }
2806    
2807            /**
2808             * Sets the names of the classes that represent asset types associated with
2809             * the portlet.
2810             *
2811             * @param assetRendererFactoryClasses the names of the classes that
2812             *        represent asset types associated with the portlet
2813             */
2814            @Override
2815            public void setAssetRendererFactoryClasses(
2816                    List<String> assetRendererFactoryClasses) {
2817    
2818                    _assetRendererFactoryClasses = assetRendererFactoryClasses;
2819            }
2820    
2821            /**
2822             * Sets the names of the classes that represent atom collection adapters
2823             * associated with the portlet.
2824             *
2825             * @param atomCollectionAdapterClasses the names of the classes that
2826             *        represent atom collection adapters associated with the portlet
2827             */
2828            @Override
2829            public void setAtomCollectionAdapterClasses(
2830                    List<String> atomCollectionAdapterClasses) {
2831    
2832                    _atomCollectionAdapterClasses = atomCollectionAdapterClasses;
2833            }
2834    
2835            /**
2836             * Sets the names of the parameters that will be automatically propagated
2837             * through the portlet.
2838             *
2839             * @param autopropagatedParameters the names of the parameters that will be
2840             *        automatically propagated through the portlet
2841             */
2842            @Override
2843            public void setAutopropagatedParameters(
2844                    Set<String> autopropagatedParameters) {
2845    
2846                    _autopropagatedParameters = autopropagatedParameters;
2847            }
2848    
2849            /**
2850             * Sets the configuration action class of the portlet.
2851             *
2852             * @param configurationActionClass the configuration action class of the
2853             *        portlet
2854             */
2855            @Override
2856            public void setConfigurationActionClass(String configurationActionClass) {
2857                    _configurationActionClass = configurationActionClass;
2858            }
2859    
2860            /**
2861             * Set the name of the category of the Control Panel where the portlet will
2862             * be shown.
2863             *
2864             * @param controlPanelEntryCategory the name of the category of the Control
2865             *        Panel where the portlet will be shown
2866             */
2867            @Override
2868            public void setControlPanelEntryCategory(String controlPanelEntryCategory) {
2869                    _controlPanelEntryCategory = controlPanelEntryCategory;
2870            }
2871    
2872            /**
2873             * Sets the name of the class that will control when the portlet will be
2874             * shown in the Control Panel.
2875             *
2876             * @param controlPanelEntryClass the name of the class that will control
2877             *        when the portlet will be shown in the Control Panel
2878             */
2879            @Override
2880            public void setControlPanelEntryClass(String controlPanelEntryClass) {
2881                    _controlPanelEntryClass = controlPanelEntryClass;
2882            }
2883    
2884            /**
2885             * Sets the relative weight of the portlet with respect to the other
2886             * portlets in the same category of the Control Panel.
2887             *
2888             * @param controlPanelEntryWeight the relative weight of the portlet with
2889             *        respect to the other portlets in the same category of the Control
2890             *        Panel
2891             */
2892            @Override
2893            public void setControlPanelEntryWeight(double controlPanelEntryWeight) {
2894                    _controlPanelEntryWeight = controlPanelEntryWeight;
2895            }
2896    
2897            /**
2898             * Sets the name of the CSS class that will be injected in the DIV that
2899             * wraps this portlet.
2900             *
2901             * @param cssClassWrapper the name of the CSS class that will be injected in
2902             *        the DIV that wraps this portlet
2903             */
2904            @Override
2905            public void setCssClassWrapper(String cssClassWrapper) {
2906                    _cssClassWrapper = cssClassWrapper;
2907            }
2908    
2909            /**
2910             * Sets the names of the classes that represent custom attribute displays
2911             * associated with the portlet.
2912             *
2913             * @param customAttributesDisplayClasses the names of the classes that
2914             *        represent custom attribute displays associated with the portlet
2915             */
2916            @Override
2917            public void setCustomAttributesDisplayClasses(
2918                    List<String> customAttributesDisplayClasses) {
2919    
2920                    _customAttributesDisplayClasses = customAttributesDisplayClasses;
2921            }
2922    
2923            /**
2924             * Sets the default plugin settings of the portlet.
2925             *
2926             * @param pluginSetting the plugin setting
2927             */
2928            @Override
2929            public void setDefaultPluginSetting(PluginSetting pluginSetting) {
2930                    _defaultPluginSetting = pluginSetting;
2931            }
2932    
2933            /**
2934             * Sets the default preferences of the portlet.
2935             *
2936             * @param defaultPreferences the default preferences of the portlet
2937             */
2938            @Override
2939            public void setDefaultPreferences(String defaultPreferences) {
2940                    _defaultPreferences = defaultPreferences;
2941            }
2942    
2943            /**
2944             * Sets the display name of the portlet.
2945             *
2946             * @param displayName the display name of the portlet
2947             */
2948            @Override
2949            public void setDisplayName(String displayName) {
2950                    _displayName = displayName;
2951            }
2952    
2953            /**
2954             * Sets expiration cache of the portlet.
2955             *
2956             * @param expCache expiration cache of the portlet
2957             */
2958            @Override
2959            public void setExpCache(Integer expCache) {
2960                    _expCache = expCache;
2961            }
2962    
2963            /**
2964             * Sets the Facebook integration method of the portlet.
2965             *
2966             * @param facebookIntegration the Facebook integration method of the portlet
2967             */
2968            @Override
2969            public void setFacebookIntegration(String facebookIntegration) {
2970                    if (Validator.isNotNull(facebookIntegration)) {
2971                            _facebookIntegration = facebookIntegration;
2972                    }
2973            }
2974    
2975            /**
2976             * Sets a list of CSS files that will be referenced from the page's footer
2977             * relative to the portal's context path.
2978             *
2979             * @param footerPortalCss a list of CSS files that will be referenced from
2980             *        the page's footer relative to the portal's context path
2981             */
2982            @Override
2983            public void setFooterPortalCss(List<String> footerPortalCss) {
2984                    _footerPortalCss = footerPortalCss;
2985            }
2986    
2987            /**
2988             * Sets a list of JavaScript files that will be referenced from the page's
2989             * footer relative to the portal's context path.
2990             *
2991             * @param footerPortalJavaScript a list of JavaScript files that will be
2992             *        referenced from the page's footer relative to the portal's context
2993             *        path
2994             */
2995            @Override
2996            public void setFooterPortalJavaScript(List<String> footerPortalJavaScript) {
2997                    _footerPortalJavaScript = footerPortalJavaScript;
2998            }
2999    
3000            /**
3001             * Sets a list of CSS files that will be referenced from the page's footer
3002             * relative to the portlet's context path.
3003             *
3004             * @param footerPortletCss a list of CSS files that will be referenced from
3005             *        the page's footer relative to the portlet's context path
3006             */
3007            @Override
3008            public void setFooterPortletCss(List<String> footerPortletCss) {
3009                    _footerPortletCss = footerPortletCss;
3010            }
3011    
3012            /**
3013             * Sets a list of JavaScript files that will be referenced from the page's
3014             * footer relative to the portlet's context path.
3015             *
3016             * @param footerPortletJavaScript a list of JavaScript files that will be
3017             *        referenced from the page's footer relative to the portlet's
3018             *        context path
3019             */
3020            @Override
3021            public void setFooterPortletJavaScript(
3022                    List<String> footerPortletJavaScript) {
3023    
3024                    _footerPortletJavaScript = footerPortletJavaScript;
3025            }
3026    
3027            /**
3028             * Sets the name of the friendly URL mapper class of the portlet.
3029             *
3030             * @param friendlyURLMapperClass the name of the friendly URL mapper class
3031             *        of the portlet
3032             */
3033            @Override
3034            public void setFriendlyURLMapperClass(String friendlyURLMapperClass) {
3035                    _friendlyURLMapperClass = friendlyURLMapperClass;
3036            }
3037    
3038            /**
3039             * Sets the name of the friendly URL mapping of the portlet.
3040             *
3041             * @param friendlyURLMapping the name of the friendly URL mapping of the
3042             *        portlet
3043             */
3044            @Override
3045            public void setFriendlyURLMapping(String friendlyURLMapping) {
3046                    _friendlyURLMapping = friendlyURLMapping;
3047            }
3048    
3049            /**
3050             * Sets the class loader resource path to the friendly URL routes of the
3051             * portlet.
3052             *
3053             * @param friendlyURLRoutes the class loader resource path to the friendly
3054             *        URL routes of the portlet
3055             */
3056            @Override
3057            public void setFriendlyURLRoutes(String friendlyURLRoutes) {
3058                    _friendlyURLRoutes = friendlyURLRoutes;
3059            }
3060    
3061            /**
3062             * Sets a list of CSS files that will be referenced from the page's header
3063             * relative to the portal's context path.
3064             *
3065             * @param headerPortalCss a list of CSS files that will be referenced from
3066             *        the page's header relative to the portal's context path
3067             */
3068            @Override
3069            public void setHeaderPortalCss(List<String> headerPortalCss) {
3070                    _headerPortalCss = headerPortalCss;
3071            }
3072    
3073            /**
3074             * Sets a list of JavaScript files that will be referenced from the page's
3075             * header relative to the portal's context path.
3076             *
3077             * @param headerPortalJavaScript a list of JavaScript files that will be
3078             *        referenced from the page's header relative to the portal's context
3079             *        path
3080             */
3081            @Override
3082            public void setHeaderPortalJavaScript(List<String> headerPortalJavaScript) {
3083                    _headerPortalJavaScript = headerPortalJavaScript;
3084            }
3085    
3086            /**
3087             * Sets a list of CSS files that will be referenced from the page's header
3088             * relative to the portlet's context path.
3089             *
3090             * @param headerPortletCss a list of CSS files that will be referenced from
3091             *        the page's header relative to the portlet's context path
3092             */
3093            @Override
3094            public void setHeaderPortletCss(List<String> headerPortletCss) {
3095                    _headerPortletCss = headerPortletCss;
3096            }
3097    
3098            /**
3099             * Sets a list of JavaScript files that will be referenced from the page's
3100             * header relative to the portlet's context path.
3101             *
3102             * @param headerPortletJavaScript a list of JavaScript files that will be
3103             *        referenced from the page's header relative to the portlet's
3104             *        context path
3105             */
3106            @Override
3107            public void setHeaderPortletJavaScript(
3108                    List<String> headerPortletJavaScript) {
3109    
3110                    _headerPortletJavaScript = headerPortletJavaScript;
3111            }
3112    
3113            /**
3114             * Sets the icon of the portlet.
3115             *
3116             * @param icon the icon of the portlet
3117             */
3118            @Override
3119            public void setIcon(String icon) {
3120                    _icon = icon;
3121            }
3122    
3123            /**
3124             * Set to <code>true</code> to include the portlet and make it available to
3125             * be made active.
3126             *
3127             * @param include boolean value for whether to include the portlet and make
3128             *        it available to be made active
3129             */
3130            @Override
3131            public void setInclude(boolean include) {
3132                    _include = include;
3133            }
3134    
3135            /**
3136             * Sets the names of the classes that represent indexers associated with the
3137             * portlet.
3138             *
3139             * @param indexerClasses the names of the classes that represent indexers
3140             *        associated with the portlet
3141             */
3142            @Override
3143            public void setIndexerClasses(List<String> indexerClasses) {
3144                    _indexerClasses = indexerClasses;
3145            }
3146    
3147            /**
3148             * Sets the init parameters of the portlet.
3149             *
3150             * @param initParams the init parameters of the portlet
3151             */
3152            @Override
3153            public void setInitParams(Map<String, String> initParams) {
3154                    _initParams = initParams;
3155            }
3156    
3157            /**
3158             * Set to <code>true</code> if the portlet can be added multiple times to a
3159             * layout.
3160             *
3161             * @param instanceable boolean value for whether the portlet can be added
3162             *        multiple times to a layout
3163             */
3164            @Override
3165            public void setInstanceable(boolean instanceable) {
3166                    _instanceable = instanceable;
3167            }
3168    
3169            /**
3170             * Set to <code>true</code> to allow the portlet to be cached within the
3171             * layout.
3172             *
3173             * @param layoutCacheable boolean value for whether the portlet can be
3174             *        cached within the layout
3175             */
3176            @Override
3177            public void setLayoutCacheable(boolean layoutCacheable) {
3178                    _layoutCacheable = layoutCacheable;
3179            }
3180    
3181            /**
3182             * Set to <code>true</code> if the portlet goes into the maximized state
3183             * when the user goes into the edit mode.
3184             *
3185             * @param maximizeEdit boolean value for whether the portlet goes into the
3186             *        maximized state when the user goes into the edit mode
3187             */
3188            @Override
3189            public void setMaximizeEdit(boolean maximizeEdit) {
3190                    _maximizeEdit = maximizeEdit;
3191            }
3192    
3193            /**
3194             * Set to <code>true</code> if the portlet goes into the maximized state
3195             * when the user goes into the help mode.
3196             *
3197             * @param maximizeHelp boolean value for whether the portlet goes into the
3198             *        maximized state when the user goes into the help mode
3199             */
3200            @Override
3201            public void setMaximizeHelp(boolean maximizeHelp) {
3202                    _maximizeHelp = maximizeHelp;
3203            }
3204    
3205            /**
3206             * Sets the name of the open search class of the portlet.
3207             *
3208             * @param openSearchClass the name of the open search class of the portlet
3209             */
3210            @Override
3211            public void setOpenSearchClass(String openSearchClass) {
3212                    _openSearchClass = openSearchClass;
3213            }
3214    
3215            /**
3216             * Sets the parent struts path of the portlet.
3217             *
3218             * @param parentStrutsPath the parent struts path of the portlet
3219             */
3220            @Override
3221            public void setParentStrutsPath(String parentStrutsPath) {
3222                    _parentStrutsPath = parentStrutsPath;
3223            }
3224    
3225            /**
3226             * Sets the name of the permission propagator class of the portlet.
3227             */
3228            @Override
3229            public void setPermissionPropagatorClass(String permissionPropagatorClass) {
3230                    _permissionPropagatorClass = permissionPropagatorClass;
3231            }
3232    
3233            /**
3234             * Sets this portlet's plugin package.
3235             *
3236             * @param pluginPackage this portlet's plugin package
3237             */
3238            @Override
3239            public void setPluginPackage(PluginPackage pluginPackage) {
3240                    _pluginPackage = pluginPackage;
3241            }
3242    
3243            /**
3244             * Sets the name of the poller processor class of the portlet.
3245             *
3246             * @param pollerProcessorClass the name of the poller processor class of the
3247             *        portlet
3248             */
3249            @Override
3250            public void setPollerProcessorClass(String pollerProcessorClass) {
3251                    _pollerProcessorClass = pollerProcessorClass;
3252            }
3253    
3254            /**
3255             * Sets the name of the POP message listener class of the portlet.
3256             *
3257             * @param popMessageListenerClass the name of the POP message listener class
3258             *        of the portlet
3259             */
3260            @Override
3261            public void setPopMessageListenerClass(String popMessageListenerClass) {
3262                    _popMessageListenerClass = popMessageListenerClass;
3263            }
3264    
3265            /**
3266             * Set to <code>true</code> if the portlet goes into the pop up state when
3267             * the user goes into the print mode.
3268             *
3269             * @param popUpPrint boolean value for whether the portlet goes into the pop
3270             *        up state when the user goes into the print mode
3271             */
3272            @Override
3273            public void setPopUpPrint(boolean popUpPrint) {
3274                    _popUpPrint = popUpPrint;
3275            }
3276    
3277            /**
3278             * Sets this portlet's application.
3279             *
3280             * @param portletApp this portlet's application
3281             */
3282            @Override
3283            public void setPortletApp(PortletApp portletApp) {
3284                    _portletApp = portletApp;
3285    
3286                    _portletApp.addPortlet(this);
3287            }
3288    
3289            /**
3290             * Sets the name of the portlet class of the portlet.
3291             *
3292             * @param portletClass the name of the portlet class of the portlet
3293             */
3294            @Override
3295            public void setPortletClass(String portletClass) {
3296                    _portletClass = portletClass;
3297            }
3298    
3299            /**
3300             * Sets the name of the portlet data handler class of the portlet.
3301             *
3302             * @param portletDataHandlerClass the name of portlet data handler class of
3303             *        the portlet
3304             */
3305            @Override
3306            public void setPortletDataHandlerClass(String portletDataHandlerClass) {
3307                    _portletDataHandlerClass = portletDataHandlerClass;
3308            }
3309    
3310            /**
3311             * Sets the filters of the portlet.
3312             *
3313             * @param portletFilters the filters of the portlet
3314             */
3315            @Override
3316            public void setPortletFilters(Map<String, PortletFilter> portletFilters) {
3317                    _portletFilters = portletFilters;
3318            }
3319    
3320            /**
3321             * Sets the portlet info of the portlet.
3322             *
3323             * @param portletInfo the portlet info of the portlet
3324             */
3325            @Override
3326            public void setPortletInfo(PortletInfo portletInfo) {
3327                    _portletInfo = portletInfo;
3328            }
3329    
3330            /**
3331             * Sets the name of the portlet layout listener class of the portlet.
3332             *
3333             * @param portletLayoutListenerClass the name of the portlet layout listener
3334             *        class of the portlet
3335             */
3336            @Override
3337            public void setPortletLayoutListenerClass(
3338                    String portletLayoutListenerClass) {
3339    
3340                    _portletLayoutListenerClass = portletLayoutListenerClass;
3341            }
3342    
3343            /**
3344             * Sets the portlet modes of the portlet.
3345             *
3346             * @param portletModes the portlet modes of the portlet
3347             */
3348            @Override
3349            public void setPortletModes(Map<String, Set<String>> portletModes) {
3350                    _portletModes = portletModes;
3351            }
3352    
3353            /**
3354             * Sets the name of the portlet.
3355             *
3356             * @param portletName the name of the portlet
3357             */
3358            @Override
3359            public void setPortletName(String portletName) {
3360                    _portletName = portletName;
3361            }
3362    
3363            /**
3364             * Sets the name of the portlet URL class of the portlet.
3365             *
3366             * @param portletURLClass the name of the portlet URL class of the portlet
3367             */
3368            @Override
3369            public void setPortletURLClass(String portletURLClass) {
3370                    _portletURLClass = portletURLClass;
3371            }
3372    
3373            /**
3374             * Set to <code>true</code> if preferences are shared across the entire
3375             * company.
3376             *
3377             * @param preferencesCompanyWide boolean value for whether preferences are
3378             *        shared across the entire company
3379             */
3380            @Override
3381            public void setPreferencesCompanyWide(boolean preferencesCompanyWide) {
3382                    _preferencesCompanyWide = preferencesCompanyWide;
3383            }
3384    
3385            /**
3386             * Set to <code>true</code> if preferences are owned by the group when the
3387             * portlet is shown in a group layout. Set to <code>false</code> if
3388             * preferences are owned by the user at all times.
3389             *
3390             * @param preferencesOwnedByGroup boolean value for whether preferences are
3391             *        owned by the group when the portlet is shown in a group layout or
3392             *        preferences are owned by the user at all times
3393             */
3394            @Override
3395            public void setPreferencesOwnedByGroup(boolean preferencesOwnedByGroup) {
3396                    _preferencesOwnedByGroup = preferencesOwnedByGroup;
3397            }
3398    
3399            /**
3400             * Set to <code>true</code> if preferences are unique per layout.
3401             *
3402             * @param preferencesUniquePerLayout boolean value for whether preferences
3403             *        are unique per layout
3404             */
3405            @Override
3406            public void setPreferencesUniquePerLayout(
3407                    boolean preferencesUniquePerLayout) {
3408    
3409                    _preferencesUniquePerLayout = preferencesUniquePerLayout;
3410            }
3411    
3412            /**
3413             * Sets the name of the preferences validator class of the portlet.
3414             *
3415             * @param preferencesValidator the name of the preferences validator class
3416             *        of the portlet
3417             */
3418            @Override
3419            public void setPreferencesValidator(String preferencesValidator) {
3420                    if (preferencesValidator != null) {
3421    
3422                            // Trim this because XDoclet generates preferences validators with
3423                            // extra white spaces
3424    
3425                            _preferencesValidator = preferencesValidator.trim();
3426                    }
3427                    else {
3428                            _preferencesValidator = null;
3429                    }
3430            }
3431    
3432            /**
3433             * Set to <code>true</code> if the portlet does not share request attributes
3434             * with the portal or portlets from another WAR.
3435             *
3436             * @param privateRequestAttributes boolean value for whether the portlet
3437             *        shares request attributes with the portal or portlets from another
3438             *        WAR
3439             */
3440            @Override
3441            public void setPrivateRequestAttributes(boolean privateRequestAttributes) {
3442                    _privateRequestAttributes = privateRequestAttributes;
3443            }
3444    
3445            /**
3446             * Set to <code>true</code> if the portlet does not share session attributes
3447             * with the portal.
3448             *
3449             * @param privateSessionAttributes boolean value for whether the portlet
3450             *        shares session attributes with the portal
3451             */
3452            @Override
3453            public void setPrivateSessionAttributes(boolean privateSessionAttributes) {
3454                    _privateSessionAttributes = privateSessionAttributes;
3455            }
3456    
3457            /**
3458             * Sets the processing events of the portlet.
3459             *
3460             * @param processingEvents the processing events of the portlet
3461             */
3462            @Override
3463            public void setProcessingEvents(Set<QName> processingEvents) {
3464                    for (QName processingEvent : processingEvents) {
3465                            addProcessingEvent(processingEvent);
3466                    }
3467            }
3468    
3469            /**
3470             * Sets the public render parameters of the portlet.
3471             *
3472             * @param publicRenderParameters the public render parameters of the portlet
3473             */
3474            @Override
3475            public void setPublicRenderParameters(
3476                    Set<PublicRenderParameter> publicRenderParameters) {
3477    
3478                    for (PublicRenderParameter publicRenderParameter :
3479                                    publicRenderParameters) {
3480    
3481                            addPublicRenderParameter(publicRenderParameter);
3482                    }
3483            }
3484    
3485            /**
3486             * Sets the publishing events of the portlet.
3487             *
3488             * @param publishingEvents the publishing events of the portlet
3489             */
3490            @Override
3491            public void setPublishingEvents(Set<QName> publishingEvents) {
3492                    for (QName publishingEvent : publishingEvents) {
3493                            addPublishingEvent(publishingEvent);
3494                    }
3495            }
3496    
3497            /**
3498             * Set to <code>true</code> if the portlet is ready to be used.
3499             *
3500             * @param ready whether the portlet is ready to be used
3501             */
3502            @Override
3503            public void setReady(boolean ready) {
3504                    _readyMap.put(getRootPortletId(), ready);
3505    
3506                    Registry registry = RegistryUtil.getRegistry();
3507    
3508                    synchronized (_serviceRegistrars) {
3509                            if (ready) {
3510                                    ServiceRegistrar<Portlet> serviceRegistrar =
3511                                            registry.getServiceRegistrar(Portlet.class);
3512    
3513                                    Map<String, Object> properties = new HashMap<>();
3514    
3515                                    properties.put("javax.portlet.name", getPortletName());
3516    
3517                                    serviceRegistrar.registerService(
3518                                            Portlet.class, this, properties);
3519    
3520                                    _serviceRegistrars.put(getRootPortletId(), serviceRegistrar);
3521                            }
3522                            else {
3523                                    ServiceRegistrar<Portlet> serviceRegistrar =
3524                                            _serviceRegistrars.remove(getRootPortletId());
3525    
3526                                    serviceRegistrar.destroy();
3527                            }
3528                    }
3529            }
3530    
3531            /**
3532             * Set to <code>true</code> if the portlet supports remoting
3533             *
3534             * @param remoteable boolean value for whether or not the the portlet
3535             *        supports remoting
3536             */
3537            @Override
3538            public void setRemoteable(boolean remoteable) {
3539                    _remoteable = remoteable;
3540            }
3541    
3542            /**
3543             * Sets the render timeout of the portlet.
3544             *
3545             * @param renderTimeout the render timeout of the portlet
3546             */
3547            @Override
3548            public void setRenderTimeout(int renderTimeout) {
3549                    _renderTimeout = renderTimeout;
3550            }
3551    
3552            /**
3553             * Sets the render weight of the portlet.
3554             *
3555             * @param renderWeight int value for the render weight of the portlet
3556             */
3557            @Override
3558            public void setRenderWeight(int renderWeight) {
3559                    _renderWeight = renderWeight;
3560            }
3561    
3562            /**
3563             * Set to <code>true</code> if the portlet will only process namespaced
3564             * parameters.
3565             *
3566             * @param requiresNamespacedParameters boolean value for whether the portlet
3567             *        will only process namespaced parameters
3568             */
3569            @Override
3570            public void setRequiresNamespacedParameters(
3571                    boolean requiresNamespacedParameters) {
3572    
3573                    _requiresNamespacedParameters = requiresNamespacedParameters;
3574            }
3575    
3576            /**
3577             * Sets the resource bundle of the portlet.
3578             *
3579             * @param resourceBundle the resource bundle of the portlet
3580             */
3581            @Override
3582            public void setResourceBundle(String resourceBundle) {
3583                    _resourceBundle = resourceBundle;
3584            }
3585    
3586            /**
3587             * Set to <code>true</code> if the portlet restores to the current view from
3588             * the maximized state.
3589             *
3590             * @param restoreCurrentView boolean value for whether the portlet restores
3591             *        to the current view from the maximized state
3592             */
3593            @Override
3594            public void setRestoreCurrentView(boolean restoreCurrentView) {
3595                    _restoreCurrentView = restoreCurrentView;
3596            }
3597    
3598            /**
3599             * Sets the role mappers of the portlet.
3600             *
3601             * @param roleMappers the role mappers of the portlet
3602             */
3603            @Override
3604            public void setRoleMappers(Map<String, String> roleMappers) {
3605                    _roleMappers = roleMappers;
3606            }
3607    
3608            /**
3609             * Sets a string of ordered comma delimited portlet IDs.
3610             *
3611             * @param roles a string of ordered comma delimited portlet IDs
3612             */
3613            @Override
3614            public void setRoles(String roles) {
3615                    _rolesArray = StringUtil.split(roles);
3616    
3617                    super.setRoles(roles);
3618            }
3619    
3620            /**
3621             * Sets an array of required roles of the portlet.
3622             *
3623             * @param rolesArray an array of required roles of the portlet
3624             */
3625            @Override
3626            public void setRolesArray(String[] rolesArray) {
3627                    _rolesArray = rolesArray;
3628    
3629                    super.setRoles(StringUtil.merge(rolesArray));
3630            }
3631    
3632            /**
3633             * Sets the scheduler entries of the portlet.
3634             *
3635             * @param schedulerEntries the scheduler entries of the portlet
3636             */
3637            @Override
3638            public void setSchedulerEntries(List<SchedulerEntry> schedulerEntries) {
3639                    for (SchedulerEntry schedulerEntry : schedulerEntries) {
3640                            addSchedulerEntry(schedulerEntry);
3641                    }
3642            }
3643    
3644            /**
3645             * Set to <code>true</code> if the portlet supports scoping of data.
3646             *
3647             * @param scopeable boolean value for whether or not the the portlet
3648             *        supports scoping of data
3649             */
3650            @Override
3651            public void setScopeable(boolean scopeable) {
3652                    _scopeable = scopeable;
3653            }
3654    
3655            /**
3656             * Set to <code>true</code> if users are shown that they do not have access
3657             * to the portlet.
3658             *
3659             * @param showPortletAccessDenied boolean value for whether users are shown
3660             *        that they do not have access to the portlet
3661             */
3662            @Override
3663            public void setShowPortletAccessDenied(boolean showPortletAccessDenied) {
3664                    _showPortletAccessDenied = showPortletAccessDenied;
3665            }
3666    
3667            /**
3668             * Set to <code>true</code> if users are shown that the portlet is inactive.
3669             *
3670             * @param showPortletInactive boolean value for whether users are shown that
3671             *        the portlet is inactive
3672             */
3673            @Override
3674            public void setShowPortletInactive(boolean showPortletInactive) {
3675                    _showPortletInactive = showPortletInactive;
3676            }
3677    
3678            /**
3679             * Set to <code>true</code> if the portlet uses Single Page Application.
3680             *
3681             * @param singlePageApplication boolean value for whether or not the the
3682             *        portlet uses Single Page Application
3683             */
3684            @Override
3685            public void setSinglePageApplication(boolean singlePageApplication) {
3686                    _singlePageApplication = singlePageApplication;
3687            }
3688    
3689            /**
3690             * Sets the names of the classes that represent social activity interpreters
3691             * associated with the portlet.
3692             *
3693             * @param socialActivityInterpreterClasses the names of the classes that
3694             *        represent social activity interpreters associated with the portlet
3695             */
3696            @Override
3697            public void setSocialActivityInterpreterClasses(
3698                    List<String> socialActivityInterpreterClasses) {
3699    
3700                    _socialActivityInterpreterClasses = socialActivityInterpreterClasses;
3701            }
3702    
3703            /**
3704             * Sets the name of the social request interpreter class of the portlet.
3705             *
3706             * @param socialRequestInterpreterClass the name of the request interpreter
3707             *        class of the portlet
3708             */
3709            @Override
3710            public void setSocialRequestInterpreterClass(
3711                    String socialRequestInterpreterClass) {
3712    
3713                    _socialRequestInterpreterClass = socialRequestInterpreterClass;
3714            }
3715    
3716            /**
3717             * Returns the names of the classes that represent staged model data handlers associated with the portlet.
3718             *
3719             * @return the names of the classes that represent staged model data handlers associated with the portlet
3720             */
3721    
3722            /**
3723             * Sets the names of the classes that represent staged model data handlers
3724             * associated with the portlet.
3725             *
3726             * @param stagedModelDataHandlerClasses the names of the classes that
3727             *        represent staged model data handlers associated with the portlet
3728             */
3729            @Override
3730            public void setStagedModelDataHandlerClasses(
3731                    List<String> stagedModelDataHandlerClasses) {
3732    
3733                    _stagedModelDataHandlerClasses = stagedModelDataHandlerClasses;
3734            }
3735    
3736            /**
3737             * Set to <code>true</code> if the portlet is a static portlet that is
3738             * cannot be moved.
3739             *
3740             * @param staticPortlet boolean value for whether the portlet is a static
3741             *        portlet that cannot be moved
3742             */
3743            @Override
3744            public void setStatic(boolean staticPortlet) {
3745                    _staticPortlet = staticPortlet;
3746            }
3747    
3748            /**
3749             * Set to <code>true</code> if the portlet is a static portlet at the start
3750             * of a list of portlets.
3751             *
3752             * @param staticPortletStart boolean value for whether the portlet is a
3753             *        static portlet at the start of a list of portlets
3754             */
3755            @Override
3756            public void setStaticStart(boolean staticPortletStart) {
3757                    _staticPortletStart = staticPortletStart;
3758            }
3759    
3760            /**
3761             * Sets the struts path of the portlet.
3762             *
3763             * @param strutsPath the struts path of the portlet
3764             */
3765            @Override
3766            public void setStrutsPath(String strutsPath) {
3767                    _strutsPath = strutsPath;
3768            }
3769    
3770            /**
3771             * Sets the supported locales of the portlet.
3772             *
3773             * @param supportedLocales the supported locales of the portlet
3774             */
3775            @Override
3776            public void setSupportedLocales(Set<String> supportedLocales) {
3777                    _supportedLocales = supportedLocales;
3778            }
3779    
3780            /**
3781             * Set to <code>true</code> if the portlet is a system portlet that a user
3782             * cannot manually add to their page.
3783             *
3784             * @param system boolean value for whether the portlet is a system portlet
3785             *        that a user cannot manually add to their page
3786             */
3787            @Override
3788            public void setSystem(boolean system) {
3789                    _system = system;
3790            }
3791    
3792            /**
3793             * Sets the name of the template handler class of the portlet.
3794             *
3795             * @param templateHandlerClass the name of template handler class of the
3796             *        portlet
3797             */
3798            @Override
3799            public void setTemplateHandlerClass(String templateHandlerClass) {
3800                    _templateHandlerClass = templateHandlerClass;
3801            }
3802    
3803            /**
3804             * Sets the names of the classes that represent trash handlers associated to
3805             * the portlet.
3806             *
3807             * @param trashHandlerClasses the names of the classes that represent trash
3808             *        handlers associated with the portlet
3809             */
3810            @Override
3811            public void setTrashHandlerClasses(List<String> trashHandlerClasses) {
3812                    _trashHandlerClasses = trashHandlerClasses;
3813            }
3814    
3815            /**
3816             * Set to <code>true</code> if the portlet is an undeployed portlet.
3817             *
3818             * @param undeployedPortlet boolean value for whether the portlet is an
3819             *        undeployed portlet
3820             */
3821            @Override
3822            public void setUndeployedPortlet(boolean undeployedPortlet) {
3823                    _undeployedPortlet = undeployedPortlet;
3824            }
3825    
3826            /**
3827             * Sets the unlinked roles of the portlet.
3828             *
3829             * @param unlinkedRoles the unlinked roles of the portlet
3830             */
3831            @Override
3832            public void setUnlinkedRoles(Set<String> unlinkedRoles) {
3833                    _unlinkedRoles = unlinkedRoles;
3834            }
3835    
3836            /**
3837             * Sets the name of the URL encoder class of the portlet.
3838             *
3839             * @param urlEncoderClass the name of the URL encoder class of the portlet
3840             */
3841            @Override
3842            public void setURLEncoderClass(String urlEncoderClass) {
3843                    _urlEncoderClass = urlEncoderClass;
3844            }
3845    
3846            /**
3847             * Set to <code>true</code> if the portlet uses the default template.
3848             *
3849             * @param useDefaultTemplate boolean value for whether the portlet uses the
3850             *        default template
3851             */
3852            @Override
3853            public void setUseDefaultTemplate(boolean useDefaultTemplate) {
3854                    _useDefaultTemplate = useDefaultTemplate;
3855            }
3856    
3857            /**
3858             * Sets the class loader resource path to the user notification definitions
3859             * of the portlet.
3860             *
3861             * @param userNotificationDefinitions the class loader resource path to the
3862             *        user notification definitions of the portlet
3863             */
3864            @Override
3865            public void setUserNotificationDefinitions(
3866                    String userNotificationDefinitions) {
3867    
3868                    _userNotificationDefinitions = userNotificationDefinitions;
3869            }
3870    
3871            /**
3872             * Sets the names of the classes that represent user notification handlers
3873             * associated with the portlet.
3874             *
3875             * @param userNotificationHandlerClasses the names of the classes that
3876             *        represent user notification handlers associated with the portlet
3877             */
3878            @Override
3879            public void setUserNotificationHandlerClasses(
3880                    List<String> userNotificationHandlerClasses) {
3881    
3882                    _userNotificationHandlerClasses = userNotificationHandlerClasses;
3883            }
3884    
3885            /**
3886             * Sets the user principal strategy of the portlet.
3887             *
3888             * @param userPrincipalStrategy the user principal strategy of the portlet
3889             */
3890            @Override
3891            public void setUserPrincipalStrategy(String userPrincipalStrategy) {
3892                    if (Validator.isNotNull(userPrincipalStrategy)) {
3893                            _userPrincipalStrategy = userPrincipalStrategy;
3894                    }
3895            }
3896    
3897            /**
3898             * Sets the virtual path of the portlet.
3899             *
3900             * @param virtualPath the virtual path of the portlet
3901             */
3902            @Override
3903            public void setVirtualPath(String virtualPath) {
3904                    if (_portletApp.isWARFile() && Validator.isNull(virtualPath)) {
3905                            virtualPath = PropsValues.PORTLET_VIRTUAL_PATH;
3906                    }
3907    
3908                    _virtualPath = virtualPath;
3909            }
3910    
3911            /**
3912             * Sets the name of the WebDAV storage class of the portlet.
3913             *
3914             * @param webDAVStorageClass the name of the WebDAV storage class of the
3915             *        portlet
3916             */
3917            @Override
3918            public void setWebDAVStorageClass(String webDAVStorageClass) {
3919                    _webDAVStorageClass = webDAVStorageClass;
3920            }
3921    
3922            /**
3923             * Sets the name of the WebDAV storage token of the portlet.
3924             *
3925             * @param webDAVStorageToken the name of the WebDAV storage token of the
3926             *        portlet
3927             */
3928            @Override
3929            public void setWebDAVStorageToken(String webDAVStorageToken) {
3930                    _webDAVStorageToken = webDAVStorageToken;
3931            }
3932    
3933            /**
3934             * Sets the window states of the portlet.
3935             *
3936             * @param windowStates the window states of the portlet
3937             */
3938            @Override
3939            public void setWindowStates(Map<String, Set<String>> windowStates) {
3940                    _windowStates = windowStates;
3941            }
3942    
3943            /**
3944             * Sets the names of the classes that represent workflow handlers associated
3945             * to the portlet.
3946             *
3947             * @param workflowHandlerClasses the names of the classes that represent
3948             *        workflow handlers associated with the portlet
3949             */
3950            @Override
3951            public void setWorkflowHandlerClasses(List<String> workflowHandlerClasses) {
3952                    _workflowHandlerClasses = workflowHandlerClasses;
3953            }
3954    
3955            /**
3956             * Sets the name of the XML-RPC method class of the portlet.
3957             *
3958             * @param xmlRpcMethodClass the name of the XML-RPC method class of the
3959             *        portlet
3960             */
3961            @Override
3962            public void setXmlRpcMethodClass(String xmlRpcMethodClass) {
3963                    _xmlRpcMethodClass = xmlRpcMethodClass;
3964            }
3965    
3966            @Override
3967            public void unsetReady() {
3968                    _readyMap.remove(getRootPortletId());
3969    
3970                    synchronized (_serviceRegistrars) {
3971                            ServiceRegistrar<Portlet> serviceRegistrar =
3972                                    _serviceRegistrars.remove(getRootPortletId());
3973    
3974                            serviceRegistrar.destroy();
3975                    }
3976            }
3977    
3978            /**
3979             * Log instance for this class.
3980             */
3981            private static final Log _log = LogFactoryUtil.getLog(PortletImpl.class);
3982    
3983            /**
3984             * Map of the ready states of all portlets keyed by their root portlet ID.
3985             */
3986            private static final Map<String, Boolean> _readyMap =
3987                    new ConcurrentHashMap<>();
3988    
3989            private static final Map<String, ServiceRegistrar<Portlet>>
3990                    _serviceRegistrars = new HashMap<>();
3991    
3992            /**
3993             * The action timeout of the portlet.
3994             */
3995            private int _actionTimeout;
3996    
3997            /**
3998             * <code>True</code> if an action URL for this portlet should cause an auto
3999             * redirect.
4000             */
4001            private boolean _actionURLRedirect;
4002    
4003            /**
4004             * <code>True</code> if default resources for the portlet are added to a
4005             * page.
4006             */
4007            private boolean _addDefaultResource;
4008    
4009            /**
4010             * <code>True</code> if the portlet can be displayed via Ajax.
4011             */
4012            private boolean _ajaxable = true;
4013    
4014            /**
4015             * The application types of the portlet.
4016             */
4017            private final Set<ApplicationType> _applicationTypes = new HashSet<>();
4018    
4019            /**
4020             * The names of the classes that represents asset types associated with the
4021             * portlet.
4022             */
4023            private List<String> _assetRendererFactoryClasses;
4024    
4025            /**
4026             * The names of the classes that represents atom collection adapters
4027             * associated with the portlet.
4028             */
4029            private List<String> _atomCollectionAdapterClasses;
4030    
4031            /**
4032             * The names of the parameters that will be automatically propagated through
4033             * the portlet.
4034             */
4035            private Set<String> _autopropagatedParameters;
4036    
4037            /**
4038             * The configuration action class of the portlet.
4039             */
4040            private String _configurationActionClass;
4041    
4042            /**
4043             * The name of the category of the Control Panel where this portlet will be
4044             * shown.
4045             */
4046            private String _controlPanelEntryCategory = StringPool.BLANK;
4047    
4048            /**
4049             * The name of the class that will control when this portlet will be shown
4050             * in the Control Panel.
4051             */
4052            private String _controlPanelEntryClass;
4053    
4054            /**
4055             * The relative weight of this portlet with respect to the other portlets in
4056             * the same category of the Control Panel.
4057             */
4058            private double _controlPanelEntryWeight = 100;
4059    
4060            /**
4061             * The name of the CSS class that will be injected in the DIV that wraps
4062             * this portlet.
4063             */
4064            private String _cssClassWrapper = StringPool.BLANK;
4065    
4066            /**
4067             * The names of the classes that represents custom attribute displays
4068             * associated with the portlet.
4069             */
4070            private List<String> _customAttributesDisplayClasses;
4071    
4072            /**
4073             * Plugin settings associated with the portlet.
4074             */
4075            private PluginSetting _defaultPluginSetting;
4076    
4077            /**
4078             * The default preferences of the portlet.
4079             */
4080            private String _defaultPreferences;
4081    
4082            /**
4083             * The display name of the portlet.
4084             */
4085            private String _displayName;
4086    
4087            /**
4088             * The expiration cache of the portlet.
4089             */
4090            private Integer _expCache;
4091    
4092            /**
4093             * The Facebook integration method of the portlet.
4094             */
4095            private String _facebookIntegration =
4096                    PortletConstants.FACEBOOK_INTEGRATION_IFRAME;
4097    
4098            /**
4099             * A list of CSS files that will be referenced from the page's footer
4100             * relative to the portal's context path.
4101             */
4102            private List<String> _footerPortalCss;
4103    
4104            /**
4105             * A list of JavaScript files that will be referenced from the page's footer
4106             * relative to the portal's context path.
4107             */
4108            private List<String> _footerPortalJavaScript;
4109    
4110            /**
4111             * A list of CSS files that will be referenced from the page's footer
4112             * relative to the portlet's context path.
4113             */
4114            private List<String> _footerPortletCss;
4115    
4116            /**
4117             * A list of JavaScript files that will be referenced from the page's footer
4118             * relative to the portlet's context path.
4119             */
4120            private List<String> _footerPortletJavaScript;
4121    
4122            /**
4123             * The name of the friendly URL mapper class of the portlet.
4124             */
4125            private String _friendlyURLMapperClass;
4126    
4127            /**
4128             * The name of the friendly URL mapping of the portlet.
4129             */
4130            private String _friendlyURLMapping;
4131    
4132            /**
4133             * The the class loader resource path to the friendly URL routes of the
4134             * portlet.
4135             */
4136            private String _friendlyURLRoutes;
4137    
4138            /**
4139             * A list of CSS files that will be referenced from the page's header
4140             * relative to the portal's context path.
4141             */
4142            private List<String> _headerPortalCss;
4143    
4144            /**
4145             * A list of JavaScript files that will be referenced from the page's header
4146             * relative to the portal's context path.
4147             */
4148            private List<String> _headerPortalJavaScript;
4149    
4150            /**
4151             * A list of CSS files that will be referenced from the page's header
4152             * relative to the portlet's context path.
4153             */
4154            private List<String> _headerPortletCss;
4155    
4156            /**
4157             * A list of JavaScript files that will be referenced from the page's header
4158             * relative to the portlet's context path.
4159             */
4160            private List<String> _headerPortletJavaScript;
4161    
4162            /**
4163             * The icon of the portlet.
4164             */
4165            private String _icon;
4166    
4167            /**
4168             * <code>True</code> to include the portlet and make it available to be made
4169             * active.
4170             */
4171            private boolean _include = true;
4172    
4173            /**
4174             * The names of the classes that represent indexers associated with the
4175             * portlet.
4176             */
4177            private List<String> _indexerClasses;
4178    
4179            /**
4180             * The init parameters of the portlet.
4181             */
4182            private Map<String, String> _initParams;
4183    
4184            /**
4185             * <code>True</code> if the portlet can be added multiple times to a layout.
4186             */
4187            private boolean _instanceable;
4188    
4189            /**
4190             * <code>True</code> if the portlet can be cached within the layout.
4191             */
4192            private boolean _layoutCacheable;
4193    
4194            /**
4195             * <code>True</code> if the portlet goes into the maximized state when the
4196             * user goes into the edit mode.
4197             */
4198            private boolean _maximizeEdit;
4199    
4200            /**
4201             * <code>True</code> if the portlet goes into the maximized state when the
4202             * user goes into the help mode.
4203             */
4204            private boolean _maximizeHelp;
4205    
4206            /**
4207             * The name of the open search class of the portlet.
4208             */
4209            private String _openSearchClass;
4210    
4211            /**
4212             * The parent struts path of the portlet.
4213             */
4214            private String _parentStrutsPath;
4215    
4216            /**
4217             * The name of the permission propagator class of the portlet.
4218             */
4219            private String _permissionPropagatorClass;
4220    
4221            /**
4222             * Package to which this plugin belongs.
4223             */
4224            private PluginPackage _pluginPackage;
4225    
4226            /**
4227             * The name of the poller processor class of the portlet.
4228             */
4229            private String _pollerProcessorClass;
4230    
4231            /**
4232             * The name of the POP message listener class of the portlet.
4233             */
4234            private String _popMessageListenerClass;
4235    
4236            /**
4237             * <code>True</code> if the portlet goes into the pop up state when the user
4238             * goes into the print mode.
4239             */
4240            private boolean _popUpPrint = true;
4241    
4242            /**
4243             * The application to which this portlet belongs.
4244             */
4245            private PortletApp _portletApp;
4246    
4247            /**
4248             * The name of the portlet class of the portlet.
4249             */
4250            private String _portletClass;
4251    
4252            /**
4253             * The name of the portlet data handler class of the portlet.
4254             */
4255            private String _portletDataHandlerClass;
4256    
4257            /**
4258             * The filters of the portlet.
4259             */
4260            private Map<String, PortletFilter> _portletFilters;
4261    
4262            /**
4263             * The portlet info of the portlet.
4264             */
4265            private PortletInfo _portletInfo;
4266    
4267            /**
4268             * The name of the portlet data layout listener class of the portlet.
4269             */
4270            private String _portletLayoutListenerClass;
4271    
4272            /**
4273             * The portlet modes of the portlet.
4274             */
4275            private Map<String, Set<String>> _portletModes;
4276    
4277            /**
4278             * The name of the portlet.
4279             */
4280            private String _portletName;
4281    
4282            /**
4283             * The name of the portlet URL class of the portlet.
4284             */
4285            private String _portletURLClass;
4286    
4287            /**
4288             * <code>True</code> if preferences are shared across the entire company.
4289             */
4290            private boolean _preferencesCompanyWide;
4291    
4292            /**
4293             * <code>True</code> if preferences are owned by the group when the portlet
4294             * is shown in a group layout. <code>False</code> if preferences are owned
4295             * by the user at all times.
4296             */
4297            private boolean _preferencesOwnedByGroup = true;
4298    
4299            /**
4300             * <code>True</code> if preferences are unique per layout.
4301             */
4302            private boolean _preferencesUniquePerLayout = true;
4303    
4304            /**
4305             * The name of the preferences validator class of the portlet.
4306             */
4307            private String _preferencesValidator;
4308    
4309            /**
4310             * <code>True</code> if the portlet does not share request attributes with
4311             * the portal or portlets from another WAR.
4312             */
4313            private boolean _privateRequestAttributes = true;
4314    
4315            /**
4316             * <code>True</code> if the portlet does not share session attributes with
4317             * the portal.
4318             */
4319            private boolean _privateSessionAttributes = true;
4320    
4321            /**
4322             * The processing events of the portlet.
4323             */
4324            private final Set<QName> _processingEvents = new HashSet<>();
4325    
4326            /**
4327             * Map of the processing events of the portlet keyed by the QName.
4328             */
4329            private final Map<String, QName> _processingEventsByQName = new HashMap<>();
4330    
4331            /**
4332             * The public render parameters of the portlet.
4333             */
4334            private final Set<PublicRenderParameter> _publicRenderParameters =
4335                    new HashSet<>();
4336    
4337            /**
4338             * Map of the public render parameters of the portlet keyed by the
4339             * identifier.
4340             */
4341            private final Map<String, PublicRenderParameter>
4342                    _publicRenderParametersByIdentifier = new HashMap<>();
4343    
4344            /**
4345             * Map of the public render parameters of the portlet keyed by the QName.
4346             */
4347            private final Map<String, PublicRenderParameter>
4348                    _publicRenderParametersByQName = new HashMap<>();
4349    
4350            /**
4351             * The publishing events of the portlet.
4352             */
4353            private final Set<QName> _publishingEvents = new HashSet<>();
4354    
4355            /**
4356             * <code>True</code> if the portlet supports remoting.
4357             */
4358            private boolean _remoteable;
4359    
4360            /**
4361             * The render timeout of the portlet.
4362             */
4363            private int _renderTimeout;
4364    
4365            /**
4366             * Render weight of the portlet.
4367             */
4368            private int _renderWeight = 1;
4369    
4370            /**
4371             * <code>True</code> if the portlet will only process namespaced parameters.
4372             */
4373            private boolean _requiresNamespacedParameters = true;
4374    
4375            /**
4376             * The resource bundle of the portlet.
4377             */
4378            private String _resourceBundle;
4379    
4380            /**
4381             * <code>True</code> if the portlet restores to the current view from the
4382             * maximized state.
4383             */
4384            private boolean _restoreCurrentView = true;
4385    
4386            /**
4387             * The role mappers of the portlet.
4388             */
4389            private Map<String, String> _roleMappers;
4390    
4391            /**
4392             * An array of required roles of the portlet.
4393             */
4394            private String[] _rolesArray = new String[0];
4395    
4396            /**
4397             * The root portlet of this portlet instance.
4398             */
4399            private final Portlet _rootPortlet;
4400    
4401            /**
4402             * The scheduler entries of the portlet.
4403             */
4404            private final List<SchedulerEntry> _schedulerEntries;
4405    
4406            /**
4407             * <code>True</code> if the portlet supports scoping of data.
4408             */
4409            private boolean _scopeable;
4410    
4411            /**
4412             * <code>True</code> if users are shown that they do not have access to the
4413             * portlet.
4414             */
4415            private boolean _showPortletAccessDenied =
4416                    PropsValues.LAYOUT_SHOW_PORTLET_ACCESS_DENIED;
4417    
4418            /**
4419             * <code>True</code> if users are shown that the portlet is inactive.
4420             */
4421            private boolean _showPortletInactive =
4422                    PropsValues.LAYOUT_SHOW_PORTLET_INACTIVE;
4423    
4424            /**
4425             * <code>True</code> if the portlet uses Single Page Application.
4426             */
4427            private boolean _singlePageApplication = true;
4428    
4429            /**
4430             * The names of the classes that represents social activity interpreters
4431             * associated with the portlet.
4432             */
4433            private List<String> _socialActivityInterpreterClasses;
4434    
4435            /**
4436             * The name of the social request interpreter class of the portlet.
4437             */
4438            private String _socialRequestInterpreterClass;
4439    
4440            /**
4441             * The names of the classes that represent staged model data handlers
4442             * associated with the portlet.
4443             */
4444            private List<String> _stagedModelDataHandlerClasses;
4445    
4446            /**
4447             * <code>True</code> if the portlet is a static portlet that is cannot be
4448             * moved.
4449             */
4450            private boolean _staticPortlet;
4451    
4452            /**
4453             * <code>True</code> if the portlet is a static portlet at the start of a
4454             * list of portlets.
4455             */
4456            private boolean _staticPortletStart;
4457    
4458            /**
4459             * The struts path of the portlet.
4460             */
4461            private String _strutsPath;
4462    
4463            /**
4464             * The supported locales of the portlet.
4465             */
4466            private Set<String> _supportedLocales;
4467    
4468            /**
4469             * <code>True</code> if the portlet is a system portlet that a user cannot
4470             * manually add to their page.
4471             */
4472            private boolean _system;
4473    
4474            /**
4475             * The name of the display style handler class of the portlet.
4476             */
4477            private String _templateHandlerClass;
4478    
4479            /**
4480             * The timestamp of the portlet.
4481             */
4482            private Long _timestamp;
4483    
4484            /**
4485             * The names of the classes that represents trash handlers associated with
4486             * the portlet.
4487             */
4488            private List<String> _trashHandlerClasses;
4489    
4490            /**
4491             * <code>True</code> if the portlet is an undeployed portlet.
4492             */
4493            private boolean _undeployedPortlet;
4494    
4495            /**
4496             * The unlinked roles of the portlet.
4497             */
4498            private Set<String> _unlinkedRoles;
4499    
4500            /**
4501             * The name of the URL encoder class of the portlet.
4502             */
4503            private String _urlEncoderClass;
4504    
4505            /**
4506             * <code>True</code> if the portlet uses the default template.
4507             */
4508            private boolean _useDefaultTemplate = true;
4509    
4510            /**
4511             * The the class loader resource path to the user notification definitions
4512             * of the portlet.
4513             */
4514            private String _userNotificationDefinitions;
4515    
4516            /**
4517             * The names of the classes that represents user notification handlers
4518             * associated with the portlet.
4519             */
4520            private List<String> _userNotificationHandlerClasses;
4521    
4522            /**
4523             * The user principal strategy of the portlet.
4524             */
4525            private String _userPrincipalStrategy =
4526                    PortletConstants.USER_PRINCIPAL_STRATEGY_USER_ID;
4527    
4528            /**
4529             * The virtual path of the portlet.
4530             */
4531            private String _virtualPath;
4532    
4533            /**
4534             * The name of the WebDAV storage class of the portlet.
4535             */
4536            private String _webDAVStorageClass;
4537    
4538            /**
4539             * The name of the WebDAV storage token of the portlet.
4540             */
4541            private String _webDAVStorageToken;
4542    
4543            /**
4544             * The window states of the portlet.
4545             */
4546            private Map<String, Set<String>> _windowStates;
4547    
4548            /**
4549             * The names of the classes that represents workflow handlers associated
4550             * with the portlet.
4551             */
4552            private List<String> _workflowHandlerClasses;
4553    
4554            /**
4555             * The name of the XML-RPC method class of the portlet.
4556             */
4557            private String _xmlRpcMethodClass;
4558    
4559    }