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