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