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