001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.model.impl;
016    
017    import com.liferay.asset.kernel.model.AssetRendererFactory;
018    import com.liferay.expando.kernel.model.CustomAttributesDisplay;
019    import com.liferay.exportimport.kernel.lar.PortletDataHandler;
020    import com.liferay.exportimport.kernel.lar.StagedModelDataHandler;
021    import com.liferay.portal.kernel.application.type.ApplicationType;
022    import com.liferay.portal.kernel.atom.AtomCollectionAdapter;
023    import com.liferay.portal.kernel.log.Log;
024    import com.liferay.portal.kernel.log.LogFactoryUtil;
025    import com.liferay.portal.kernel.model.Plugin;
026    import com.liferay.portal.kernel.model.PluginSetting;
027    import com.liferay.portal.kernel.model.Portlet;
028    import com.liferay.portal.kernel.model.PortletApp;
029    import com.liferay.portal.kernel.model.PortletConstants;
030    import com.liferay.portal.kernel.model.PortletFilter;
031    import com.liferay.portal.kernel.model.PortletInfo;
032    import com.liferay.portal.kernel.model.PublicRenderParameter;
033    import com.liferay.portal.kernel.model.User;
034    import com.liferay.portal.kernel.notifications.UserNotificationHandler;
035    import com.liferay.portal.kernel.plugin.PluginPackage;
036    import com.liferay.portal.kernel.poller.PollerProcessor;
037    import com.liferay.portal.kernel.pop.MessageListener;
038    import com.liferay.portal.kernel.portlet.ConfigurationAction;
039    import com.liferay.portal.kernel.portlet.ControlPanelEntry;
040    import com.liferay.portal.kernel.portlet.FriendlyURLMapper;
041    import com.liferay.portal.kernel.portlet.FriendlyURLMapperTracker;
042    import com.liferay.portal.kernel.portlet.PortletBag;
043    import com.liferay.portal.kernel.portlet.PortletBagPool;
044    import com.liferay.portal.kernel.portlet.PortletLayoutListener;
045    import com.liferay.portal.kernel.portlet.PortletQNameUtil;
046    import com.liferay.portal.kernel.scheduler.SchedulerEntry;
047    import com.liferay.portal.kernel.search.Indexer;
048    import com.liferay.portal.kernel.search.OpenSearch;
049    import com.liferay.portal.kernel.security.permission.ActionKeys;
050    import com.liferay.portal.kernel.security.permission.PermissionChecker;
051    import com.liferay.portal.kernel.security.permission.PermissionCheckerFactoryUtil;
052    import com.liferay.portal.kernel.security.permission.PermissionPropagator;
053    import com.liferay.portal.kernel.security.permission.PermissionThreadLocal;
054    import com.liferay.portal.kernel.service.UserLocalServiceUtil;
055    import com.liferay.portal.kernel.service.permission.PortletPermissionUtil;
056    import com.liferay.portal.kernel.servlet.ServletContextUtil;
057    import com.liferay.portal.kernel.servlet.URLEncoder;
058    import com.liferay.portal.kernel.template.TemplateHandler;
059    import com.liferay.portal.kernel.trash.TrashHandler;
060    import com.liferay.portal.kernel.util.ArrayUtil;
061    import com.liferay.portal.kernel.util.ContentTypes;
062    import com.liferay.portal.kernel.util.PortalUtil;
063    import com.liferay.portal.kernel.util.StringPool;
064    import com.liferay.portal.kernel.util.StringUtil;
065    import com.liferay.portal.kernel.util.Validator;
066    import com.liferay.portal.kernel.webdav.WebDAVStorage;
067    import com.liferay.portal.kernel.workflow.WorkflowHandler;
068    import com.liferay.portal.kernel.xml.QName;
069    import com.liferay.portal.kernel.xmlrpc.Method;
070    import com.liferay.portal.util.PropsValues;
071    import com.liferay.portlet.DefaultControlPanelEntryFactory;
072    import com.liferay.registry.Registry;
073    import com.liferay.registry.RegistryUtil;
074    import com.liferay.registry.ServiceRegistrar;
075    import com.liferay.social.kernel.model.SocialActivityInterpreter;
076    import com.liferay.social.kernel.model.SocialRequestInterpreter;
077    
078    import java.util.ArrayList;
079    import java.util.Arrays;
080    import java.util.HashMap;
081    import java.util.HashSet;
082    import java.util.LinkedHashMap;
083    import java.util.LinkedHashSet;
084    import java.util.List;
085    import java.util.Map;
086    import java.util.Set;
087    import java.util.TreeSet;
088    import java.util.concurrent.ConcurrentHashMap;
089    import java.util.concurrent.ConcurrentMap;
090    
091    import javax.portlet.PortletMode;
092    import javax.portlet.WindowState;
093    
094    import javax.servlet.ServletContext;
095    
096    /**
097     * @author Brian Wing Shun Chan
098     */
099    public class PortletImpl extends PortletBaseImpl {
100    
101            /**
102             * Constructs a portlet with no parameters.
103             */
104            public PortletImpl() {
105                    this(0, null);
106            }
107    
108            /**
109             * Constructs a portlet with the specified parameters.
110             */
111            public PortletImpl(long companyId, String portletId) {
112                    setCompanyId(companyId);
113                    setPortletId(portletId);
114    
115                    setActive(true);
116                    setStrutsPath(portletId);
117    
118                    _assetRendererFactoryClasses = new ArrayList<>();
119                    _atomCollectionAdapterClasses = new ArrayList<>();
120                    _autopropagatedParameters = new LinkedHashSet<>();
121                    _customAttributesDisplayClasses = new ArrayList<>();
122                    _footerPortalCss = new ArrayList<>();
123                    _footerPortalJavaScript = new ArrayList<>();
124                    _footerPortletCss = new ArrayList<>();
125                    _footerPortletJavaScript = new ArrayList<>();
126                    _headerPortalCss = new ArrayList<>();
127                    _headerPortalJavaScript = new ArrayList<>();
128                    _headerPortletCss = new ArrayList<>();
129                    _headerPortletJavaScript = new ArrayList<>();
130                    _indexerClasses = new ArrayList<>();
131                    _initParams = new HashMap<>();
132                    _portletFilters = new LinkedHashMap<>();
133                    _portletModes = new HashMap<>();
134                    _roleMappers = new LinkedHashMap<>();
135                    _rootPortlet = this;
136                    _schedulerEntries = new ArrayList<>();
137                    _socialActivityInterpreterClasses = new ArrayList<>();
138                    _stagedModelDataHandlerClasses = new ArrayList<>();
139                    _supportedLocales = new HashSet<>();
140                    _trashHandlerClasses = new ArrayList<>();
141                    _unlinkedRoles = new HashSet<>();
142                    _userNotificationHandlerClasses = new ArrayList<>();
143                    _windowStates = new HashMap<>();
144                    _workflowHandlerClasses = new ArrayList<>();
145            }
146    
147            /**
148             * Constructs a portlet with the specified parameters.
149             */
150            public PortletImpl(
151                    String portletId, Portlet rootPortlet, PluginPackage pluginPackage,
152                    PluginSetting pluginSetting, long companyId, String icon,
153                    String virtualPath, String strutsPath, String parentStrutsPath,
154                    String portletName, String displayName, String portletClass,
155                    String configurationActionClass, List<String> indexerClasses,
156                    String openSearchClass, List<SchedulerEntry> schedulerEntries,
157                    String portletURLClass, String friendlyURLMapperClass,
158                    String friendlyURLMapping, String friendlyURLRoutes,
159                    String urlEncoderClass, String portletDataHandlerClass,
160                    List<String> stagedModelDataHandlerClasses, String templateHandlerClass,
161                    String portletLayoutListenerClass, String pollerProcessorClass,
162                    String popMessageListenerClass,
163                    List<String> socialActivityInterpreterClasses,
164                    String socialRequestInterpreterClass,
165                    String userNotificationDefinitions,
166                    List<String> userNotificationHandlerClasses, String webDAVStorageToken,
167                    String webDAVStorageClass, String xmlRpcMethodClass,
168                    String controlPanelEntryCategory, double controlPanelEntryWeight,
169                    String controlPanelClass, List<String> assetRendererFactoryClasses,
170                    List<String> atomCollectionAdapterClasses,
171                    List<String> customAttributesDisplayClasses,
172                    String permissionPropagatorClass, List<String> trashHandlerClasses,
173                    List<String> workflowHandlerClasses, String defaultPreferences,
174                    String preferencesValidator, boolean preferencesCompanyWide,
175                    boolean preferencesUniquePerLayout, boolean preferencesOwnedByGroup,
176                    boolean useDefaultTemplate, boolean showPortletAccessDenied,
177                    boolean showPortletInactive, boolean actionURLRedirect,
178                    boolean restoreCurrentView, boolean maximizeEdit, boolean maximizeHelp,
179                    boolean popUpPrint, boolean layoutCacheable, boolean instanceable,
180                    boolean remoteable, boolean scopeable, boolean singlePageApplication,
181                    String userPrincipalStrategy, boolean privateRequestAttributes,
182                    boolean privateSessionAttributes, Set<String> autopropagatedParameters,
183                    boolean requiresNamespacedParameters, int actionTimeout,
184                    int renderTimeout, int renderWeight, boolean ajaxable,
185                    List<String> headerPortalCss, List<String> headerPortletCss,
186                    List<String> headerPortalJavaScript,
187                    List<String> headerPortletJavaScript, List<String> footerPortalCss,
188                    List<String> footerPortletCss, List<String> footerPortalJavaScript,
189                    List<String> footerPortletJavaScript, String cssClassWrapper,
190                    String facebookIntegration, boolean addDefaultResource, String roles,
191                    Set<String> unlinkedRoles, Map<String, String> roleMappers,
192                    boolean system, boolean active, boolean include,
193                    Map<String, String> initParams, Integer expCache,
194                    Map<String, Set<String>> portletModes,
195                    Map<String, Set<String>> windowStates, Set<String> supportedLocales,
196                    String resourceBundle, PortletInfo portletInfo,
197                    Map<String, PortletFilter> portletFilters, Set<QName> processingEvents,
198                    Set<QName> publishingEvents,
199                    Set<PublicRenderParameter> publicRenderParameters,
200                    PortletApp portletApp) {
201    
202                    setPortletId(portletId);
203                    setCompanyId(companyId);
204                    setRoles(roles);
205                    setActive(active);
206                    setProcessingEvents(processingEvents);
207                    setPublishingEvents(publishingEvents);
208                    setPublicRenderParameters(publicRenderParameters);
209    
210                    _rootPortlet = rootPortlet;
211                    _pluginPackage = pluginPackage;
212                    _defaultPluginSetting = pluginSetting;
213                    _icon = icon;
214                    _virtualPath = virtualPath;
215                    _strutsPath = strutsPath;
216                    _parentStrutsPath = parentStrutsPath;
217                    _portletName = portletName;
218                    _displayName = displayName;
219                    _portletClass = portletClass;
220                    _configurationActionClass = configurationActionClass;
221                    _indexerClasses = indexerClasses;
222                    _openSearchClass = openSearchClass;
223                    _schedulerEntries = schedulerEntries;
224                    _portletURLClass = portletURLClass;
225                    _friendlyURLMapperClass = friendlyURLMapperClass;
226                    _friendlyURLMapping = friendlyURLMapping;
227                    _friendlyURLRoutes = friendlyURLRoutes;
228                    _urlEncoderClass = urlEncoderClass;
229                    _portletDataHandlerClass = portletDataHandlerClass;
230                    _stagedModelDataHandlerClasses = stagedModelDataHandlerClasses;
231                    _templateHandlerClass = templateHandlerClass;
232                    _portletLayoutListenerClass = portletLayoutListenerClass;
233                    _pollerProcessorClass = pollerProcessorClass;
234                    _popMessageListenerClass = popMessageListenerClass;
235                    _socialActivityInterpreterClasses = socialActivityInterpreterClasses;
236                    _socialRequestInterpreterClass = socialRequestInterpreterClass;
237                    _userNotificationDefinitions = userNotificationDefinitions;
238                    _userNotificationHandlerClasses = userNotificationHandlerClasses;
239                    _webDAVStorageToken = webDAVStorageToken;
240                    _webDAVStorageClass = webDAVStorageClass;
241                    _xmlRpcMethodClass = xmlRpcMethodClass;
242                    _controlPanelEntryCategory = controlPanelEntryCategory;
243                    _controlPanelEntryWeight = controlPanelEntryWeight;
244                    _controlPanelEntryClass = controlPanelClass;
245                    _assetRendererFactoryClasses = assetRendererFactoryClasses;
246                    _atomCollectionAdapterClasses = atomCollectionAdapterClasses;
247                    _customAttributesDisplayClasses = customAttributesDisplayClasses;
248                    _permissionPropagatorClass = permissionPropagatorClass;
249                    _trashHandlerClasses = trashHandlerClasses;
250                    _workflowHandlerClasses = workflowHandlerClasses;
251                    _defaultPreferences = defaultPreferences;
252                    _preferencesValidator = preferencesValidator;
253                    _preferencesCompanyWide = preferencesCompanyWide;
254                    _preferencesUniquePerLayout = preferencesUniquePerLayout;
255                    _preferencesOwnedByGroup = preferencesOwnedByGroup;
256                    _useDefaultTemplate = useDefaultTemplate;
257                    _showPortletAccessDenied = showPortletAccessDenied;
258                    _showPortletInactive = showPortletInactive;
259                    _actionURLRedirect = actionURLRedirect;
260                    _restoreCurrentView = restoreCurrentView;
261                    _maximizeEdit = maximizeEdit;
262                    _maximizeHelp = maximizeHelp;
263                    _popUpPrint = popUpPrint;
264                    _layoutCacheable = layoutCacheable;
265                    _instanceable = instanceable;
266                    _remoteable = remoteable;
267                    _scopeable = scopeable;
268                    _singlePageApplication = singlePageApplication;
269                    _userPrincipalStrategy = userPrincipalStrategy;
270                    _privateRequestAttributes = privateRequestAttributes;
271                    _privateSessionAttributes = privateSessionAttributes;
272                    _autopropagatedParameters = autopropagatedParameters;
273                    _requiresNamespacedParameters = requiresNamespacedParameters;
274                    _actionTimeout = actionTimeout;
275                    _renderTimeout = renderTimeout;
276                    _renderWeight = renderWeight;
277                    _ajaxable = ajaxable;
278                    _headerPortalCss = headerPortalCss;
279                    _headerPortletCss = headerPortletCss;
280                    _headerPortalJavaScript = headerPortalJavaScript;
281                    _headerPortletJavaScript = headerPortletJavaScript;
282                    _footerPortalCss = footerPortalCss;
283                    _footerPortletCss = footerPortletCss;
284                    _footerPortalJavaScript = footerPortalJavaScript;
285                    _footerPortletJavaScript = footerPortletJavaScript;
286                    _cssClassWrapper = cssClassWrapper;
287                    _facebookIntegration = facebookIntegration;
288                    _addDefaultResource = addDefaultResource;
289                    _unlinkedRoles = unlinkedRoles;
290                    _roleMappers = roleMappers;
291                    _system = system;
292                    _include = include;
293                    _initParams = initParams;
294                    _expCache = expCache;
295                    _portletModes = portletModes;
296                    _windowStates = windowStates;
297                    _supportedLocales = supportedLocales;
298                    _resourceBundle = resourceBundle;
299                    _portletInfo = portletInfo;
300                    _portletFilters = portletFilters;
301                    _portletApp = portletApp;
302            }
303    
304            /**
305             * Adds an application type.
306             *
307             * @param applicationType an application type
308             */
309            @Override
310            public void addApplicationType(ApplicationType applicationType) {
311                    _applicationTypes.add(applicationType);
312            }
313    
314            /**
315             * Adds a processing event.
316             */
317            @Override
318            public void addProcessingEvent(QName processingEvent) {
319                    _processingEvents.add(processingEvent);
320                    _processingEventsByQName.put(
321                            PortletQNameUtil.getKey(processingEvent), processingEvent);
322            }
323    
324            /**
325             * Adds a public render parameter.
326             *
327             * @param publicRenderParameter a public render parameter
328             */
329            @Override
330            public void addPublicRenderParameter(
331                    PublicRenderParameter publicRenderParameter) {
332    
333                    _publicRenderParameters.add(publicRenderParameter);
334    
335                    String identifier = publicRenderParameter.getIdentifier();
336    
337                    _publicRenderParametersByIdentifier.put(
338                            identifier, publicRenderParameter);
339    
340                    QName qName = publicRenderParameter.getQName();
341    
342                    _publicRenderParametersByQName.put(
343                            PortletQNameUtil.getKey(qName), publicRenderParameter);
344    
345                    String publicRenderParameterName =
346                            PortletQNameUtil.getPublicRenderParameterName(qName);
347    
348                    PortletQNameUtil.setPublicRenderParameterIdentifier(
349                            publicRenderParameterName, identifier);
350            }
351    
352            /**
353             * Adds a publishing event.
354             */
355            @Override
356            public void addPublishingEvent(QName publishingEvent) {
357                    _publishingEvents.add(publishingEvent);
358            }
359    
360            /**
361             * Adds a scheduler entry.
362             */
363            @Override
364            public void addSchedulerEntry(SchedulerEntry schedulerEntry) {
365                    _schedulerEntries.add(schedulerEntry);
366            }
367    
368            /**
369             * Creates and returns a copy of this object.
370             *
371             * @return a copy of this object
372             */
373            @Override
374            public Object clone() {
375                    Portlet portlet = new PortletImpl(
376                            getPortletId(), getRootPortlet(), getPluginPackage(),
377                            getDefaultPluginSetting(), getCompanyId(), getIcon(),
378                            getVirtualPath(), getStrutsPath(), getParentStrutsPath(),
379                            getPortletName(), getDisplayName(), getPortletClass(),
380                            getConfigurationActionClass(), getIndexerClasses(),
381                            getOpenSearchClass(), getSchedulerEntries(), getPortletURLClass(),
382                            getFriendlyURLMapperClass(), getFriendlyURLMapping(),
383                            getFriendlyURLRoutes(), getURLEncoderClass(),
384                            getPortletDataHandlerClass(), getStagedModelDataHandlerClasses(),
385                            getTemplateHandlerClass(), getPortletLayoutListenerClass(),
386                            getPollerProcessorClass(), getPopMessageListenerClass(),
387                            getSocialActivityInterpreterClasses(),
388                            getSocialRequestInterpreterClass(),
389                            getUserNotificationDefinitions(),
390                            getUserNotificationHandlerClasses(), getWebDAVStorageToken(),
391                            getWebDAVStorageClass(), getXmlRpcMethodClass(),
392                            getControlPanelEntryCategory(), getControlPanelEntryWeight(),
393                            getControlPanelEntryClass(), getAssetRendererFactoryClasses(),
394                            getAtomCollectionAdapterClasses(),
395                            getCustomAttributesDisplayClasses(), getPermissionPropagatorClass(),
396                            getTrashHandlerClasses(), getWorkflowHandlerClasses(),
397                            getDefaultPreferences(), getPreferencesValidator(),
398                            isPreferencesCompanyWide(), isPreferencesUniquePerLayout(),
399                            isPreferencesOwnedByGroup(), isUseDefaultTemplate(),
400                            isShowPortletAccessDenied(), isShowPortletInactive(),
401                            isActionURLRedirect(), isRestoreCurrentView(), isMaximizeEdit(),
402                            isMaximizeHelp(), isPopUpPrint(), isLayoutCacheable(),
403                            isInstanceable(), isRemoteable(), isScopeable(),
404                            isSinglePageApplication(), getUserPrincipalStrategy(),
405                            isPrivateRequestAttributes(), isPrivateSessionAttributes(),
406                            getAutopropagatedParameters(), isRequiresNamespacedParameters(),
407                            getActionTimeout(), getRenderTimeout(), getRenderWeight(),
408                            isAjaxable(), getHeaderPortalCss(), getHeaderPortletCss(),
409                            getHeaderPortalJavaScript(), getHeaderPortletJavaScript(),
410                            getFooterPortalCss(), getFooterPortletCss(),
411                            getFooterPortalJavaScript(), getFooterPortletJavaScript(),
412                            getCssClassWrapper(), getFacebookIntegration(),
413                            isAddDefaultResource(), getRoles(), getUnlinkedRoles(),
414                            getRoleMappers(), isSystem(), isActive(), isInclude(),
415                            getInitParams(), getExpCache(), getPortletModes(),
416                            getWindowStates(), getSupportedLocales(), getResourceBundle(),
417                            getPortletInfo(), getPortletFilters(), getProcessingEvents(),
418                            getPublishingEvents(), getPublicRenderParameters(),
419                            getPortletApp());
420    
421                    portlet.setApplicationTypes(getApplicationTypes());
422                    portlet.setId(getId());
423                    portlet.setUndeployedPortlet(isUndeployedPortlet());
424    
425                    return portlet;
426            }
427    
428            /**
429             * Compares this portlet to the specified object.
430             *
431             * @param  portlet the portlet to compare this portlet against
432             * @return the value 0 if the argument portlet is equal to this portlet; a
433             *         value less than -1 if this portlet is less than the portlet
434             *         argument; and 1 if this portlet is greater than the portlet
435             *         argument
436             */
437            @Override
438            public int compareTo(Portlet portlet) {
439                    String portletId = getPortletId();
440    
441                    return portletId.compareTo(portlet.getPortletId());
442            }
443    
444            /**
445             * Checks whether this portlet is equal to the specified object.
446             *
447             * @param  obj the object to compare this portlet against
448             * @return <code>true</code> if the portlet is equal to the specified object
449             */
450            @Override
451            public boolean equals(Object obj) {
452                    if (this == obj) {
453                            return true;
454                    }
455    
456                    if (!(obj instanceof Portlet)) {
457                            return false;
458                    }
459    
460                    Portlet portlet = (Portlet)obj;
461    
462                    String portletId = getPortletId();
463    
464                    return portletId.equals(portlet.getPortletId());
465            }
466    
467            /**
468             * Returns the action timeout of the portlet.
469             *
470             * @return the action timeout of the portlet
471             */
472            @Override
473            public int getActionTimeout() {
474                    return _actionTimeout;
475            }
476    
477            /**
478             * Returns <code>true</code> if an action URL for this portlet should cause
479             * an auto redirect.
480             *
481             * @return <code>true</code> if an action URL for this portlet should cause
482             *         an auto redirect
483             */
484            @Override
485            public boolean getActionURLRedirect() {
486                    return _actionURLRedirect;
487            }
488    
489            /**
490             * Returns <code>true</code> if default resources for the portlet are added
491             * to a page.
492             *
493             * @return <code>true</code> if default resources for the portlet are added
494             *         to a page
495             */
496            @Override
497            public boolean getAddDefaultResource() {
498                    return _addDefaultResource;
499            }
500    
501            /**
502             * Returns <code>true</code> if the portlet can be displayed via Ajax.
503             *
504             * @return <code>true</code> if the portlet can be displayed via Ajax
505             */
506            @Override
507            public boolean getAjaxable() {
508                    return _ajaxable;
509            }
510    
511            /**
512             * Returns the portlet modes of the portlet.
513             *
514             * @return the portlet modes of the portlet
515             */
516            @Override
517            public Set<String> getAllPortletModes() {
518                    Set<String> allPortletModes = new TreeSet<>();
519    
520                    for (Map.Entry<String, Set<String>> entry : _portletModes.entrySet()) {
521                            Set<String> mimeTypePortletModes = entry.getValue();
522    
523                            for (String portletMode : mimeTypePortletModes) {
524                                    allPortletModes.add(portletMode);
525                            }
526                    }
527    
528                    return allPortletModes;
529            }
530    
531            /**
532             * Returns the window states of the portlet.
533             *
534             * @return the window states of the portlet
535             */
536            @Override
537            public Set<String> getAllWindowStates() {
538                    Set<String> allWindowStates = new TreeSet<>();
539    
540                    for (Map.Entry<String, Set<String>> entry : _windowStates.entrySet()) {
541                            Set<String> mimeTypeWindowStates = entry.getValue();
542    
543                            for (String windowState : mimeTypeWindowStates) {
544                                    allWindowStates.add(windowState);
545                            }
546                    }
547    
548                    return allWindowStates;
549            }
550    
551            /**
552             * Returns the application types of the portlet.
553             *
554             * @return the application types of the portlet
555             */
556            @Override
557            public Set<ApplicationType> getApplicationTypes() {
558                    return _applicationTypes;
559            }
560    
561            /**
562             * Returns the names of the classes that represent asset types associated
563             * with the portlet.
564             *
565             * @return the names of the classes that represent asset types associated
566             *         with the portlet
567             */
568            @Override
569            public List<String> getAssetRendererFactoryClasses() {
570                    return _assetRendererFactoryClasses;
571            }
572    
573            /**
574             * Returns the asset type instances of the portlet.
575             *
576             * @return the asset type instances of the portlet
577             */
578            @Override
579            public List<AssetRendererFactory<?>> getAssetRendererFactoryInstances() {
580                    if (_assetRendererFactoryClasses.isEmpty()) {
581                            return null;
582                    }
583    
584                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
585    
586                    return portletBag.getAssetRendererFactoryInstances();
587            }
588    
589            /**
590             * Returns the names of the classes that represent atom collection adapters
591             * associated with the portlet.
592             *
593             * @return the names of the classes that represent atom collection adapters
594             *         associated with the portlet
595             */
596            @Override
597            public List<String> getAtomCollectionAdapterClasses() {
598                    return _atomCollectionAdapterClasses;
599            }
600    
601            /**
602             * Returns the atom collection adapter instances of the portlet.
603             *
604             * @return the atom collection adapter instances of the portlet
605             */
606            @Override
607            public List<AtomCollectionAdapter<?>> getAtomCollectionAdapterInstances() {
608                    if (_atomCollectionAdapterClasses.isEmpty()) {
609                            return null;
610                    }
611    
612                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
613    
614                    return portletBag.getAtomCollectionAdapterInstances();
615            }
616    
617            /**
618             * Returns the names of the parameters that will be automatically propagated
619             * through the portlet.
620             *
621             * @return the names of the parameters that will be automatically propagated
622             *         through the portlet
623             */
624            @Override
625            public Set<String> getAutopropagatedParameters() {
626                    return _autopropagatedParameters;
627            }
628    
629            /**
630             * Returns <code>true</code> if the portlet is found in a WAR file.
631             *
632             * @param  portletId the cloned instance portlet ID
633             * @return a cloned instance of the portlet
634             */
635            @Override
636            public Portlet getClonedInstance(String portletId) {
637                    Portlet portlet = (Portlet)clone();
638    
639                    portlet.setPortletId(portletId);
640    
641                    return portlet;
642            }
643    
644            /**
645             * Returns the configuration action class of the portlet.
646             *
647             * @return the configuration action class of the portlet
648             */
649            @Override
650            public String getConfigurationActionClass() {
651                    return _configurationActionClass;
652            }
653    
654            /**
655             * Returns the configuration action instance of the portlet.
656             *
657             * @return the configuration action instance of the portlet
658             */
659            @Override
660            public ConfigurationAction getConfigurationActionInstance() {
661                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
662    
663                    List<ConfigurationAction> configurationActionInstances =
664                            portletBag.getConfigurationActionInstances();
665    
666                    if (configurationActionInstances.isEmpty()) {
667                            return null;
668                    }
669    
670                    return configurationActionInstances.get(0);
671            }
672    
673            /**
674             * Returns the servlet context name of the portlet.
675             *
676             * @return the servlet context name of the portlet
677             */
678            @Override
679            public String getContextName() {
680                    if (!_portletApp.isWARFile()) {
681                            return PortalUtil.getServletContextName();
682                    }
683    
684                    return _portletApp.getServletContextName();
685            }
686    
687            /**
688             * Returns the servlet context path of the portlet.
689             *
690             * @return the servlet context path of the portlet
691             */
692            @Override
693            public String getContextPath() {
694                    return _portletApp.getContextPath();
695            }
696    
697            /**
698             * Returns the name of the category of the Control Panel where the portlet
699             * will be shown.
700             *
701             * @return the name of the category of the Control Panel where the portlet
702             *         will be shown
703             */
704            @Override
705            public String getControlPanelEntryCategory() {
706                    return _controlPanelEntryCategory;
707            }
708    
709            /**
710             * Returns the name of the class that will control when the portlet will be
711             * shown in the Control Panel.
712             *
713             * @return the name of the class that will control when the portlet will be
714             *         shown in the Control Panel
715             */
716            @Override
717            public String getControlPanelEntryClass() {
718                    return _controlPanelEntryClass;
719            }
720    
721            /**
722             * Returns an instance of the class that will control when the portlet will
723             * be shown in the Control Panel.
724             *
725             * @return the instance of the class that will control when the portlet will
726             *         be shown in the Control Panel
727             */
728            @Override
729            public ControlPanelEntry getControlPanelEntryInstance() {
730                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
731    
732                    List<ControlPanelEntry> controlPanelEntryInstances =
733                            portletBag.getControlPanelEntryInstances();
734    
735                    if (controlPanelEntryInstances.isEmpty()) {
736                            return DefaultControlPanelEntryFactory.getInstance();
737                    }
738    
739                    return controlPanelEntryInstances.get(0);
740            }
741    
742            /**
743             * Returns the relative weight of the portlet with respect to the other
744             * portlets in the same category of the Control Panel.
745             *
746             * @return the relative weight of the portlet with respect to the other
747             *         portlets in the same category of the Control Panel
748             */
749            @Override
750            public double getControlPanelEntryWeight() {
751                    return _controlPanelEntryWeight;
752            }
753    
754            /**
755             * Returns the name of the CSS class that will be injected in the DIV that
756             * wraps this portlet.
757             *
758             * @return the name of the CSS class that will be injected in the DIV that
759             *         wraps this portlet
760             */
761            @Override
762            public String getCssClassWrapper() {
763                    return _cssClassWrapper;
764            }
765    
766            /**
767             * Returns the names of the classes that represent custom attribute displays
768             * associated with the portlet.
769             *
770             * @return the names of the classes that represent asset types associated
771             *         with the portlet
772             */
773            @Override
774            public List<String> getCustomAttributesDisplayClasses() {
775                    return _customAttributesDisplayClasses;
776            }
777    
778            /**
779             * Returns the custom attribute display instances of the portlet.
780             *
781             * @return the custom attribute display instances of the portlet
782             */
783            @Override
784            public List<CustomAttributesDisplay> getCustomAttributesDisplayInstances() {
785                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
786    
787                    return portletBag.getCustomAttributesDisplayInstances();
788            }
789    
790            /**
791             * Get the default plugin settings of the portlet.
792             *
793             * @return the plugin settings
794             */
795            @Override
796            public PluginSetting getDefaultPluginSetting() {
797                    return _defaultPluginSetting;
798            }
799    
800            /**
801             * Returns the default preferences of the portlet.
802             *
803             * @return the default preferences of the portlet
804             */
805            @Override
806            public String getDefaultPreferences() {
807                    if (Validator.isNull(_defaultPreferences)) {
808                            return PortletConstants.DEFAULT_PREFERENCES;
809                    }
810                    else {
811                            return _defaultPreferences;
812                    }
813            }
814    
815            /**
816             * Returns the display name of the portlet.
817             *
818             * @return the display name of the portlet
819             */
820            @Override
821            public String getDisplayName() {
822                    return _displayName;
823            }
824    
825            /**
826             * Returns expiration cache of the portlet.
827             *
828             * @return expiration cache of the portlet
829             */
830            @Override
831            public Integer getExpCache() {
832                    return _expCache;
833            }
834    
835            /**
836             * Returns the Facebook integration method of the portlet.
837             *
838             * @return the Facebook integration method of the portlet
839             */
840            @Override
841            public String getFacebookIntegration() {
842                    return _facebookIntegration;
843            }
844    
845            /**
846             * Returns a list of CSS files that will be referenced from the page's
847             * footer relative to the portal's context path.
848             *
849             * @return a list of CSS files that will be referenced from the page's
850             *         footer relative to the portal's context path
851             */
852            @Override
853            public List<String> getFooterPortalCss() {
854                    return _footerPortalCss;
855            }
856    
857            /**
858             * Returns a list of JavaScript files that will be referenced from the
859             * page's footer relative to the portal's context path.
860             *
861             * @return a list of JavaScript files that will be referenced from the
862             *         page's footer relative to the portal's context path
863             */
864            @Override
865            public List<String> getFooterPortalJavaScript() {
866                    return _footerPortalJavaScript;
867            }
868    
869            /**
870             * Returns a list of CSS files that will be referenced from the page's
871             * footer relative to the portlet's context path.
872             *
873             * @return a list of CSS files that will be referenced from the page's
874             *         footer relative to the portlet's context path
875             */
876            @Override
877            public List<String> getFooterPortletCss() {
878                    return _footerPortletCss;
879            }
880    
881            /**
882             * Returns a list of JavaScript files that will be referenced from the
883             * page's footer relative to the portlet's context path.
884             *
885             * @return a list of JavaScript files that will be referenced from the
886             *         page's footer relative to the portlet's context path
887             */
888            @Override
889            public List<String> getFooterPortletJavaScript() {
890                    return _footerPortletJavaScript;
891            }
892    
893            /**
894             * Returns the name of the friendly URL mapper class of the portlet.
895             *
896             * @return the name of the friendly URL mapper class of the portlet
897             */
898            @Override
899            public String getFriendlyURLMapperClass() {
900                    return _friendlyURLMapperClass;
901            }
902    
903            /**
904             * Returns the friendly URL mapper instance of the portlet.
905             *
906             * @return the friendly URL mapper instance of the portlet
907             */
908            @Override
909            public FriendlyURLMapper getFriendlyURLMapperInstance() {
910                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
911    
912                    if (portletBag == null) {
913                            return null;
914                    }
915    
916                    FriendlyURLMapperTracker friendlyURLMapperTracker =
917                            portletBag.getFriendlyURLMapperTracker();
918    
919                    return friendlyURLMapperTracker.getFriendlyURLMapper();
920            }
921    
922            /**
923             * Returns the name of the friendly URL mapping of the portlet.
924             *
925             * @return the name of the friendly URL mapping of the portlet
926             */
927            @Override
928            public String getFriendlyURLMapping() {
929                    if (Validator.isNotNull(_friendlyURLMapping)) {
930                            return _friendlyURLMapping;
931                    }
932    
933                    FriendlyURLMapper friendlyURLMapperInstance =
934                            getFriendlyURLMapperInstance();
935    
936                    if (friendlyURLMapperInstance == null) {
937                            return null;
938                    }
939    
940                    return friendlyURLMapperInstance.getMapping();
941            }
942    
943            /**
944             * Returns the class loader resource path to the friendly URL routes of the
945             * portlet.
946             *
947             * @return the class loader resource path to the friendly URL routes of the
948             *         portlet
949             */
950            @Override
951            public String getFriendlyURLRoutes() {
952                    return _friendlyURLRoutes;
953            }
954    
955            /**
956             * Returns a list of CSS files that will be referenced from the page's
957             * header relative to the portal's context path.
958             *
959             * @return a list of CSS files that will be referenced from the page's
960             *         header relative to the portal's context path
961             */
962            @Override
963            public List<String> getHeaderPortalCss() {
964                    return _headerPortalCss;
965            }
966    
967            /**
968             * Returns a list of JavaScript files that will be referenced from the
969             * page's header relative to the portal's context path.
970             *
971             * @return a list of JavaScript files that will be referenced from the
972             *         page's header relative to the portal's context path
973             */
974            @Override
975            public List<String> getHeaderPortalJavaScript() {
976                    return _headerPortalJavaScript;
977            }
978    
979            /**
980             * Returns a list of CSS files that will be referenced from the page's
981             * header relative to the portlet's context path.
982             *
983             * @return a list of CSS files that will be referenced from the page's
984             *         header relative to the portlet's context path
985             */
986            @Override
987            public List<String> getHeaderPortletCss() {
988                    return _headerPortletCss;
989            }
990    
991            /**
992             * Returns a list of JavaScript files that will be referenced from the
993             * page's header relative to the portlet's context path.
994             *
995             * @return a list of JavaScript files that will be referenced from the
996             *         page's header relative to the portlet's context path
997             */
998            @Override
999            public List<String> getHeaderPortletJavaScript() {
1000                    return _headerPortletJavaScript;
1001            }
1002    
1003            /**
1004             * Returns the icon of the portlet.
1005             *
1006             * @return the icon of the portlet
1007             */
1008            @Override
1009            public String getIcon() {
1010                    return _icon;
1011            }
1012    
1013            /**
1014             * Returns <code>true</code> to include the portlet and make it available to
1015             * be made active.
1016             *
1017             * @return <code>true</code> to include the portlet and make it available to
1018             *         be made active
1019             */
1020            @Override
1021            public boolean getInclude() {
1022                    return _include;
1023            }
1024    
1025            /**
1026             * Returns the names of the classes that represent indexers associated with
1027             * the portlet.
1028             *
1029             * @return the names of the classes that represent indexers associated with
1030             *         the portlet
1031             */
1032            @Override
1033            public List<String> getIndexerClasses() {
1034                    return _indexerClasses;
1035            }
1036    
1037            /**
1038             * Returns the indexer instances of the portlet.
1039             *
1040             * @return the indexer instances of the portlet
1041             */
1042            @Override
1043            public List<Indexer<?>> getIndexerInstances() {
1044                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1045    
1046                    return portletBag.getIndexerInstances();
1047            }
1048    
1049            /**
1050             * Returns the init parameters of the portlet.
1051             *
1052             * @return init parameters of the portlet
1053             */
1054            @Override
1055            public Map<String, String> getInitParams() {
1056                    return _initParams;
1057            }
1058    
1059            /**
1060             * Returns <code>true</code> if the portlet can be added multiple times to a
1061             * layout.
1062             *
1063             * @return <code>true</code> if the portlet can be added multiple times to a
1064             *         layout
1065             */
1066            @Override
1067            public boolean getInstanceable() {
1068                    return _instanceable;
1069            }
1070    
1071            /**
1072             * Returns the instance ID of the portlet.
1073             *
1074             * @return the instance ID of the portlet
1075             */
1076            @Override
1077            public String getInstanceId() {
1078                    return PortletConstants.getInstanceId(getPortletId());
1079            }
1080    
1081            /**
1082             * Returns <code>true</code> to allow the portlet to be cached within the
1083             * layout.
1084             *
1085             * @return <code>true</code> if the portlet can be cached within the layout
1086             */
1087            @Override
1088            public boolean getLayoutCacheable() {
1089                    return _layoutCacheable;
1090            }
1091    
1092            /**
1093             * Returns <code>true</code> if the portlet goes into the maximized state
1094             * when the user goes into the edit mode.
1095             *
1096             * @return <code>true</code> if the portlet goes into the maximized state
1097             *         when the user goes into the edit mode
1098             */
1099            @Override
1100            public boolean getMaximizeEdit() {
1101                    return _maximizeEdit;
1102            }
1103    
1104            /**
1105             * Returns <code>true</code> if the portlet goes into the maximized state
1106             * when the user goes into the help mode.
1107             *
1108             * @return <code>true</code> if the portlet goes into the maximized state
1109             *         when the user goes into the help mode
1110             */
1111            @Override
1112            public boolean getMaximizeHelp() {
1113                    return _maximizeHelp;
1114            }
1115    
1116            /**
1117             * Returns the name of the open search class of the portlet.
1118             *
1119             * @return the name of the open search class of the portlet
1120             */
1121            @Override
1122            public String getOpenSearchClass() {
1123                    return _openSearchClass;
1124            }
1125    
1126            /**
1127             * Returns the indexer instance of the portlet.
1128             *
1129             * @return the indexer instance of the portlet
1130             */
1131            @Override
1132            public OpenSearch getOpenSearchInstance() {
1133                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1134    
1135                    List<OpenSearch> openSearchInstances =
1136                            portletBag.getOpenSearchInstances();
1137    
1138                    if (openSearchInstances.isEmpty()) {
1139                            return null;
1140                    }
1141    
1142                    return openSearchInstances.get(0);
1143            }
1144    
1145            /**
1146             * Returns the parent struts path of the portlet.
1147             *
1148             * @return the parent struts path of the portlet.
1149             */
1150            @Override
1151            public String getParentStrutsPath() {
1152                    return _parentStrutsPath;
1153            }
1154    
1155            /**
1156             * Returns the name of the permission propagator class of the portlet.
1157             *
1158             * @return the name of the permission propagator class of the portlet
1159             */
1160            @Override
1161            public String getPermissionPropagatorClass() {
1162                    return _permissionPropagatorClass;
1163            }
1164    
1165            /**
1166             * Returns the permission propagator instance of the portlet.
1167             *
1168             * @return the permission propagator instance of the portlet
1169             */
1170            @Override
1171            public PermissionPropagator getPermissionPropagatorInstance() {
1172                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1173    
1174                    List<PermissionPropagator> permissionPropagatorInstances =
1175                            portletBag.getPermissionPropagatorInstances();
1176    
1177                    if (permissionPropagatorInstances.isEmpty()) {
1178                            return null;
1179                    }
1180    
1181                    return permissionPropagatorInstances.get(0);
1182            }
1183    
1184            /**
1185             * Returns the plugin ID of the portlet.
1186             *
1187             * @return the plugin ID of the portlet
1188             */
1189            @Override
1190            public String getPluginId() {
1191                    return getRootPortletId();
1192            }
1193    
1194            /**
1195             * Returns this portlet's plugin package.
1196             *
1197             * @return this portlet's plugin package
1198             */
1199            @Override
1200            public PluginPackage getPluginPackage() {
1201                    return _pluginPackage;
1202            }
1203    
1204            /**
1205             * Returns the plugin type of the portlet.
1206             *
1207             * @return the plugin type of the portlet
1208             */
1209            @Override
1210            public String getPluginType() {
1211                    return Plugin.TYPE_PORTLET;
1212            }
1213    
1214            /**
1215             * Returns the name of the poller processor class of the portlet.
1216             *
1217             * @return the name of the poller processor class of the portlet
1218             */
1219            @Override
1220            public String getPollerProcessorClass() {
1221                    return _pollerProcessorClass;
1222            }
1223    
1224            /**
1225             * Returns the poller processor instance of the portlet.
1226             *
1227             * @return the poller processor instance of the portlet
1228             */
1229            @Override
1230            public PollerProcessor getPollerProcessorInstance() {
1231                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1232    
1233                    List<PollerProcessor> pollerProcessorInstances =
1234                            portletBag.getPollerProcessorInstances();
1235    
1236                    if (pollerProcessorInstances.isEmpty()) {
1237                            return null;
1238                    }
1239    
1240                    return pollerProcessorInstances.get(0);
1241            }
1242    
1243            /**
1244             * Returns the name of the POP message listener class of the portlet.
1245             *
1246             * @return the name of the POP message listener class of the portlet
1247             */
1248            @Override
1249            public String getPopMessageListenerClass() {
1250                    return _popMessageListenerClass;
1251            }
1252    
1253            /**
1254             * Returns the POP message listener instance of the portlet.
1255             *
1256             * @return the POP message listener instance of the portlet
1257             */
1258            @Override
1259            public MessageListener getPopMessageListenerInstance() {
1260                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1261    
1262                    List<MessageListener> popMessageListenerInstances =
1263                            portletBag.getPopMessageListenerInstances();
1264    
1265                    if (popMessageListenerInstances.isEmpty()) {
1266                            return null;
1267                    }
1268    
1269                    return popMessageListenerInstances.get(0);
1270            }
1271    
1272            /**
1273             * Returns <code>true</code> if the portlet goes into the pop up state when
1274             * the user goes into the print mode.
1275             *
1276             * @return <code>true</code> if the portlet goes into the pop up state when
1277             *         the user goes into the print mode
1278             */
1279            @Override
1280            public boolean getPopUpPrint() {
1281                    return _popUpPrint;
1282            }
1283    
1284            /**
1285             * Returns this portlet's application.
1286             *
1287             * @return this portlet's application
1288             */
1289            @Override
1290            public PortletApp getPortletApp() {
1291                    return _portletApp;
1292            }
1293    
1294            /**
1295             * Returns the name of the portlet class of the portlet.
1296             *
1297             * @return the name of the portlet class of the portlet
1298             */
1299            @Override
1300            public String getPortletClass() {
1301                    return _portletClass;
1302            }
1303    
1304            /**
1305             * Returns the name of the portlet data handler class of the portlet.
1306             *
1307             * @return the name of the portlet data handler class of the portlet
1308             */
1309            @Override
1310            public String getPortletDataHandlerClass() {
1311                    return _portletDataHandlerClass;
1312            }
1313    
1314            /**
1315             * Returns the portlet data handler instance of the portlet.
1316             *
1317             * @return the portlet data handler instance of the portlet
1318             */
1319            @Override
1320            public PortletDataHandler getPortletDataHandlerInstance() {
1321                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1322    
1323                    if (portletBag == null) {
1324                            _log.error("No portlet bag for " + toString());
1325    
1326                            throw new IllegalStateException("No portlet bag for " + toString());
1327                    }
1328    
1329                    List<PortletDataHandler> portletDataHandlerInstances =
1330                            portletBag.getPortletDataHandlerInstances();
1331    
1332                    if (portletDataHandlerInstances.isEmpty()) {
1333                            return null;
1334                    }
1335    
1336                    return portletDataHandlerInstances.get(0);
1337            }
1338    
1339            /**
1340             * Returns the filters of the portlet.
1341             *
1342             * @return filters of the portlet
1343             */
1344            @Override
1345            public Map<String, PortletFilter> getPortletFilters() {
1346                    return _portletFilters;
1347            }
1348    
1349            /**
1350             * Returns the portlet info of the portlet.
1351             *
1352             * @return portlet info of the portlet
1353             */
1354            @Override
1355            public PortletInfo getPortletInfo() {
1356                    return _portletInfo;
1357            }
1358    
1359            /**
1360             * Returns the name of the portlet layout listener class of the portlet.
1361             *
1362             * @return the name of the portlet layout listener class of the portlet
1363             */
1364            @Override
1365            public String getPortletLayoutListenerClass() {
1366                    return _portletLayoutListenerClass;
1367            }
1368    
1369            /**
1370             * Returns the portlet layout listener instance of the portlet.
1371             *
1372             * @return the portlet layout listener instance of the portlet
1373             */
1374            @Override
1375            public PortletLayoutListener getPortletLayoutListenerInstance() {
1376                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1377    
1378                    if (portletBag == null) {
1379                            return null;
1380                    }
1381    
1382                    List<PortletLayoutListener> portletLayoutListenerInstances =
1383                            portletBag.getPortletLayoutListenerInstances();
1384    
1385                    if (portletLayoutListenerInstances.isEmpty()) {
1386                            return null;
1387                    }
1388    
1389                    return portletLayoutListenerInstances.get(0);
1390            }
1391    
1392            /**
1393             * Returns the portlet modes of the portlet.
1394             *
1395             * @return portlet modes of the portlet
1396             */
1397            @Override
1398            public Map<String, Set<String>> getPortletModes() {
1399                    return _portletModes;
1400            }
1401    
1402            /**
1403             * Returns the name of the portlet.
1404             *
1405             * @return the display name of the portlet
1406             */
1407            @Override
1408            public String getPortletName() {
1409                    return _portletName;
1410            }
1411    
1412            /**
1413             * Returns the name of the portlet URL class of the portlet.
1414             *
1415             * @return the name of the portlet URL class of the portlet
1416             */
1417            @Override
1418            public String getPortletURLClass() {
1419                    return _portletURLClass;
1420            }
1421    
1422            /**
1423             * Returns <code>true</code> if preferences are shared across the entire
1424             * company.
1425             *
1426             * @return <code>true</code> if preferences are shared across the entire
1427             *         company
1428             */
1429            @Override
1430            public boolean getPreferencesCompanyWide() {
1431                    return _preferencesCompanyWide;
1432            }
1433    
1434            /**
1435             * Returns <code>true</code> if preferences are owned by the group when the
1436             * portlet is shown in a group layout. Returns <code>false</code> if
1437             * preferences are owned by the user at all times.
1438             *
1439             * @return <code>true</code> if preferences are owned by the group when the
1440             *         portlet is shown in a group layout; <code>false</code> if
1441             *         preferences are owned by the user at all times.
1442             */
1443            @Override
1444            public boolean getPreferencesOwnedByGroup() {
1445                    return _preferencesOwnedByGroup;
1446            }
1447    
1448            /**
1449             * Returns <code>true</code> if preferences are unique per layout.
1450             *
1451             * @return <code>true</code> if preferences are unique per layout
1452             */
1453            @Override
1454            public boolean getPreferencesUniquePerLayout() {
1455                    return _preferencesUniquePerLayout;
1456            }
1457    
1458            /**
1459             * Returns the name of the preferences validator class of the portlet.
1460             *
1461             * @return the name of the preferences validator class of the portlet
1462             */
1463            @Override
1464            public String getPreferencesValidator() {
1465                    return _preferencesValidator;
1466            }
1467    
1468            /**
1469             * Returns <code>true</code> if the portlet does not share request
1470             * attributes with the portal or portlets from another WAR.
1471             *
1472             * @return <code>true</code> if the portlet does not share request
1473             *         attributes with the portal or portlets from another WAR
1474             */
1475            @Override
1476            public boolean getPrivateRequestAttributes() {
1477                    return _privateRequestAttributes;
1478            }
1479    
1480            /**
1481             * Returns <code>true</code> if the portlet does not share session
1482             * attributes with the portal.
1483             *
1484             * @return <code>true</code> if the portlet does not share session
1485             *         attributes with the portal
1486             */
1487            @Override
1488            public boolean getPrivateSessionAttributes() {
1489                    return _privateSessionAttributes;
1490            }
1491    
1492            /**
1493             * Returns the processing event from a namespace URI and a local part.
1494             *
1495             * @param  uri the namespace URI
1496             * @param  localPart the local part
1497             * @return the processing event from a namespace URI and a local part
1498             */
1499            @Override
1500            public QName getProcessingEvent(String uri, String localPart) {
1501                    return _processingEventsByQName.get(
1502                            PortletQNameUtil.getKey(uri, localPart));
1503            }
1504    
1505            /**
1506             * Returns the processing events of the portlet.
1507             *
1508             * @return the processing events of the portlet
1509             */
1510            @Override
1511            public Set<QName> getProcessingEvents() {
1512                    return _processingEvents;
1513            }
1514    
1515            /**
1516             * Returns the public render parameter from an identifier.
1517             *
1518             * @param  identifier the identifier
1519             * @return the public render parameter from an identifier
1520             */
1521            @Override
1522            public PublicRenderParameter getPublicRenderParameter(String identifier) {
1523                    return _publicRenderParametersByIdentifier.get(identifier);
1524            }
1525    
1526            /**
1527             * Returns the spublic render parameter from a namespace URI and a local
1528             * part.
1529             *
1530             * @param  uri the namespace URI
1531             * @param  localPart the local part
1532             * @return the spublic render parameter from a namespace URI and a local
1533             *         part
1534             */
1535            @Override
1536            public PublicRenderParameter getPublicRenderParameter(
1537                    String uri, String localPart) {
1538    
1539                    return _publicRenderParametersByQName.get(
1540                            PortletQNameUtil.getKey(uri, localPart));
1541            }
1542    
1543            /**
1544             * Returns the public render parameters of the portlet.
1545             *
1546             * @return the public render parameters of the portlet
1547             */
1548            @Override
1549            public Set<PublicRenderParameter> getPublicRenderParameters() {
1550                    return _publicRenderParameters;
1551            }
1552    
1553            /**
1554             * Returns the publishing events of the portlet.
1555             *
1556             * @return the publishing events of the portlet
1557             */
1558            @Override
1559            public Set<QName> getPublishingEvents() {
1560                    return _publishingEvents;
1561            }
1562    
1563            /**
1564             * Returns <code>true</code> if the portlet is ready to be used.
1565             *
1566             * @return <code>true</code> if the portlet is ready to be used
1567             */
1568            @Override
1569            public boolean getReady() {
1570                    return isReady();
1571            }
1572    
1573            /**
1574             * Returns <code>true</code> if the portlet supports remoting.
1575             *
1576             * @return <code>true</code> if the portlet supports remoting
1577             */
1578            @Override
1579            public boolean getRemoteable() {
1580                    return _remoteable;
1581            }
1582    
1583            /**
1584             * Returns the render timeout of the portlet.
1585             *
1586             * @return the render timeout of the portlet
1587             */
1588            @Override
1589            public int getRenderTimeout() {
1590                    return _renderTimeout;
1591            }
1592    
1593            /**
1594             * Returns the render weight of the portlet.
1595             *
1596             * @return the render weight of the portlet
1597             */
1598            @Override
1599            public int getRenderWeight() {
1600                    return _renderWeight;
1601            }
1602    
1603            /**
1604             * Returns the resource bundle of the portlet.
1605             *
1606             * @return resource bundle of the portlet
1607             */
1608            @Override
1609            public String getResourceBundle() {
1610                    return _resourceBundle;
1611            }
1612    
1613            /**
1614             * Returns <code>true</code> if the portlet restores to the current view
1615             * from the maximized state.
1616             *
1617             * @return <code>true</code> if the portlet restores to the current view
1618             *         from the maximized state
1619             */
1620            @Override
1621            public boolean getRestoreCurrentView() {
1622                    return _restoreCurrentView;
1623            }
1624    
1625            /**
1626             * Returns the role mappers of the portlet.
1627             *
1628             * @return role mappers of the portlet
1629             */
1630            @Override
1631            public Map<String, String> getRoleMappers() {
1632                    return _roleMappers;
1633            }
1634    
1635            /**
1636             * Returns an array of required roles of the portlet.
1637             *
1638             * @return an array of required roles of the portlet
1639             */
1640            @Override
1641            public String[] getRolesArray() {
1642                    return _rolesArray;
1643            }
1644    
1645            /**
1646             * Returns the root portlet of this portlet instance.
1647             *
1648             * @return the root portlet of this portlet instance
1649             */
1650            @Override
1651            public Portlet getRootPortlet() {
1652                    return _rootPortlet;
1653            }
1654    
1655            /**
1656             * Returns the root portlet ID of the portlet.
1657             *
1658             * @return the root portlet ID of the portlet
1659             */
1660            @Override
1661            public String getRootPortletId() {
1662                    return PortletConstants.getRootPortletId(getPortletId());
1663            }
1664    
1665            /**
1666             * Returns the scheduler entries of the portlet.
1667             *
1668             * @return the scheduler entries of the portlet
1669             */
1670            @Override
1671            public List<SchedulerEntry> getSchedulerEntries() {
1672                    return _schedulerEntries;
1673            }
1674    
1675            /**
1676             * Returns <code>true</code> if the portlet supports scoping of data.
1677             *
1678             * @return <code>true</code> if the portlet supports scoping of data
1679             */
1680            @Override
1681            public boolean getScopeable() {
1682                    return _scopeable;
1683            }
1684    
1685            /**
1686             * Returns <code>true</code> if users are shown that they do not have access
1687             * to the portlet.
1688             *
1689             * @return <code>true</code> if users are shown that they do not have access
1690             *         to the portlet
1691             */
1692            @Override
1693            public boolean getShowPortletAccessDenied() {
1694                    return _showPortletAccessDenied;
1695            }
1696    
1697            /**
1698             * Returns <code>true</code> if users are shown that the portlet is
1699             * inactive.
1700             *
1701             * @return <code>true</code> if users are shown that the portlet is inactive
1702             */
1703            @Override
1704            public boolean getShowPortletInactive() {
1705                    return _showPortletInactive;
1706            }
1707    
1708            /**
1709             * Returns <code>true</code> if the portlet uses Single Page Application.
1710             *
1711             * @return <code>true</code> if the portlet uses Single Page Application
1712             */
1713            @Override
1714            public boolean getSinglePageApplication() {
1715                    return _singlePageApplication;
1716            }
1717    
1718            /**
1719             * Returns the names of the classes that represent social activity
1720             * interpreters associated with the portlet.
1721             *
1722             * @return the names of the classes that represent social activity
1723             *         interpreters associated with the portlet
1724             */
1725            @Override
1726            public List<String> getSocialActivityInterpreterClasses() {
1727                    return _socialActivityInterpreterClasses;
1728            }
1729    
1730            /**
1731             * Returns the social activity interpreter instances of the portlet.
1732             *
1733             * @return the social activity interpreter instances of the portlet
1734             */
1735            @Override
1736            public List<SocialActivityInterpreter>
1737                    getSocialActivityInterpreterInstances() {
1738    
1739                    if (_socialActivityInterpreterClasses.isEmpty()) {
1740                            return null;
1741                    }
1742    
1743                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1744    
1745                    return portletBag.getSocialActivityInterpreterInstances();
1746            }
1747    
1748            /**
1749             * Returns the name of the social request interpreter class of the portlet.
1750             *
1751             * @return the name of the social request interpreter class of the portlet
1752             */
1753            @Override
1754            public String getSocialRequestInterpreterClass() {
1755                    return _socialRequestInterpreterClass;
1756            }
1757    
1758            /**
1759             * Returns the name of the social request interpreter instance of the
1760             * portlet.
1761             *
1762             * @return the name of the social request interpreter instance of the
1763             *         portlet
1764             */
1765            @Override
1766            public SocialRequestInterpreter getSocialRequestInterpreterInstance() {
1767                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1768    
1769                    List<SocialRequestInterpreter> socialRequestInterpreterInstances =
1770                            portletBag.getSocialRequestInterpreterInstances();
1771    
1772                    if (socialRequestInterpreterInstances.isEmpty()) {
1773                            return null;
1774                    }
1775    
1776                    return socialRequestInterpreterInstances.get(0);
1777            }
1778    
1779            /**
1780             * Returns the names of the classes that represent staged model data
1781             * handlers associated with the portlet.
1782             *
1783             * @return the names of the classes that represent staged model data
1784             *         handlers associated with the portlet
1785             */
1786            @Override
1787            public List<String> getStagedModelDataHandlerClasses() {
1788                    return _stagedModelDataHandlerClasses;
1789            }
1790    
1791            /**
1792             * Returns the staged model data handler instances of the portlet.
1793             *
1794             * @return the staged model data handler instances of the portlet
1795             */
1796            @Override
1797            public List<StagedModelDataHandler<?>>
1798                    getStagedModelDataHandlerInstances() {
1799    
1800                    if (_stagedModelDataHandlerClasses.isEmpty()) {
1801                            return null;
1802                    }
1803    
1804                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1805    
1806                    return portletBag.getStagedModelDataHandlerInstances();
1807            }
1808    
1809            /**
1810             * Returns <code>true</code> if the portlet is a static portlet that is
1811             * cannot be moved.
1812             *
1813             * @return <code>true</code> if the portlet is a static portlet that is
1814             *         cannot be moved
1815             */
1816            @Override
1817            public boolean getStatic() {
1818                    return _staticPortlet;
1819            }
1820    
1821            /**
1822             * Returns <code>true</code> if the portlet is a static portlet at the end
1823             * of a list of portlets.
1824             *
1825             * @return <code>true</code> if the portlet is a static portlet at the end
1826             *         of a list of portlets
1827             */
1828            @Override
1829            public boolean getStaticEnd() {
1830                    return !_staticPortletStart;
1831            }
1832    
1833            /**
1834             * Returns the path for static resources served by this portlet.
1835             *
1836             * @return the path for static resources served by this portlet
1837             */
1838            @Override
1839            public String getStaticResourcePath() {
1840                    String proxyPath = PortalUtil.getPathProxy();
1841    
1842                    String virtualPath = getVirtualPath();
1843    
1844                    if (Validator.isNotNull(virtualPath)) {
1845                            return proxyPath.concat(virtualPath);
1846                    }
1847    
1848                    String contextPath = getContextPath();
1849    
1850                    if (!_portletApp.isWARFile()) {
1851                            return contextPath;
1852                    }
1853    
1854                    return proxyPath.concat(contextPath);
1855            }
1856    
1857            /**
1858             * Returns <code>true</code> if the portlet is a static portlet at the start
1859             * of a list of portlets.
1860             *
1861             * @return <code>true</code> if the portlet is a static portlet at the start
1862             *         of a list of portlets
1863             */
1864            @Override
1865            public boolean getStaticStart() {
1866                    return _staticPortletStart;
1867            }
1868    
1869            /**
1870             * Returns the struts path of the portlet.
1871             *
1872             * @return the struts path of the portlet
1873             */
1874            @Override
1875            public String getStrutsPath() {
1876                    return _strutsPath;
1877            }
1878    
1879            /**
1880             * Returns the supported locales of the portlet.
1881             *
1882             * @return the supported locales of the portlet
1883             */
1884            @Override
1885            public Set<String> getSupportedLocales() {
1886                    return _supportedLocales;
1887            }
1888    
1889            /**
1890             * Returns <code>true</code> if the portlet is a system portlet that a user
1891             * cannot manually add to their page.
1892             *
1893             * @return <code>true</code> if the portlet is a system portlet that a user
1894             *         cannot manually add to their page
1895             */
1896            @Override
1897            public boolean getSystem() {
1898                    return _system;
1899            }
1900    
1901            /**
1902             * Returns the name of the template handler class of the portlet.
1903             *
1904             * @return the name of the template handler class of the portlet
1905             */
1906            @Override
1907            public String getTemplateHandlerClass() {
1908                    return _templateHandlerClass;
1909            }
1910    
1911            /**
1912             * Returns the template handler instance of the portlet.
1913             *
1914             * @return the template handler instance of the portlet
1915             */
1916            @Override
1917            public TemplateHandler getTemplateHandlerInstance() {
1918                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1919    
1920                    List<TemplateHandler> templateHandlerInstances =
1921                            portletBag.getTemplateHandlerInstances();
1922    
1923                    if (templateHandlerInstances.isEmpty()) {
1924                            return null;
1925                    }
1926    
1927                    return templateHandlerInstances.get(0);
1928            }
1929    
1930            /**
1931             * Returns the timestamp of the portlet.
1932             *
1933             * @return the timestamp of the portlet
1934             */
1935            @Override
1936            public long getTimestamp() {
1937                    if (_timestamp == null) {
1938                            PortletApp portletApp = getPortletApp();
1939    
1940                            ServletContext servletContext = portletApp.getServletContext();
1941    
1942                            _timestamp = ServletContextUtil.getLastModified(
1943                                    servletContext, StringPool.SLASH, true);
1944                    }
1945    
1946                    return _timestamp;
1947            }
1948    
1949            /**
1950             * Returns the names of the classes that represent trash handlers associated
1951             * with the portlet.
1952             *
1953             * @return the names of the classes that represent trash handlers associated
1954             *         with the portlet
1955             */
1956            @Override
1957            public List<String> getTrashHandlerClasses() {
1958                    return _trashHandlerClasses;
1959            }
1960    
1961            /**
1962             * Returns the trash handler instances of the portlet.
1963             *
1964             * @return the trash handler instances of the portlet
1965             */
1966            @Override
1967            public List<TrashHandler> getTrashHandlerInstances() {
1968                    if (_trashHandlerClasses.isEmpty()) {
1969                            return null;
1970                    }
1971    
1972                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1973    
1974                    return portletBag.getTrashHandlerInstances();
1975            }
1976    
1977            /**
1978             * Returns <code>true</code> if the portlet is an undeployed portlet.
1979             *
1980             * @return <code>true</code> if the portlet is a placeholder of an
1981             *         undeployed portlet
1982             */
1983            @Override
1984            public boolean getUndeployedPortlet() {
1985                    return _undeployedPortlet;
1986            }
1987    
1988            /**
1989             * Returns the unlinked roles of the portlet.
1990             *
1991             * @return unlinked roles of the portlet
1992             */
1993            @Override
1994            public Set<String> getUnlinkedRoles() {
1995                    return _unlinkedRoles;
1996            }
1997    
1998            /**
1999             * Returns the name of the URL encoder class of the portlet.
2000             *
2001             * @return the name of the URL encoder class of the portlet
2002             */
2003            @Override
2004            public String getURLEncoderClass() {
2005                    return _urlEncoderClass;
2006            }
2007    
2008            /**
2009             * Returns the URL encoder instance of the portlet.
2010             *
2011             * @return the URL encoder instance of the portlet
2012             */
2013            @Override
2014            public URLEncoder getURLEncoderInstance() {
2015                    PortletBag portletBag = PortletBagPool.get(getRootPortletId());
2016    
2017                    List<URLEncoder> urlEncoderInstances =
2018                            portletBag.getURLEncoderInstances();
2019    
2020                    if (urlEncoderInstances.isEmpty()) {
2021                            return null;
2022                    }
2023    
2024                    return urlEncoderInstances.get(0);
2025            }
2026    
2027            /**
2028             * Returns <code>true</code> if the portlet uses the default template.
2029             *
2030             * @return <code>true</code> if the portlet uses the default template
2031             */
2032            @Override
2033            public boolean getUseDefaultTemplate() {
2034                    return _useDefaultTemplate;
2035            }
2036    
2037            /**
2038             * Returns the user ID of the portlet. This only applies when the portlet is
2039             * added by a user in a customizable layout.
2040             *
2041             * @return the user ID of the portlet
2042             */
2043            @Override
2044            public long getUserId() {
2045                    return PortletConstants.getUserId(getPortletId());
2046            }
2047    
2048            /**
2049             * Returns the class loader resource path to the use notification
2050             * definitions of the portlet.
2051             *
2052             * @return the class loader resource path to the use notification
2053             *         definitions of the portlet
2054             */
2055            @Override
2056            public String getUserNotificationDefinitions() {
2057                    return _userNotificationDefinitions;
2058            }
2059    
2060            /**
2061             * Returns the names of the classes that represent user notification
2062             * handlers associated with the portlet.
2063             *
2064             * @return the names of the classes that represent user notification
2065             *         handlers associated with the portlet
2066             */
2067            @Override
2068            public List<String> getUserNotificationHandlerClasses() {
2069                    return _userNotificationHandlerClasses;
2070            }
2071    
2072            /**
2073             * Returns the user notification handler instances of the portlet.
2074             *
2075             * @return the user notification handler instances of the portlet
2076             */
2077            @Override
2078            public List<UserNotificationHandler> getUserNotificationHandlerInstances() {
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                    Readiness readiness = _readinessMap.get(getRootPortletId());
2573    
2574                    if (readiness == null) {
2575                            return true;
2576                    }
2577                    else {
2578                            return readiness._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                    Registry registry = RegistryUtil.getRegistry();
3519    
3520                    Readiness readiness = new Readiness(
3521                            ready, registry.getServiceRegistrar(Portlet.class));
3522    
3523                    String rootPortletId = getRootPortletId();
3524    
3525                    Readiness previousReadiness = _readinessMap.putIfAbsent(
3526                            rootPortletId, readiness);
3527    
3528                    if (previousReadiness != null) {
3529                            readiness = previousReadiness;
3530                    }
3531    
3532                    synchronized (readiness) {
3533                            if (readiness != _readinessMap.get(rootPortletId)) {
3534                                    return;
3535                            }
3536    
3537                            readiness._ready = ready;
3538    
3539                            ServiceRegistrar<Portlet> serviceRegistrar =
3540                                    readiness._serviceRegistrar;
3541    
3542                            if (ready) {
3543                                    if (serviceRegistrar.isDestroyed()) {
3544                                            serviceRegistrar = registry.getServiceRegistrar(
3545                                                    Portlet.class);
3546    
3547                                            readiness._serviceRegistrar = serviceRegistrar;
3548                                    }
3549    
3550                                    Map<String, Object> properties = new HashMap<>();
3551    
3552                                    properties.put("javax.portlet.name", getPortletName());
3553    
3554                                    serviceRegistrar.registerService(
3555                                            Portlet.class, this, properties);
3556                            }
3557                            else {
3558                                    serviceRegistrar.destroy();
3559                            }
3560                    }
3561            }
3562    
3563            /**
3564             * Set to <code>true</code> if the portlet supports remoting
3565             *
3566             * @param remoteable boolean value for whether or not the the portlet
3567             *        supports remoting
3568             */
3569            @Override
3570            public void setRemoteable(boolean remoteable) {
3571                    _remoteable = remoteable;
3572            }
3573    
3574            /**
3575             * Sets the render timeout of the portlet.
3576             *
3577             * @param renderTimeout the render timeout of the portlet
3578             */
3579            @Override
3580            public void setRenderTimeout(int renderTimeout) {
3581                    _renderTimeout = renderTimeout;
3582            }
3583    
3584            /**
3585             * Sets the render weight of the portlet.
3586             *
3587             * @param renderWeight int value for the render weight of the portlet
3588             */
3589            @Override
3590            public void setRenderWeight(int renderWeight) {
3591                    _renderWeight = renderWeight;
3592            }
3593    
3594            /**
3595             * Set to <code>true</code> if the portlet will only process namespaced
3596             * parameters.
3597             *
3598             * @param requiresNamespacedParameters boolean value for whether the portlet
3599             *        will only process namespaced parameters
3600             */
3601            @Override
3602            public void setRequiresNamespacedParameters(
3603                    boolean requiresNamespacedParameters) {
3604    
3605                    _requiresNamespacedParameters = requiresNamespacedParameters;
3606            }
3607    
3608            /**
3609             * Sets the resource bundle of the portlet.
3610             *
3611             * @param resourceBundle the resource bundle of the portlet
3612             */
3613            @Override
3614            public void setResourceBundle(String resourceBundle) {
3615                    _resourceBundle = resourceBundle;
3616            }
3617    
3618            /**
3619             * Set to <code>true</code> if the portlet restores to the current view from
3620             * the maximized state.
3621             *
3622             * @param restoreCurrentView boolean value for whether the portlet restores
3623             *        to the current view from the maximized state
3624             */
3625            @Override
3626            public void setRestoreCurrentView(boolean restoreCurrentView) {
3627                    _restoreCurrentView = restoreCurrentView;
3628            }
3629    
3630            /**
3631             * Sets the role mappers of the portlet.
3632             *
3633             * @param roleMappers the role mappers of the portlet
3634             */
3635            @Override
3636            public void setRoleMappers(Map<String, String> roleMappers) {
3637                    _roleMappers = roleMappers;
3638            }
3639    
3640            /**
3641             * Sets a string of ordered comma delimited portlet IDs.
3642             *
3643             * @param roles a string of ordered comma delimited portlet IDs
3644             */
3645            @Override
3646            public void setRoles(String roles) {
3647                    _rolesArray = StringUtil.split(roles);
3648    
3649                    super.setRoles(roles);
3650            }
3651    
3652            /**
3653             * Sets an array of required roles of the portlet.
3654             *
3655             * @param rolesArray an array of required roles of the portlet
3656             */
3657            @Override
3658            public void setRolesArray(String[] rolesArray) {
3659                    _rolesArray = rolesArray;
3660    
3661                    super.setRoles(StringUtil.merge(rolesArray));
3662            }
3663    
3664            /**
3665             * Sets the scheduler entries of the portlet.
3666             *
3667             * @param schedulerEntries the scheduler entries of the portlet
3668             */
3669            @Override
3670            public void setSchedulerEntries(List<SchedulerEntry> schedulerEntries) {
3671                    for (SchedulerEntry schedulerEntry : schedulerEntries) {
3672                            addSchedulerEntry(schedulerEntry);
3673                    }
3674            }
3675    
3676            /**
3677             * Set to <code>true</code> if the portlet supports scoping of data.
3678             *
3679             * @param scopeable boolean value for whether or not the the portlet
3680             *        supports scoping of data
3681             */
3682            @Override
3683            public void setScopeable(boolean scopeable) {
3684                    _scopeable = scopeable;
3685            }
3686    
3687            /**
3688             * Set to <code>true</code> if users are shown that they do not have access
3689             * to the portlet.
3690             *
3691             * @param showPortletAccessDenied boolean value for whether users are shown
3692             *        that they do not have access to the portlet
3693             */
3694            @Override
3695            public void setShowPortletAccessDenied(boolean showPortletAccessDenied) {
3696                    _showPortletAccessDenied = showPortletAccessDenied;
3697            }
3698    
3699            /**
3700             * Set to <code>true</code> if users are shown that the portlet is inactive.
3701             *
3702             * @param showPortletInactive boolean value for whether users are shown that
3703             *        the portlet is inactive
3704             */
3705            @Override
3706            public void setShowPortletInactive(boolean showPortletInactive) {
3707                    _showPortletInactive = showPortletInactive;
3708            }
3709    
3710            /**
3711             * Set to <code>true</code> if the portlet uses Single Page Application.
3712             *
3713             * @param singlePageApplication boolean value for whether or not the the
3714             *        portlet uses Single Page Application
3715             */
3716            @Override
3717            public void setSinglePageApplication(boolean singlePageApplication) {
3718                    _singlePageApplication = singlePageApplication;
3719            }
3720    
3721            /**
3722             * Sets the names of the classes that represent social activity interpreters
3723             * associated with the portlet.
3724             *
3725             * @param socialActivityInterpreterClasses the names of the classes that
3726             *        represent social activity interpreters associated with the portlet
3727             */
3728            @Override
3729            public void setSocialActivityInterpreterClasses(
3730                    List<String> socialActivityInterpreterClasses) {
3731    
3732                    _socialActivityInterpreterClasses = socialActivityInterpreterClasses;
3733            }
3734    
3735            /**
3736             * Sets the name of the social request interpreter class of the portlet.
3737             *
3738             * @param socialRequestInterpreterClass the name of the request interpreter
3739             *        class of the portlet
3740             */
3741            @Override
3742            public void setSocialRequestInterpreterClass(
3743                    String socialRequestInterpreterClass) {
3744    
3745                    _socialRequestInterpreterClass = socialRequestInterpreterClass;
3746            }
3747    
3748            /**
3749             * Returns the names of the classes that represent staged model data handlers associated with the portlet.
3750             *
3751             * @return the names of the classes that represent staged model data handlers associated with the portlet
3752             */
3753    
3754            /**
3755             * Sets the names of the classes that represent staged model data handlers
3756             * associated with the portlet.
3757             *
3758             * @param stagedModelDataHandlerClasses the names of the classes that
3759             *        represent staged model data handlers associated with the portlet
3760             */
3761            @Override
3762            public void setStagedModelDataHandlerClasses(
3763                    List<String> stagedModelDataHandlerClasses) {
3764    
3765                    _stagedModelDataHandlerClasses = stagedModelDataHandlerClasses;
3766            }
3767    
3768            /**
3769             * Set to <code>true</code> if the portlet is a static portlet that is
3770             * cannot be moved.
3771             *
3772             * @param staticPortlet boolean value for whether the portlet is a static
3773             *        portlet that cannot be moved
3774             */
3775            @Override
3776            public void setStatic(boolean staticPortlet) {
3777                    _staticPortlet = staticPortlet;
3778            }
3779    
3780            /**
3781             * Set to <code>true</code> if the portlet is a static portlet at the start
3782             * of a list of portlets.
3783             *
3784             * @param staticPortletStart boolean value for whether the portlet is a
3785             *        static portlet at the start of a list of portlets
3786             */
3787            @Override
3788            public void setStaticStart(boolean staticPortletStart) {
3789                    _staticPortletStart = staticPortletStart;
3790            }
3791    
3792            /**
3793             * Sets the struts path of the portlet.
3794             *
3795             * @param strutsPath the struts path of the portlet
3796             */
3797            @Override
3798            public void setStrutsPath(String strutsPath) {
3799                    _strutsPath = strutsPath;
3800            }
3801    
3802            /**
3803             * Sets the supported locales of the portlet.
3804             *
3805             * @param supportedLocales the supported locales of the portlet
3806             */
3807            @Override
3808            public void setSupportedLocales(Set<String> supportedLocales) {
3809                    _supportedLocales = supportedLocales;
3810            }
3811    
3812            /**
3813             * Set to <code>true</code> if the portlet is a system portlet that a user
3814             * cannot manually add to their page.
3815             *
3816             * @param system boolean value for whether the portlet is a system portlet
3817             *        that a user cannot manually add to their page
3818             */
3819            @Override
3820            public void setSystem(boolean system) {
3821                    _system = system;
3822            }
3823    
3824            /**
3825             * Sets the name of the template handler class of the portlet.
3826             *
3827             * @param templateHandlerClass the name of template handler class of the
3828             *        portlet
3829             */
3830            @Override
3831            public void setTemplateHandlerClass(String templateHandlerClass) {
3832                    _templateHandlerClass = templateHandlerClass;
3833            }
3834    
3835            /**
3836             * Sets the names of the classes that represent trash handlers associated to
3837             * the portlet.
3838             *
3839             * @param trashHandlerClasses the names of the classes that represent trash
3840             *        handlers associated with the portlet
3841             */
3842            @Override
3843            public void setTrashHandlerClasses(List<String> trashHandlerClasses) {
3844                    _trashHandlerClasses = trashHandlerClasses;
3845            }
3846    
3847            /**
3848             * Set to <code>true</code> if the portlet is an undeployed portlet.
3849             *
3850             * @param undeployedPortlet boolean value for whether the portlet is an
3851             *        undeployed portlet
3852             */
3853            @Override
3854            public void setUndeployedPortlet(boolean undeployedPortlet) {
3855                    _undeployedPortlet = undeployedPortlet;
3856            }
3857    
3858            /**
3859             * Sets the unlinked roles of the portlet.
3860             *
3861             * @param unlinkedRoles the unlinked roles of the portlet
3862             */
3863            @Override
3864            public void setUnlinkedRoles(Set<String> unlinkedRoles) {
3865                    _unlinkedRoles = unlinkedRoles;
3866            }
3867    
3868            /**
3869             * Sets the name of the URL encoder class of the portlet.
3870             *
3871             * @param urlEncoderClass the name of the URL encoder class of the portlet
3872             */
3873            @Override
3874            public void setURLEncoderClass(String urlEncoderClass) {
3875                    _urlEncoderClass = urlEncoderClass;
3876            }
3877    
3878            /**
3879             * Set to <code>true</code> if the portlet uses the default template.
3880             *
3881             * @param useDefaultTemplate boolean value for whether the portlet uses the
3882             *        default template
3883             */
3884            @Override
3885            public void setUseDefaultTemplate(boolean useDefaultTemplate) {
3886                    _useDefaultTemplate = useDefaultTemplate;
3887            }
3888    
3889            /**
3890             * Sets the class loader resource path to the user notification definitions
3891             * of the portlet.
3892             *
3893             * @param userNotificationDefinitions the class loader resource path to the
3894             *        user notification definitions of the portlet
3895             */
3896            @Override
3897            public void setUserNotificationDefinitions(
3898                    String userNotificationDefinitions) {
3899    
3900                    _userNotificationDefinitions = userNotificationDefinitions;
3901            }
3902    
3903            /**
3904             * Sets the names of the classes that represent user notification handlers
3905             * associated with the portlet.
3906             *
3907             * @param userNotificationHandlerClasses the names of the classes that
3908             *        represent user notification handlers associated with the portlet
3909             */
3910            @Override
3911            public void setUserNotificationHandlerClasses(
3912                    List<String> userNotificationHandlerClasses) {
3913    
3914                    _userNotificationHandlerClasses = userNotificationHandlerClasses;
3915            }
3916    
3917            /**
3918             * Sets the user principal strategy of the portlet.
3919             *
3920             * @param userPrincipalStrategy the user principal strategy of the portlet
3921             */
3922            @Override
3923            public void setUserPrincipalStrategy(String userPrincipalStrategy) {
3924                    if (Validator.isNotNull(userPrincipalStrategy)) {
3925                            _userPrincipalStrategy = userPrincipalStrategy;
3926                    }
3927            }
3928    
3929            /**
3930             * Sets the virtual path of the portlet.
3931             *
3932             * @param virtualPath the virtual path of the portlet
3933             */
3934            @Override
3935            public void setVirtualPath(String virtualPath) {
3936                    if (_portletApp.isWARFile() && Validator.isNull(virtualPath)) {
3937                            virtualPath = PropsValues.PORTLET_VIRTUAL_PATH;
3938                    }
3939    
3940                    _virtualPath = virtualPath;
3941            }
3942    
3943            /**
3944             * Sets the name of the WebDAV storage class of the portlet.
3945             *
3946             * @param webDAVStorageClass the name of the WebDAV storage class of the
3947             *        portlet
3948             */
3949            @Override
3950            public void setWebDAVStorageClass(String webDAVStorageClass) {
3951                    _webDAVStorageClass = webDAVStorageClass;
3952            }
3953    
3954            /**
3955             * Sets the name of the WebDAV storage token of the portlet.
3956             *
3957             * @param webDAVStorageToken the name of the WebDAV storage token of the
3958             *        portlet
3959             */
3960            @Override
3961            public void setWebDAVStorageToken(String webDAVStorageToken) {
3962                    _webDAVStorageToken = webDAVStorageToken;
3963            }
3964    
3965            /**
3966             * Sets the window states of the portlet.
3967             *
3968             * @param windowStates the window states of the portlet
3969             */
3970            @Override
3971            public void setWindowStates(Map<String, Set<String>> windowStates) {
3972                    _windowStates = windowStates;
3973            }
3974    
3975            /**
3976             * Sets the names of the classes that represent workflow handlers associated
3977             * to the portlet.
3978             *
3979             * @param workflowHandlerClasses the names of the classes that represent
3980             *        workflow handlers associated with the portlet
3981             */
3982            @Override
3983            public void setWorkflowHandlerClasses(List<String> workflowHandlerClasses) {
3984                    _workflowHandlerClasses = workflowHandlerClasses;
3985            }
3986    
3987            /**
3988             * Sets the name of the XML-RPC method class of the portlet.
3989             *
3990             * @param xmlRpcMethodClass the name of the XML-RPC method class of the
3991             *        portlet
3992             */
3993            @Override
3994            public void setXmlRpcMethodClass(String xmlRpcMethodClass) {
3995                    _xmlRpcMethodClass = xmlRpcMethodClass;
3996            }
3997    
3998            @Override
3999            public void unsetReady() {
4000                    Readiness readiness = _readinessMap.remove(getRootPortletId());
4001    
4002                    if (readiness != null) {
4003                            synchronized (readiness) {
4004                                    ServiceRegistrar<Portlet> serviceRegistrar =
4005                                            readiness._serviceRegistrar;
4006    
4007                                    serviceRegistrar.destroy();
4008                            }
4009                    }
4010            }
4011    
4012            /**
4013             * Log instance for this class.
4014             */
4015            private static final Log _log = LogFactoryUtil.getLog(PortletImpl.class);
4016    
4017            /**
4018             * Map of the ready states of all portlets keyed by their root portlet ID.
4019             */
4020            private static final ConcurrentMap<String, Readiness> _readinessMap =
4021                    new ConcurrentHashMap<>();
4022    
4023            /**
4024             * The action timeout of the portlet.
4025             */
4026            private int _actionTimeout;
4027    
4028            /**
4029             * <code>True</code> if an action URL for this portlet should cause an auto
4030             * redirect.
4031             */
4032            private boolean _actionURLRedirect;
4033    
4034            /**
4035             * <code>True</code> if default resources for the portlet are added to a
4036             * page.
4037             */
4038            private boolean _addDefaultResource;
4039    
4040            /**
4041             * <code>True</code> if the portlet can be displayed via Ajax.
4042             */
4043            private boolean _ajaxable = true;
4044    
4045            /**
4046             * The application types of the portlet.
4047             */
4048            private final Set<ApplicationType> _applicationTypes = new HashSet<>();
4049    
4050            /**
4051             * The names of the classes that represents asset types associated with the
4052             * portlet.
4053             */
4054            private List<String> _assetRendererFactoryClasses;
4055    
4056            /**
4057             * The names of the classes that represents atom collection adapters
4058             * associated with the portlet.
4059             */
4060            private List<String> _atomCollectionAdapterClasses;
4061    
4062            /**
4063             * The names of the parameters that will be automatically propagated through
4064             * the portlet.
4065             */
4066            private Set<String> _autopropagatedParameters;
4067    
4068            /**
4069             * The configuration action class of the portlet.
4070             */
4071            private String _configurationActionClass;
4072    
4073            /**
4074             * The name of the category of the Control Panel where this portlet will be
4075             * shown.
4076             */
4077            private String _controlPanelEntryCategory = StringPool.BLANK;
4078    
4079            /**
4080             * The name of the class that will control when this portlet will be shown
4081             * in the Control Panel.
4082             */
4083            private String _controlPanelEntryClass;
4084    
4085            /**
4086             * The relative weight of this portlet with respect to the other portlets in
4087             * the same category of the Control Panel.
4088             */
4089            private double _controlPanelEntryWeight = 100;
4090    
4091            /**
4092             * The name of the CSS class that will be injected in the DIV that wraps
4093             * this portlet.
4094             */
4095            private String _cssClassWrapper = StringPool.BLANK;
4096    
4097            /**
4098             * The names of the classes that represents custom attribute displays
4099             * associated with the portlet.
4100             */
4101            private List<String> _customAttributesDisplayClasses;
4102    
4103            /**
4104             * Plugin settings associated with the portlet.
4105             */
4106            private PluginSetting _defaultPluginSetting;
4107    
4108            /**
4109             * The default preferences of the portlet.
4110             */
4111            private String _defaultPreferences;
4112    
4113            /**
4114             * The display name of the portlet.
4115             */
4116            private String _displayName;
4117    
4118            /**
4119             * The expiration cache of the portlet.
4120             */
4121            private Integer _expCache;
4122    
4123            /**
4124             * The Facebook integration method of the portlet.
4125             */
4126            private String _facebookIntegration =
4127                    PortletConstants.FACEBOOK_INTEGRATION_IFRAME;
4128    
4129            /**
4130             * A list of CSS files that will be referenced from the page's footer
4131             * relative to the portal's context path.
4132             */
4133            private List<String> _footerPortalCss;
4134    
4135            /**
4136             * A list of JavaScript files that will be referenced from the page's footer
4137             * relative to the portal's context path.
4138             */
4139            private List<String> _footerPortalJavaScript;
4140    
4141            /**
4142             * A list of CSS files that will be referenced from the page's footer
4143             * relative to the portlet's context path.
4144             */
4145            private List<String> _footerPortletCss;
4146    
4147            /**
4148             * A list of JavaScript files that will be referenced from the page's footer
4149             * relative to the portlet's context path.
4150             */
4151            private List<String> _footerPortletJavaScript;
4152    
4153            /**
4154             * The name of the friendly URL mapper class of the portlet.
4155             */
4156            private String _friendlyURLMapperClass;
4157    
4158            /**
4159             * The name of the friendly URL mapping of the portlet.
4160             */
4161            private String _friendlyURLMapping;
4162    
4163            /**
4164             * The the class loader resource path to the friendly URL routes of the
4165             * portlet.
4166             */
4167            private String _friendlyURLRoutes;
4168    
4169            /**
4170             * A list of CSS files that will be referenced from the page's header
4171             * relative to the portal's context path.
4172             */
4173            private List<String> _headerPortalCss;
4174    
4175            /**
4176             * A list of JavaScript files that will be referenced from the page's header
4177             * relative to the portal's context path.
4178             */
4179            private List<String> _headerPortalJavaScript;
4180    
4181            /**
4182             * A list of CSS files that will be referenced from the page's header
4183             * relative to the portlet's context path.
4184             */
4185            private List<String> _headerPortletCss;
4186    
4187            /**
4188             * A list of JavaScript files that will be referenced from the page's header
4189             * relative to the portlet's context path.
4190             */
4191            private List<String> _headerPortletJavaScript;
4192    
4193            /**
4194             * The icon of the portlet.
4195             */
4196            private String _icon;
4197    
4198            /**
4199             * <code>True</code> to include the portlet and make it available to be made
4200             * active.
4201             */
4202            private boolean _include = true;
4203    
4204            /**
4205             * The names of the classes that represent indexers associated with the
4206             * portlet.
4207             */
4208            private List<String> _indexerClasses;
4209    
4210            /**
4211             * The init parameters of the portlet.
4212             */
4213            private Map<String, String> _initParams;
4214    
4215            /**
4216             * <code>True</code> if the portlet can be added multiple times to a layout.
4217             */
4218            private boolean _instanceable;
4219    
4220            /**
4221             * <code>True</code> if the portlet can be cached within the layout.
4222             */
4223            private boolean _layoutCacheable;
4224    
4225            /**
4226             * <code>True</code> if the portlet goes into the maximized state when the
4227             * user goes into the edit mode.
4228             */
4229            private boolean _maximizeEdit;
4230    
4231            /**
4232             * <code>True</code> if the portlet goes into the maximized state when the
4233             * user goes into the help mode.
4234             */
4235            private boolean _maximizeHelp;
4236    
4237            /**
4238             * The name of the open search class of the portlet.
4239             */
4240            private String _openSearchClass;
4241    
4242            /**
4243             * The parent struts path of the portlet.
4244             */
4245            private String _parentStrutsPath;
4246    
4247            /**
4248             * The name of the permission propagator class of the portlet.
4249             */
4250            private String _permissionPropagatorClass;
4251    
4252            /**
4253             * Package to which this plugin belongs.
4254             */
4255            private PluginPackage _pluginPackage;
4256    
4257            /**
4258             * The name of the poller processor class of the portlet.
4259             */
4260            private String _pollerProcessorClass;
4261    
4262            /**
4263             * The name of the POP message listener class of the portlet.
4264             */
4265            private String _popMessageListenerClass;
4266    
4267            /**
4268             * <code>True</code> if the portlet goes into the pop up state when the user
4269             * goes into the print mode.
4270             */
4271            private boolean _popUpPrint = true;
4272    
4273            /**
4274             * The application to which this portlet belongs.
4275             */
4276            private PortletApp _portletApp;
4277    
4278            /**
4279             * The name of the portlet class of the portlet.
4280             */
4281            private String _portletClass;
4282    
4283            /**
4284             * The name of the portlet data handler class of the portlet.
4285             */
4286            private String _portletDataHandlerClass;
4287    
4288            /**
4289             * The filters of the portlet.
4290             */
4291            private Map<String, PortletFilter> _portletFilters;
4292    
4293            /**
4294             * The portlet info of the portlet.
4295             */
4296            private PortletInfo _portletInfo;
4297    
4298            /**
4299             * The name of the portlet data layout listener class of the portlet.
4300             */
4301            private String _portletLayoutListenerClass;
4302    
4303            /**
4304             * The portlet modes of the portlet.
4305             */
4306            private Map<String, Set<String>> _portletModes;
4307    
4308            /**
4309             * The name of the portlet.
4310             */
4311            private String _portletName;
4312    
4313            /**
4314             * The name of the portlet URL class of the portlet.
4315             */
4316            private String _portletURLClass;
4317    
4318            /**
4319             * <code>True</code> if preferences are shared across the entire company.
4320             */
4321            private boolean _preferencesCompanyWide;
4322    
4323            /**
4324             * <code>True</code> if preferences are owned by the group when the portlet
4325             * is shown in a group layout. <code>False</code> if preferences are owned
4326             * by the user at all times.
4327             */
4328            private boolean _preferencesOwnedByGroup = true;
4329    
4330            /**
4331             * <code>True</code> if preferences are unique per layout.
4332             */
4333            private boolean _preferencesUniquePerLayout = true;
4334    
4335            /**
4336             * The name of the preferences validator class of the portlet.
4337             */
4338            private String _preferencesValidator;
4339    
4340            /**
4341             * <code>True</code> if the portlet does not share request attributes with
4342             * the portal or portlets from another WAR.
4343             */
4344            private boolean _privateRequestAttributes = true;
4345    
4346            /**
4347             * <code>True</code> if the portlet does not share session attributes with
4348             * the portal.
4349             */
4350            private boolean _privateSessionAttributes = true;
4351    
4352            /**
4353             * The processing events of the portlet.
4354             */
4355            private final Set<QName> _processingEvents = new HashSet<>();
4356    
4357            /**
4358             * Map of the processing events of the portlet keyed by the QName.
4359             */
4360            private final Map<String, QName> _processingEventsByQName = new HashMap<>();
4361    
4362            /**
4363             * The public render parameters of the portlet.
4364             */
4365            private final Set<PublicRenderParameter> _publicRenderParameters =
4366                    new HashSet<>();
4367    
4368            /**
4369             * Map of the public render parameters of the portlet keyed by the
4370             * identifier.
4371             */
4372            private final Map<String, PublicRenderParameter>
4373                    _publicRenderParametersByIdentifier = new HashMap<>();
4374    
4375            /**
4376             * Map of the public render parameters of the portlet keyed by the QName.
4377             */
4378            private final Map<String, PublicRenderParameter>
4379                    _publicRenderParametersByQName = new HashMap<>();
4380    
4381            /**
4382             * The publishing events of the portlet.
4383             */
4384            private final Set<QName> _publishingEvents = new HashSet<>();
4385    
4386            /**
4387             * <code>True</code> if the portlet supports remoting.
4388             */
4389            private boolean _remoteable;
4390    
4391            /**
4392             * The render timeout of the portlet.
4393             */
4394            private int _renderTimeout;
4395    
4396            /**
4397             * Render weight of the portlet.
4398             */
4399            private int _renderWeight = 1;
4400    
4401            /**
4402             * <code>True</code> if the portlet will only process namespaced parameters.
4403             */
4404            private boolean _requiresNamespacedParameters = true;
4405    
4406            /**
4407             * The resource bundle of the portlet.
4408             */
4409            private String _resourceBundle;
4410    
4411            /**
4412             * <code>True</code> if the portlet restores to the current view from the
4413             * maximized state.
4414             */
4415            private boolean _restoreCurrentView = true;
4416    
4417            /**
4418             * The role mappers of the portlet.
4419             */
4420            private Map<String, String> _roleMappers;
4421    
4422            /**
4423             * An array of required roles of the portlet.
4424             */
4425            private String[] _rolesArray = new String[0];
4426    
4427            /**
4428             * The root portlet of this portlet instance.
4429             */
4430            private final Portlet _rootPortlet;
4431    
4432            /**
4433             * The scheduler entries of the portlet.
4434             */
4435            private final List<SchedulerEntry> _schedulerEntries;
4436    
4437            /**
4438             * <code>True</code> if the portlet supports scoping of data.
4439             */
4440            private boolean _scopeable;
4441    
4442            /**
4443             * <code>True</code> if users are shown that they do not have access to the
4444             * portlet.
4445             */
4446            private boolean _showPortletAccessDenied =
4447                    PropsValues.LAYOUT_SHOW_PORTLET_ACCESS_DENIED;
4448    
4449            /**
4450             * <code>True</code> if users are shown that the portlet is inactive.
4451             */
4452            private boolean _showPortletInactive =
4453                    PropsValues.LAYOUT_SHOW_PORTLET_INACTIVE;
4454    
4455            /**
4456             * <code>True</code> if the portlet uses Single Page Application.
4457             */
4458            private boolean _singlePageApplication = true;
4459    
4460            /**
4461             * The names of the classes that represents social activity interpreters
4462             * associated with the portlet.
4463             */
4464            private List<String> _socialActivityInterpreterClasses;
4465    
4466            /**
4467             * The name of the social request interpreter class of the portlet.
4468             */
4469            private String _socialRequestInterpreterClass;
4470    
4471            /**
4472             * The names of the classes that represent staged model data handlers
4473             * associated with the portlet.
4474             */
4475            private List<String> _stagedModelDataHandlerClasses;
4476    
4477            /**
4478             * <code>True</code> if the portlet is a static portlet that is cannot be
4479             * moved.
4480             */
4481            private boolean _staticPortlet;
4482    
4483            /**
4484             * <code>True</code> if the portlet is a static portlet at the start of a
4485             * list of portlets.
4486             */
4487            private boolean _staticPortletStart;
4488    
4489            /**
4490             * The struts path of the portlet.
4491             */
4492            private String _strutsPath;
4493    
4494            /**
4495             * The supported locales of the portlet.
4496             */
4497            private Set<String> _supportedLocales;
4498    
4499            /**
4500             * <code>True</code> if the portlet is a system portlet that a user cannot
4501             * manually add to their page.
4502             */
4503            private boolean _system;
4504    
4505            /**
4506             * The name of the display style handler class of the portlet.
4507             */
4508            private String _templateHandlerClass;
4509    
4510            /**
4511             * The timestamp of the portlet.
4512             */
4513            private Long _timestamp;
4514    
4515            /**
4516             * The names of the classes that represents trash handlers associated with
4517             * the portlet.
4518             */
4519            private List<String> _trashHandlerClasses;
4520    
4521            /**
4522             * <code>True</code> if the portlet is an undeployed portlet.
4523             */
4524            private boolean _undeployedPortlet;
4525    
4526            /**
4527             * The unlinked roles of the portlet.
4528             */
4529            private Set<String> _unlinkedRoles;
4530    
4531            /**
4532             * The name of the URL encoder class of the portlet.
4533             */
4534            private String _urlEncoderClass;
4535    
4536            /**
4537             * <code>True</code> if the portlet uses the default template.
4538             */
4539            private boolean _useDefaultTemplate = true;
4540    
4541            /**
4542             * The the class loader resource path to the user notification definitions
4543             * of the portlet.
4544             */
4545            private String _userNotificationDefinitions;
4546    
4547            /**
4548             * The names of the classes that represents user notification handlers
4549             * associated with the portlet.
4550             */
4551            private List<String> _userNotificationHandlerClasses;
4552    
4553            /**
4554             * The user principal strategy of the portlet.
4555             */
4556            private String _userPrincipalStrategy =
4557                    PortletConstants.USER_PRINCIPAL_STRATEGY_USER_ID;
4558    
4559            /**
4560             * The virtual path of the portlet.
4561             */
4562            private String _virtualPath;
4563    
4564            /**
4565             * The name of the WebDAV storage class of the portlet.
4566             */
4567            private String _webDAVStorageClass;
4568    
4569            /**
4570             * The name of the WebDAV storage token of the portlet.
4571             */
4572            private String _webDAVStorageToken;
4573    
4574            /**
4575             * The window states of the portlet.
4576             */
4577            private Map<String, Set<String>> _windowStates;
4578    
4579            /**
4580             * The names of the classes that represents workflow handlers associated
4581             * with the portlet.
4582             */
4583            private List<String> _workflowHandlerClasses;
4584    
4585            /**
4586             * The name of the XML-RPC method class of the portlet.
4587             */
4588            private String _xmlRpcMethodClass;
4589    
4590            private static class Readiness {
4591    
4592                    private Readiness(
4593                            boolean ready, ServiceRegistrar<Portlet> serviceRegistrar) {
4594    
4595                            _ready = ready;
4596                            _serviceRegistrar = serviceRegistrar;
4597                    }
4598    
4599                    private volatile boolean _ready;
4600                    private ServiceRegistrar<Portlet> _serviceRegistrar;
4601    
4602            }
4603    
4604    }