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