1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portal.model.impl;
21  
22  import com.liferay.portal.kernel.job.Scheduler;
23  import com.liferay.portal.kernel.log.Log;
24  import com.liferay.portal.kernel.log.LogFactoryUtil;
25  import com.liferay.portal.kernel.plugin.PluginPackage;
26  import com.liferay.portal.kernel.pop.MessageListener;
27  import com.liferay.portal.kernel.portlet.ConfigurationAction;
28  import com.liferay.portal.kernel.portlet.FriendlyURLMapper;
29  import com.liferay.portal.kernel.portlet.PortletBag;
30  import com.liferay.portal.kernel.portlet.PortletBagPool;
31  import com.liferay.portal.kernel.portlet.PortletLayoutListener;
32  import com.liferay.portal.kernel.search.Indexer;
33  import com.liferay.portal.kernel.search.OpenSearch;
34  import com.liferay.portal.kernel.servlet.URLEncoder;
35  import com.liferay.portal.kernel.util.ContentTypes;
36  import com.liferay.portal.kernel.util.InstancePool;
37  import com.liferay.portal.kernel.util.StringPool;
38  import com.liferay.portal.kernel.util.StringUtil;
39  import com.liferay.portal.kernel.util.Validator;
40  import com.liferay.portal.lar.PortletDataHandler;
41  import com.liferay.portal.model.Plugin;
42  import com.liferay.portal.model.PluginSetting;
43  import com.liferay.portal.model.Portlet;
44  import com.liferay.portal.model.PortletApp;
45  import com.liferay.portal.model.PortletConstants;
46  import com.liferay.portal.model.PortletFilter;
47  import com.liferay.portal.model.PortletInfo;
48  import com.liferay.portal.model.PublicRenderParameter;
49  import com.liferay.portal.model.RoleConstants;
50  import com.liferay.portal.model.User;
51  import com.liferay.portal.service.RoleLocalServiceUtil;
52  import com.liferay.portal.service.UserLocalServiceUtil;
53  import com.liferay.portal.util.PortalUtil;
54  import com.liferay.portal.util.PropsValues;
55  import com.liferay.portal.util.QNameUtil;
56  import com.liferay.portlet.PortletBagImpl;
57  import com.liferay.portlet.social.model.SocialActivityInterpreter;
58  import com.liferay.portlet.social.model.SocialRequestInterpreter;
59  
60  import java.util.ArrayList;
61  import java.util.Arrays;
62  import java.util.HashMap;
63  import java.util.HashSet;
64  import java.util.Hashtable;
65  import java.util.Iterator;
66  import java.util.LinkedHashMap;
67  import java.util.List;
68  import java.util.Map;
69  import java.util.Set;
70  import java.util.TreeSet;
71  
72  import javax.portlet.PortletMode;
73  
74  import javax.xml.namespace.QName;
75  
76  /**
77   * <a href="PortletImpl.java.html"><b><i>View Source</i></b></a>
78   *
79   * @author Brian Wing Shun Chan
80   *
81   */
82  public class PortletImpl extends PortletModelImpl implements Portlet {
83  
84      /**
85       * Constructs a portlet with no parameters.
86       */
87      public PortletImpl() {
88      }
89  
90      /**
91       * Constructs a portlet with the specified parameters.
92       */
93      public PortletImpl(long companyId, String portletId) {
94          setCompanyId(companyId);
95          setPortletId(portletId);
96          setStrutsPath(portletId);
97          setActive(true);
98          _headerPortalCss = new ArrayList<String>();
99          _headerPortletCss = new ArrayList<String>();
100         _headerPortalJavaScript = new ArrayList<String>();
101         _headerPortletJavaScript = new ArrayList<String>();
102         _footerPortalCss = new ArrayList<String>();
103         _footerPortletCss = new ArrayList<String>();
104         _footerPortalJavaScript = new ArrayList<String>();
105         _footerPortletJavaScript = new ArrayList<String>();
106         _unlinkedRoles = new HashSet<String>();
107         _roleMappers = new LinkedHashMap<String, String>();
108         _initParams = new HashMap<String, String>();
109         _portletModes = new HashMap<String, Set<String>>();
110         _supportedLocales = new HashSet<String>();
111         _portletFilters = new LinkedHashMap<String, PortletFilter>();
112         _processingEvents = new HashSet<QName>();
113         _publishingEvents = new HashSet<QName>();
114         _publicRenderParameters = new HashSet<PublicRenderParameter>();
115     }
116 
117     /**
118      * Constructs a portlet with the specified parameters.
119      */
120     public PortletImpl(
121         String portletId, PluginPackage pluginPackage,
122         PluginSetting pluginSetting, long companyId, long timestamp,
123         String icon, String virtualPath, String strutsPath, String portletName,
124         String displayName, String portletClass,
125         String configurationActionClass, String indexerClass,
126         String openSearchClass, String schedulerClass, String portletURLClass,
127         String friendlyURLMapperClass, String urlEncoderClass,
128         String portletDataHandlerClass, String portletLayoutListenerClass,
129         String popMessageListenerClass, String socialActivityInterpreterClass,
130         String socialRequestInterpreterClass, String defaultPreferences,
131         String prefsValidator, boolean prefsCompanyWide,
132         boolean prefsUniquePerLayout, boolean prefsOwnedByGroup,
133         boolean useDefaultTemplate, boolean showPortletAccessDenied,
134         boolean showPortletInactive, boolean actionURLRedirect,
135         boolean restoreCurrentView, boolean maximizeEdit, boolean maximizeHelp,
136         boolean popUpPrint, boolean layoutCacheable, boolean instanceable,
137         String userPrincipalStrategy, boolean privateRequestAttributes,
138         boolean privateSessionAttributes, int renderWeight, boolean ajaxable,
139         List<String> headerPortalCss, List<String> headerPortletCss,
140         List<String> headerPortalJavaScript,
141         List<String> headerPortletJavaScript, List<String> footerPortalCss,
142         List<String> footerPortletCss, List<String> footerPortalJavaScript,
143         List<String> footerPortletJavaScript,
144         String cssClassWrapper, String facebookIntegration,
145         boolean addDefaultResource, String roles, Set<String> unlinkedRoles,
146         Map<String, String> roleMappers, boolean system, boolean active,
147         boolean include, Map<String, String> initParams, Integer expCache,
148         Map<String, Set<String>> portletModes, Set<String> supportedLocales,
149         String resourceBundle, PortletInfo portletInfo,
150         Map<String, PortletFilter> portletFilters, Set<QName> processingEvents,
151         Set<QName> publishingEvents,
152         Set<PublicRenderParameter> publicRenderParameters,
153         PortletApp portletApp) {
154 
155         setPortletId(portletId);
156         _pluginPackage = pluginPackage;
157         _defaultPluginSetting = pluginSetting;
158         setCompanyId(companyId);
159         _timestamp = timestamp;
160         _icon = icon;
161         _virtualPath = virtualPath;
162         _strutsPath = strutsPath;
163         _portletName = portletName;
164         _displayName = displayName;
165         _portletClass = portletClass;
166         _configurationActionClass = configurationActionClass;
167         _indexerClass = indexerClass;
168         _openSearchClass = openSearchClass;
169         _schedulerClass = schedulerClass;
170         _portletURLClass = portletURLClass;
171         _friendlyURLMapperClass = friendlyURLMapperClass;
172         _urlEncoderClass = urlEncoderClass;
173         _portletDataHandlerClass = portletDataHandlerClass;
174         _portletLayoutListenerClass = portletLayoutListenerClass;
175         _popMessageListenerClass = popMessageListenerClass;
176         _socialActivityInterpreterClass = socialActivityInterpreterClass;
177         _socialRequestInterpreterClass = socialRequestInterpreterClass;
178         _defaultPreferences = defaultPreferences;
179         _prefsValidator = prefsValidator;
180         _prefsCompanyWide = prefsCompanyWide;
181         _prefsUniquePerLayout = prefsUniquePerLayout;
182         _prefsOwnedByGroup = prefsOwnedByGroup;
183         _useDefaultTemplate = useDefaultTemplate;
184         _showPortletAccessDenied = showPortletAccessDenied;
185         _showPortletInactive = showPortletInactive;
186         _actionURLRedirect = actionURLRedirect;
187         _restoreCurrentView = restoreCurrentView;
188         _maximizeEdit = maximizeEdit;
189         _maximizeHelp = maximizeHelp;
190         _popUpPrint = popUpPrint;
191         _layoutCacheable = layoutCacheable;
192         _instanceable = instanceable;
193         _userPrincipalStrategy = userPrincipalStrategy;
194         _privateRequestAttributes = privateRequestAttributes;
195         _privateSessionAttributes = privateSessionAttributes;
196         _renderWeight = renderWeight;
197         _ajaxable = ajaxable;
198         _headerPortalCss = headerPortalCss;
199         _headerPortletCss = headerPortletCss;
200         _headerPortalJavaScript = headerPortalJavaScript;
201         _headerPortletJavaScript = headerPortletJavaScript;
202         _footerPortalCss = footerPortalCss;
203         _footerPortletCss = footerPortletCss;
204         _footerPortalJavaScript = footerPortalJavaScript;
205         _footerPortletJavaScript = footerPortletJavaScript;
206         _cssClassWrapper = cssClassWrapper;
207         _facebookIntegration = facebookIntegration;
208         _addDefaultResource = addDefaultResource;
209         setRoles(roles);
210         _unlinkedRoles = unlinkedRoles;
211         _roleMappers = roleMappers;
212         _system = system;
213         setActive(active);
214         _include = include;
215         _initParams = initParams;
216         _expCache = expCache;
217         _portletModes = portletModes;
218         _supportedLocales = supportedLocales;
219         _resourceBundle = resourceBundle;
220         _portletInfo = portletInfo;
221         _portletFilters = portletFilters;
222         setProcessingEvents(processingEvents);
223         setPublishingEvents(publishingEvents);
224         setPublicRenderParameters(publicRenderParameters);
225         _portletApp = portletApp;
226 
227         if (_instanceable) {
228             _clonedInstances = new Hashtable<String, Portlet>();
229         }
230     }
231 
232     /**
233      * Gets the root portlet id of the portlet.
234      *
235      * @return      the root portlet id of the portlet
236      */
237     public String getRootPortletId() {
238         return PortletConstants.getRootPortletId(getPortletId());
239     }
240 
241     /**
242      * Gets the instance id of the portlet.
243      *
244      * @return      the instance id of the portlet
245      */
246     public String getInstanceId() {
247         return PortletConstants.getInstanceId(getPortletId());
248     }
249 
250     /**
251      * Gets the plugin id of the portlet.
252      *
253      * @return      the plugin id of the portlet
254      */
255     public String getPluginId() {
256         return getRootPortletId();
257     }
258 
259     /**
260      * Gets the plugin type of the portlet.
261      *
262      * @return      the plugin type of the portlet
263      */
264     public String getPluginType() {
265         return Plugin.TYPE_PORTLET;
266     }
267 
268     /**
269      * Get the package to which the portlet belongs to.
270      *
271      * @return      the plugin package of the portlet
272      */
273     public PluginPackage getPluginPackage() {
274         return _pluginPackage;
275     }
276 
277     /**
278      * Sets the plugin package this portlet belongs to.
279      *
280      * @param       pluginPackage the plugin package
281      */
282     public void setPluginPackage(PluginPackage pluginPackage) {
283         _pluginPackage = pluginPackage;
284     }
285 
286     /**
287      * Get the default plugin settings of the portlet.
288      *
289      * @return      the plugin settings
290      */
291     public PluginSetting getDefaultPluginSetting() {
292         return _defaultPluginSetting;
293     }
294 
295     /**
296      * Sets the default plugin settings of the portlet.
297      *
298      * @param       pluginSetting the plugin setting
299      */
300     public void setDefaultPluginSetting(PluginSetting pluginSetting) {
301         _defaultPluginSetting = pluginSetting;
302     }
303 
304     /**
305      * Gets the timestamp of the portlet.
306      *
307      * @return      the timestamp of the portlet
308      */
309     public long getTimestamp() {
310         return _timestamp;
311     }
312 
313     /**
314      * Sets the timestamp of the portlet.
315      *
316      * @param       timestamp the timestamp of the portlet
317      */
318     public void setTimestamp(long timestamp) {
319         _timestamp = timestamp;
320     }
321 
322     /**
323      * Gets the icon of the portlet.
324      *
325      * @return      the icon of the portlet
326      */
327     public String getIcon() {
328         return _icon;
329     }
330 
331     /**
332      * Sets the icon of the portlet.
333      *
334      * @param       icon the icon of the portlet
335      */
336     public void setIcon(String icon) {
337         _icon = icon;
338     }
339 
340     /**
341      * Gets the virtual path of the portlet.
342      *
343      * @return      the virtual path of the portlet
344      */
345     public String getVirtualPath() {
346         return _virtualPath;
347     }
348 
349     /**
350      * Sets the virtual path of the portlet.
351      *
352      * @param       virtualPath the virtual path of the portlet
353      */
354     public void setVirtualPath(String virtualPath) {
355         if (_portletApp.isWARFile() && Validator.isNull(virtualPath)) {
356             virtualPath = PropsValues.PORTLET_VIRTUAL_PATH;
357         }
358 
359         _virtualPath = virtualPath;
360     }
361 
362     /**
363      * Gets the struts path of the portlet.
364      *
365      * @return      the struts path of the portlet
366      */
367     public String getStrutsPath() {
368         return _strutsPath;
369     }
370 
371     /**
372      * Sets the struts path of the portlet.
373      *
374      * @param       strutsPath the struts path of the portlet
375      */
376     public void setStrutsPath(String strutsPath) {
377         _strutsPath = strutsPath;
378     }
379 
380     /**
381      * Gets the name of the portlet.
382      *
383      * @return      the display name of the portlet
384      */
385     public String getPortletName() {
386         return _portletName;
387     }
388 
389     /**
390      * Sets the name of the portlet.
391      *
392      * @param       portletName the name of the portlet
393      */
394     public void setPortletName(String portletName) {
395         _portletName = portletName;
396     }
397 
398     /**
399      * Gets the display name of the portlet.
400      *
401      * @return      the display name of the portlet
402      */
403     public String getDisplayName() {
404         return _displayName;
405     }
406 
407     /**
408      * Sets the display name of the portlet.
409      *
410      * @param       displayName the display name of the portlet
411      */
412     public void setDisplayName(String displayName) {
413         _displayName = displayName;
414     }
415 
416     /**
417      * Gets the name of the portlet class of the portlet.
418      *
419      * @return      the name of the portlet class of the portlet
420      */
421     public String getPortletClass() {
422         return _portletClass;
423     }
424 
425     /**
426      * Sets the name of the portlet class of the portlet.
427      *
428      * @param       portletClass the name of the portlet class of the portlet
429      */
430     public void setPortletClass(String portletClass) {
431         _portletClass = portletClass;
432     }
433 
434     /**
435      * Gets the configuration action class of the portlet.
436      *
437      * @return      the configuration action class of the portlet
438      */
439     public String getConfigurationActionClass() {
440         return _configurationActionClass;
441     }
442 
443     /**
444      * Sets the configuration action class of the portlet.
445      *
446      * @param       configurationActionClass the configuration action class of
447      *              the portlet
448      */
449     public void setConfigurationActionClass(String configurationActionClass) {
450         _configurationActionClass = configurationActionClass;
451     }
452 
453     /**
454      * Gets the configuration action instance of the portlet.
455      *
456      * @return      the configuration action instance of the portlet
457      */
458     public ConfigurationAction getConfigurationActionInstance() {
459         if (Validator.isNotNull(getConfigurationActionClass())) {
460             if (_portletApp.isWARFile()) {
461                 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
462 
463                 return portletBag.getConfigurationActionInstance();
464             }
465             else {
466                 return (ConfigurationAction)InstancePool.get(
467                     getConfigurationActionClass());
468             }
469         }
470 
471         return null;
472     }
473 
474     /**
475      * Gets the name of the indexer class of the portlet.
476      *
477      * @return      the name of the indexer class of the portlet
478      */
479     public String getIndexerClass() {
480         return _indexerClass;
481     }
482 
483     /**
484      * Sets the name of the indexer class of the portlet.
485      *
486      * @param       indexerClass the name of the indexer class of the portlet
487      */
488     public void setIndexerClass(String indexerClass) {
489         _indexerClass = indexerClass;
490     }
491 
492     /**
493      * Gets the indexer instance of the portlet.
494      *
495      * @return      the indexer instance of the portlet
496      */
497     public Indexer getIndexerInstance() {
498         if (Validator.isNotNull(getIndexerClass())) {
499             if (_portletApp.isWARFile()) {
500                 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
501 
502                 return portletBag.getIndexerInstance();
503             }
504             else {
505                 return (Indexer)InstancePool.get(getIndexerClass());
506             }
507         }
508 
509         return null;
510     }
511 
512     /**
513      * Gets the name of the open search class of the portlet.
514      *
515      * @return      the name of the open search class of the portlet
516      */
517     public String getOpenSearchClass() {
518         return _openSearchClass;
519     }
520 
521     /**
522      * Sets the name of the open search class of the portlet.
523      *
524      * @param       openSearchClass the name of the open search class of the
525      *              portlet
526      */
527     public void setOpenSearchClass(String openSearchClass) {
528         _openSearchClass = openSearchClass;
529     }
530 
531     /**
532      * Gets the indexer instance of the portlet.
533      *
534      * @return      the indexer instance of the portlet
535      */
536     public OpenSearch getOpenSearchInstance() {
537         if (Validator.isNull(getOpenSearchClass())) {
538             return null;
539         }
540 
541         if (_portletApp.isWARFile()) {
542             PortletBag portletBag = PortletBagPool.get(getRootPortletId());
543 
544             return portletBag.getOpenSearchInstance();
545         }
546 
547         return (OpenSearch)InstancePool.get(getOpenSearchClass());
548     }
549 
550     /**
551      * Gets the name of the scheduler class of the portlet.
552      *
553      * @return      the name of the scheduler class of the portlet
554      */
555     public String getSchedulerClass() {
556         return _schedulerClass;
557     }
558 
559     /**
560      * Sets the name of the scheduler class of the portlet.
561      *
562      * @param       schedulerClass the name of the scheduler class of the
563      *              portlet
564      */
565     public void setSchedulerClass(String schedulerClass) {
566         _schedulerClass = schedulerClass;
567     }
568 
569     /**
570      * Gets the scheduler instance of the portlet.
571      *
572      * @return      the scheduler instance of the portlet
573      */
574     public Scheduler getSchedulerInstance() {
575         if (Validator.isNotNull(getSchedulerClass())) {
576             if (_portletApp.isWARFile()) {
577                 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
578 
579                 return portletBag.getSchedulerInstance();
580             }
581             else {
582                 return (Scheduler)InstancePool.get(getSchedulerClass());
583             }
584         }
585 
586         return null;
587     }
588 
589     /**
590      * Gets the name of the portlet URL class of the portlet.
591      *
592      * @return      the name of the portlet URL class of the portlet
593      */
594     public String getPortletURLClass() {
595         return _portletURLClass;
596     }
597 
598     /**
599      * Sets the name of the portlet URL class of the portlet.
600      *
601      * @param       portletURLClass the name of the portlet URL class of the
602      *              portlet
603      */
604     public void setPortletURLClass(String portletURLClass) {
605         _portletURLClass = portletURLClass;
606     }
607 
608     /**
609      * Gets the name of the friendly URL mapper class of the portlet.
610      *
611      * @return      the name of the friendly URL mapper class of the portlet
612      */
613     public String getFriendlyURLMapperClass() {
614         return _friendlyURLMapperClass;
615     }
616 
617     /**
618      * Sets the name of the friendly URL mapper class of the portlet.
619      *
620      * @param       friendlyURLMapperClass the name of the friendly URL plugin
621      *              class of the portlet
622      */
623     public void setFriendlyURLMapperClass(String friendlyURLMapperClass) {
624         _friendlyURLMapperClass = friendlyURLMapperClass;
625     }
626 
627     /**
628      * Gets the friendly URL mapper instance of the portlet.
629      *
630      * @return      the friendly URL mapper instance of the portlet
631      */
632     public FriendlyURLMapper getFriendlyURLMapperInstance() {
633         if (Validator.isNotNull(getFriendlyURLMapperClass())) {
634             if (_portletApp.isWARFile()) {
635                 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
636 
637                 return portletBag.getFriendlyURLMapperInstance();
638             }
639             else {
640                 return (FriendlyURLMapper)InstancePool.get(
641                     getFriendlyURLMapperClass());
642             }
643         }
644 
645         return null;
646     }
647 
648     /**
649      * Gets the name of the URL encoder class of the portlet.
650      *
651      * @return      the name of the URL encoder class of the portlet
652      */
653     public String getURLEncoderClass() {
654         return _urlEncoderClass;
655     }
656 
657     /**
658      * Sets the name of the URL encoder class of the portlet.
659      *
660      * @param       urlEncoderClass the name of the URL encoder class of the
661      *              portlet
662      */
663     public void setURLEncoderClass(String urlEncoderClass) {
664         _urlEncoderClass = urlEncoderClass;
665     }
666 
667     /**
668      * Gets the URL encoder instance of the portlet.
669      *
670      * @return      the URL encoder instance of the portlet
671      */
672     public URLEncoder getURLEncoderInstance() {
673         if (Validator.isNotNull(getURLEncoderClass())) {
674             if (_portletApp.isWARFile()) {
675                 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
676 
677                 return portletBag.getURLEncoderInstance();
678             }
679             else {
680                 return (URLEncoder)InstancePool.get(getURLEncoderClass());
681             }
682         }
683 
684         return null;
685     }
686 
687     /**
688      * Gets the name of the portlet data handler class of the portlet.
689      *
690      * @return      the name of the portlet data handler class of the portlet
691      */
692     public String getPortletDataHandlerClass() {
693         return _portletDataHandlerClass;
694     }
695 
696     /**
697      * Sets the name of the portlet data handler class of the portlet.
698      *
699      * @param       portletDataHandlerClass the name of portlet data handler
700      *              class of the portlet
701      */
702     public void setPortletDataHandlerClass(String portletDataHandlerClass) {
703         _portletDataHandlerClass = portletDataHandlerClass;
704     }
705 
706     /**
707      * Gets the portlet data handler instance of the portlet.
708      *
709      * @return      the portlet data handler instance of the portlet
710      */
711     public PortletDataHandler getPortletDataHandlerInstance() {
712         if (Validator.isNotNull(getPortletDataHandlerClass())) {
713             if (_portletApp.isWARFile()) {
714                 PortletBagImpl portletBagImpl =
715                     (PortletBagImpl)PortletBagPool.get(getRootPortletId());
716 
717                 return portletBagImpl.getPortletDataHandlerInstance();
718             }
719             else {
720                 return (PortletDataHandler)InstancePool.get(
721                     getPortletDataHandlerClass());
722             }
723         }
724 
725         return null;
726     }
727 
728     /**
729      * Gets the portlet layout listener of the portlet.
730      *
731      * @return      the name of the portlet layout listener class of the portlet
732      */
733     public PortletLayoutListener getPortletLayoutListener() {
734         if (Validator.isNull(getPortletLayoutListenerClass())) {
735             return null;
736         }
737 
738         return (PortletLayoutListener)InstancePool.get(
739             getPortletLayoutListenerClass());
740     }
741 
742     /**
743      * Gets the name of the portlet layout listener class of the portlet.
744      *
745      * @return      the name of the portlet layout listener class of the portlet
746      */
747     public String getPortletLayoutListenerClass() {
748         return _portletLayoutListenerClass;
749     }
750 
751     /**
752      * Sets the name of the portlet layout listener class of the portlet.
753      *
754      * @param       portletLayoutListenerClass the name of the portlet layout
755      *              listener class of the portlet
756      */
757     public void setPortletLayoutListenerClass(
758         String portletLayoutListenerClass) {
759 
760         _portletLayoutListenerClass = portletLayoutListenerClass;
761     }
762 
763     /**
764      * Gets the name of the POP message listener class of the portlet.
765      *
766      * @return      the name of the POP message listener class of the portlet
767      */
768     public String getPopMessageListenerClass() {
769         return _popMessageListenerClass;
770     }
771 
772     /**
773      * Sets the name of the POP message listener class of the portlet.
774      *
775      * @param       popMessageListenerClass the name of the POP message listener
776      *              class of the portlet
777      */
778     public void setPopMessageListenerClass(String popMessageListenerClass) {
779         _popMessageListenerClass = popMessageListenerClass;
780     }
781 
782     /**
783      * Gets the POP message listener instance of the portlet.
784      *
785      * @return      the POP message listener instance of the portlet
786      */
787     public MessageListener getPopMessageListenerInstance() {
788         if (Validator.isNotNull(getPopMessageListenerClass())) {
789             if (_portletApp.isWARFile()) {
790                 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
791 
792                 return portletBag.getPopMessageListenerInstance();
793             }
794             else {
795                 return (MessageListener)InstancePool.get(
796                     getPopMessageListenerClass());
797             }
798         }
799 
800         return null;
801     }
802 
803     /**
804      * Gets the name of the social activity interpreter class of the portlet.
805      *
806      * @return      the name of the social activity interpreter class of the
807      *              portlet
808      */
809     public String getSocialActivityInterpreterClass() {
810         return _socialActivityInterpreterClass;
811     }
812 
813     /**
814      * Sets the name of the social activity interpreter class of the portlet.
815      *
816      * @param       socialActivityInterpreterClass the name of the activity
817      *              interpreter class of the portlet
818      */
819     public void setSocialActivityInterpreterClass(
820         String socialActivityInterpreterClass) {
821 
822         _socialActivityInterpreterClass = socialActivityInterpreterClass;
823     }
824 
825     /**
826      * Gets the name of the social activity interpreter instance of the portlet.
827      *
828      * @return      the name of the social activity interpreter instance of the
829      *              portlet
830      */
831     public SocialActivityInterpreter getSocialActivityInterpreterInstance() {
832         if (Validator.isNotNull(getSocialActivityInterpreterClass())) {
833             if (_portletApp.isWARFile()) {
834                 PortletBagImpl portletBagImpl =
835                     (PortletBagImpl)PortletBagPool.get(getRootPortletId());
836 
837                 return portletBagImpl.getSocialActivityInterpreterInstance();
838             }
839             else {
840                 return (SocialActivityInterpreter)InstancePool.get(
841                     getSocialActivityInterpreterClass());
842             }
843         }
844 
845         return null;
846     }
847 
848     /**
849      * Gets the name of the social request interpreter class of the portlet.
850      *
851      * @return      the name of the social request interpreter class of the
852      *              portlet
853      */
854     public String getSocialRequestInterpreterClass() {
855         return _socialRequestInterpreterClass;
856     }
857 
858     /**
859      * Sets the name of the social request interpreter class of the portlet.
860      *
861      * @param       socialRequestInterpreterClass the name of the request
862      *              interpreter class of the portlet
863      */
864     public void setSocialRequestInterpreterClass(
865         String socialRequestInterpreterClass) {
866 
867         _socialRequestInterpreterClass = socialRequestInterpreterClass;
868     }
869 
870     /**
871      * Gets the name of the social request interpreter instance of the portlet.
872      *
873      * @return      the name of the social request interpreter instance of the
874      *              portlet
875      */
876     public SocialRequestInterpreter getSocialRequestInterpreterInstance() {
877         if (Validator.isNotNull(getSocialRequestInterpreterClass())) {
878             if (_portletApp.isWARFile()) {
879                 PortletBagImpl portletBag =
880                     (PortletBagImpl)PortletBagPool.get(getRootPortletId());
881 
882                 return portletBag.getSocialRequestInterpreterInstance();
883             }
884             else {
885                 return (SocialRequestInterpreter)InstancePool.get(
886                     getSocialRequestInterpreterClass());
887             }
888         }
889 
890         return null;
891     }
892 
893     /**
894      * Gets the default preferences of the portlet.
895      *
896      * @return      the default preferences of the portlet
897      */
898     public String getDefaultPreferences() {
899         if (Validator.isNull(_defaultPreferences)) {
900             return PortletConstants.DEFAULT_PREFERENCES;
901         }
902         else {
903             return _defaultPreferences;
904         }
905     }
906 
907     /**
908      * Sets the default preferences of the portlet.
909      *
910      * @param       defaultPreferences the default preferences of the portlet
911      */
912     public void setDefaultPreferences(String defaultPreferences) {
913         _defaultPreferences = defaultPreferences;
914     }
915 
916     /**
917      * Gets the name of the preferences validator class of the portlet.
918      *
919      * @return      the name of the preferences validator class of the portlet
920      */
921     public String getPreferencesValidator() {
922         return _prefsValidator;
923     }
924 
925     /**
926      * Sets the name of the preferences validator class of the portlet.
927      *
928      * @param       prefsValidator the name of the preferences validator class
929      *              of the portlet
930      */
931     public void setPreferencesValidator(String prefsValidator) {
932         if (prefsValidator != null) {
933 
934             // Trim this because XDoclet generates preferences validators with
935             // extra white spaces
936 
937             _prefsValidator = prefsValidator.trim();
938         }
939         else {
940             _prefsValidator = null;
941         }
942     }
943 
944     /**
945      * Returns true if preferences are shared across the entire company.
946      *
947      * @return      true if preferences are shared across the entire company
948      */
949     public boolean getPreferencesCompanyWide() {
950         return _prefsCompanyWide;
951     }
952 
953     /**
954      * Returns true if preferences are shared across the entire company.
955      *
956      * @return      true if preferences are shared across the entire company
957      */
958     public boolean isPreferencesCompanyWide() {
959         return _prefsCompanyWide;
960     }
961 
962     /**
963      * Sets to true if preferences are shared across the entire company.
964      *
965      * @param       prefsCompanyWide boolean value for whether preferences
966      *              are shared across the entire company
967      */
968     public void setPreferencesCompanyWide(boolean prefsCompanyWide) {
969         _prefsCompanyWide = prefsCompanyWide;
970     }
971 
972     /**
973      * Returns true if preferences are unique per layout.
974      *
975      * @return      true if preferences are unique per layout
976      */
977     public boolean getPreferencesUniquePerLayout() {
978         return _prefsUniquePerLayout;
979     }
980 
981     /**
982      * Returns true if preferences are unique per layout.
983      *
984      * @return      true if preferences are unique per layout
985      */
986     public boolean isPreferencesUniquePerLayout() {
987         return _prefsUniquePerLayout;
988     }
989 
990     /**
991      * Sets to true if preferences are unique per layout.
992      *
993      * @param       prefsUniquePerLayout boolean value for whether preferences
994      *              are unique per layout
995      */
996     public void setPreferencesUniquePerLayout(boolean prefsUniquePerLayout) {
997         _prefsUniquePerLayout = prefsUniquePerLayout;
998     }
999 
1000    /**
1001     * Returns true if preferences are owned by the group when the portlet is
1002     * shown in a group layout. Returns false if preferences are owned by the
1003     * user at all times.
1004     *
1005     * @return      true if preferences are owned by the group when the portlet
1006     *              is shown in a group layout; false if preferences are owned
1007     *              by the user at all times.
1008     */
1009    public boolean getPreferencesOwnedByGroup() {
1010        return _prefsOwnedByGroup;
1011    }
1012
1013    /**
1014     * Returns true if preferences are owned by the group when the portlet is
1015     * shown in a group layout. Returns false if preferences are owned by the
1016     * user at all times.
1017     *
1018     * @return      true if preferences are owned by the group when the portlet
1019     *              is shown in a group layout; false if preferences are owned
1020     *              by the user at all times.
1021     */
1022    public boolean isPreferencesOwnedByGroup() {
1023        return _prefsOwnedByGroup;
1024    }
1025
1026    /**
1027     * Sets to true if preferences are owned by the group when the portlet is
1028     * shown in a group layout. Sets to false if preferences are owned by the
1029     * user at all times.
1030     *
1031     * @param       prefsOwnedByGroup boolean value for whether preferences are
1032     *              owned by the group when the portlet is shown in a group
1033     *              layout or preferences are owned by the user at all times
1034     */
1035    public void setPreferencesOwnedByGroup(boolean prefsOwnedByGroup) {
1036        _prefsOwnedByGroup = prefsOwnedByGroup;
1037    }
1038
1039    /**
1040     * Returns true if the portlet uses the default template.
1041     *
1042     * @return      true if the portlet uses the default template
1043     */
1044    public boolean getUseDefaultTemplate() {
1045        return _useDefaultTemplate;
1046    }
1047
1048    /**
1049     * Returns true if the portlet uses the default template.
1050     *
1051     * @return      true if the portlet uses the default template
1052     */
1053    public boolean isUseDefaultTemplate() {
1054        return _useDefaultTemplate;
1055    }
1056
1057    /**
1058     * Sets to true if the portlet uses the default template.
1059     *
1060     * @param       useDefaultTemplate boolean value for whether the portlet
1061     *              uses the default template
1062     */
1063    public void setUseDefaultTemplate(boolean useDefaultTemplate) {
1064        _useDefaultTemplate = useDefaultTemplate;
1065    }
1066
1067    /**
1068     * Returns true if users are shown that they do not have access to the
1069     * portlet.
1070     *
1071     * @return      true if users are shown that they do not have access to the
1072     *              portlet
1073     */
1074    public boolean getShowPortletAccessDenied() {
1075        return _showPortletAccessDenied;
1076    }
1077
1078    /**
1079     * Returns true if users are shown that they do not have access to the
1080     * portlet.
1081     *
1082     * @return      true if users are shown that they do not have access to the
1083     *              portlet
1084     */
1085    public boolean isShowPortletAccessDenied() {
1086        return _showPortletAccessDenied;
1087    }
1088
1089    /**
1090     * Sets to true if users are shown that they do not have access to the
1091     * portlet.
1092     *
1093     * @param       showPortletAccessDenied boolean value for whether users are
1094     *              shown that they do not have access to the portlet
1095     */
1096    public void setShowPortletAccessDenied(boolean showPortletAccessDenied) {
1097        _showPortletAccessDenied = showPortletAccessDenied;
1098    }
1099
1100    /**
1101     * Returns true if users are shown that the portlet is inactive.
1102     *
1103     * @return      true if users are shown that the portlet is inactive
1104     */
1105    public boolean getShowPortletInactive() {
1106        return _showPortletInactive;
1107    }
1108
1109    /**
1110     * Returns true if users are shown that the portlet is inactive.
1111     *
1112     * @return      true if users are shown that the portlet is inactive
1113     */
1114    public boolean isShowPortletInactive() {
1115        return _showPortletInactive;
1116    }
1117
1118    /**
1119     * Sets to true if users are shown that the portlet is inactive.
1120     *
1121     * @param       showPortletInactive boolean value for whether users are
1122     *              shown that the portlet is inactive
1123     */
1124    public void setShowPortletInactive(boolean showPortletInactive) {
1125        _showPortletInactive = showPortletInactive;
1126    }
1127
1128    /**
1129     * Returns true if an action URL for this portlet should cause an auto
1130     * redirect.
1131     *
1132     * @return      true if an action URL for this portlet should cause an auto
1133     *              redirect
1134     */
1135    public boolean getActionURLRedirect() {
1136        return _actionURLRedirect;
1137    }
1138
1139    /**
1140     * Returns true if an action URL for this portlet should cause an auto
1141     * redirect.
1142     *
1143     * @return      true if an action URL for this portlet should cause an auto
1144     *              redirect
1145     */
1146    public boolean isActionURLRedirect() {
1147        return _actionURLRedirect;
1148    }
1149
1150    /**
1151     * Sets to true if an action URL for this portlet should cause an auto
1152     * redirect.
1153     *
1154     * @param       actionURLRedirect boolean value for whether an action URL
1155     *              for this portlet should cause an auto redirect
1156     */
1157    public void setActionURLRedirect(boolean actionURLRedirect) {
1158        _actionURLRedirect = actionURLRedirect;
1159    }
1160
1161    /**
1162     * Returns true if the portlet restores to the current view from the
1163     * maximized state.
1164     *
1165     * @return      true if the portlet restores to the current view from the
1166     *              maximized state
1167     */
1168    public boolean getRestoreCurrentView() {
1169        return _restoreCurrentView;
1170    }
1171
1172    /**
1173     * Returns true if the portlet restores to the current view from the
1174     * maximized state.
1175     *
1176     * @return      true if the portlet restores to the current view from the
1177     *              maximized state
1178     */
1179    public boolean isRestoreCurrentView() {
1180        return _restoreCurrentView;
1181    }
1182
1183    /**
1184     * Sets to true if the portlet restores to the current view from the
1185     * maximized state.
1186     *
1187     * @param       restoreCurrentView boolean value for whether the portlet
1188     *              restores to the current view from the maximized state
1189     */
1190    public void setRestoreCurrentView(boolean restoreCurrentView) {
1191        _restoreCurrentView = restoreCurrentView;
1192    }
1193
1194    /**
1195     * Returns true if the portlet goes into the maximized state when the user
1196     * goes into the edit mode.
1197     *
1198     * @return      true if the portlet goes into the maximized state when the
1199     *              user goes into the edit mode
1200     */
1201    public boolean getMaximizeEdit() {
1202        return _maximizeEdit;
1203    }
1204
1205    /**
1206     * Returns true if the portlet goes into the maximized state when the user
1207     * goes into the edit mode.
1208     *
1209     * @return      true if the portlet goes into the maximized state when the
1210     *              user goes into the edit mode
1211     */
1212    public boolean isMaximizeEdit() {
1213        return _maximizeEdit;
1214    }
1215
1216    /**
1217     * Sets to true if the portlet goes into the maximized state when the user
1218     * goes into the edit mode.
1219     *
1220     * @param       maximizeEdit boolean value for whether the portlet goes into
1221     *              the maximized state when the user goes into the edit mode
1222     */
1223    public void setMaximizeEdit(boolean maximizeEdit) {
1224        _maximizeEdit = maximizeEdit;
1225    }
1226
1227    /**
1228     * Returns true if the portlet goes into the maximized state when the user
1229     * goes into the help mode.
1230     *
1231     * @return      true if the portlet goes into the maximized state when the
1232     *              user goes into the help mode
1233     */
1234    public boolean getMaximizeHelp() {
1235        return _maximizeHelp;
1236    }
1237
1238    /**
1239     * Returns true if the portlet goes into the maximized state when the user
1240     * goes into the help mode.
1241     *
1242     * @return      true if the portlet goes into the maximized state when the
1243     *              user goes into the help mode
1244     */
1245    public boolean isMaximizeHelp() {
1246        return _maximizeHelp;
1247    }
1248
1249    /**
1250     * Sets to true if the portlet goes into the maximized state when the user
1251     * goes into the help mode.
1252     *
1253     * @param       maximizeHelp boolean value for whether the portlet goes into
1254     *              the maximized state when the user goes into the help mode
1255     */
1256    public void setMaximizeHelp(boolean maximizeHelp) {
1257        _maximizeHelp = maximizeHelp;
1258    }
1259
1260    /**
1261     * Returns true if the portlet goes into the pop up state when the user goes
1262     * into the print mode.
1263     *
1264     * @return      true if the portlet goes into the pop up state when the user
1265     *              goes into the print mode
1266     */
1267    public boolean getPopUpPrint() {
1268        return _popUpPrint;
1269    }
1270
1271    /**
1272     * Returns true if the portlet goes into the pop up state when the user goes
1273     * into the print mode.
1274     *
1275     * @return      true if the portlet goes into the pop up state when the user
1276     *              goes into the print mode
1277     */
1278    public boolean isPopUpPrint() {
1279        return _popUpPrint;
1280    }
1281
1282    /**
1283     * Sets to true if the portlet goes into the pop up state when the user goes
1284     * into the print mode.
1285     *
1286     * @param       popUpPrint boolean value for whether the portlet goes into
1287     *              the pop up state when the user goes into the print mode
1288     */
1289    public void setPopUpPrint(boolean popUpPrint) {
1290        _popUpPrint = popUpPrint;
1291    }
1292
1293    /**
1294     * Returns true to allow the portlet to be cached within the layout.
1295     *
1296     * @return      true if the portlet can be cached within the layout
1297     */
1298    public boolean getLayoutCacheable() {
1299        return _layoutCacheable;
1300    }
1301
1302    /**
1303     * Returns true to allow the portlet to be cached within the layout.
1304     *
1305     * @return      true if the portlet can be cached within the layout
1306     */
1307    public boolean isLayoutCacheable() {
1308        return _layoutCacheable;
1309    }
1310
1311    /**
1312     * Sets to true to allow the portlet to be cached within the layout.
1313     *
1314     * @param   layoutCacheable boolean value for whether the portlet can be
1315     *          cached within the layout
1316     */
1317    public void setLayoutCacheable(boolean layoutCacheable) {
1318        _layoutCacheable = layoutCacheable;
1319    }
1320
1321    /**
1322     * Returns true if the portlet can be added multiple times to a layout.
1323     *
1324     * @return      true if the portlet can be added multiple times to a layout
1325     */
1326    public boolean getInstanceable() {
1327        return _instanceable;
1328    }
1329
1330    /**
1331     * Returns true if the portlet can be added multiple times to a layout.
1332     *
1333     * @return      true if the portlet can be added multiple times to a layout
1334     */
1335    public boolean isInstanceable() {
1336        return _instanceable;
1337    }
1338
1339    /**
1340     * Sets to true if the portlet can be added multiple times to a layout.
1341     *
1342     * @param       instanceable boolean value for whether the portlet can be
1343     *              added multiple times to a layout
1344     */
1345    public void setInstanceable(boolean instanceable) {
1346        _instanceable = instanceable;
1347    }
1348
1349    /**
1350     * Gets the user principal strategy of the portlet.
1351     *
1352     * @return      the user principal strategy of the portlet
1353     */
1354    public String getUserPrincipalStrategy() {
1355        return _userPrincipalStrategy;
1356    }
1357
1358    /**
1359     * Sets the user principal strategy of the portlet.
1360     *
1361     * @param       userPrincipalStrategy the user principal strategy of the
1362     *              portlet
1363     */
1364    public void setUserPrincipalStrategy(String userPrincipalStrategy) {
1365        if (Validator.isNotNull(userPrincipalStrategy)) {
1366            _userPrincipalStrategy = userPrincipalStrategy;
1367        }
1368    }
1369
1370    /**
1371     * Returns true if the portlet does not share request attributes with the
1372     * portal or portlets from another WAR.
1373     *
1374     * @return      true if the portlet does not share request attributes with
1375     *              the portal or portlets from another WAR
1376     */
1377    public boolean getPrivateRequestAttributes() {
1378        return _privateRequestAttributes;
1379    }
1380
1381    /**
1382     * Returns true if the portlet does not share request attributes with the
1383     * portal or portlets from another WAR.
1384     *
1385     * @return      true if the portlet does not share request attributes with
1386     *              the portal or portlets from another WAR
1387     */
1388    public boolean isPrivateRequestAttributes() {
1389        return _privateRequestAttributes;
1390    }
1391
1392    /**
1393     * Sets to true if the portlet does not share request attributes with the
1394     * portal or portlets from another WAR.
1395     *
1396     * @param       privateRequestAttributes boolean value for whether the
1397     *              portlet shares request attributes with the portal or
1398     *              portlets from another WAR
1399     */
1400    public void setPrivateRequestAttributes(boolean privateRequestAttributes) {
1401        _privateRequestAttributes = privateRequestAttributes;
1402    }
1403
1404    /**
1405     * Returns true if the portlet does not share session attributes with the
1406     * portal.
1407     *
1408     * @return      true if the portlet does not share session attributes with
1409     *              the portal
1410     */
1411    public boolean getPrivateSessionAttributes() {
1412        return _privateSessionAttributes;
1413    }
1414
1415    /**
1416     * Returns true if the portlet does not share session attributes with the
1417     * portal.
1418     *
1419     * @return      true if the portlet does not share session attributes with
1420     *              the portal
1421     */
1422    public boolean isPrivateSessionAttributes() {
1423        return _privateSessionAttributes;
1424    }
1425
1426    /**
1427     * Sets to true if the portlet does not share session attributes with the
1428     * portal.
1429     *
1430     * @param       privateSessionAttributes boolean value for whether the
1431     *              portlet shares session attributes with the portal
1432     */
1433    public void setPrivateSessionAttributes(boolean privateSessionAttributes) {
1434        _privateSessionAttributes = privateSessionAttributes;
1435    }
1436
1437    /**
1438     * Returns the render weight of the portlet.
1439     *
1440     * @return      the render weight of the portlet
1441     */
1442    public int getRenderWeight() {
1443        return _renderWeight;
1444    }
1445
1446    /**
1447     * Sets the render weight of the portlet.
1448     *
1449     * @param       renderWeight int value for the render weight of the portlet
1450     */
1451    public void setRenderWeight(int renderWeight) {
1452        _renderWeight = renderWeight;
1453    }
1454
1455    /**
1456     * Returns true if the portlet can be displayed via Ajax.
1457     *
1458     * @return      true if the portlet can be displayed via Ajax
1459     */
1460    public boolean getAjaxable() {
1461        return _ajaxable;
1462    }
1463
1464    /**
1465     * Returns true if the portlet can be displayed via Ajax.
1466     *
1467     * @return      true if the portlet can be displayed via Ajax
1468     */
1469    public boolean isAjaxable() {
1470        return _ajaxable;
1471    }
1472
1473    /**
1474     * Sets to true if the portlet can be displayed via Ajax.
1475     *
1476     * @param       ajaxable boolean value for whether the portlet can be
1477     *              displayed via Ajax
1478     */
1479    public void setAjaxable(boolean ajaxable) {
1480        _ajaxable = ajaxable;
1481    }
1482
1483    /**
1484     * Gets a list of CSS files that will be referenced from the page's header
1485     * relative to the portal's context path.
1486     *
1487     * @return      a list of CSS files that will be referenced from the page's
1488     *              header relative to the portal's context path
1489     */
1490    public List<String> getHeaderPortalCss() {
1491        return _headerPortalCss;
1492    }
1493
1494    /**
1495     * Sets a list of CSS files that will be referenced from the page's header
1496     * relative to the portal's context path.
1497     *
1498     * @param       headerPortalCss a list of CSS files that will be referenced
1499     *              from the page's header relative to the portal's context path
1500     */
1501    public void setHeaderPortalCss(List<String> headerPortalCss) {
1502        _headerPortalCss = headerPortalCss;
1503    }
1504
1505    /**
1506     * Gets a list of CSS files that will be referenced from the page's header
1507     * relative to the portlet's context path.
1508     *
1509     * @return      a list of CSS files that will be referenced from the page's
1510     *              header relative to the portlet's context path
1511     */
1512    public List<String> getHeaderPortletCss() {
1513        return _headerPortletCss;
1514    }
1515
1516    /**
1517     * Sets a list of CSS files that will be referenced from the page's header
1518     * relative to the portlet's context path.
1519     *
1520     * @param       headerPortletCss a list of CSS files that will be referenced
1521     *              from the page's header relative to the portlet's context
1522     *              path
1523     */
1524    public void setHeaderPortletCss(List<String> headerPortletCss) {
1525        _headerPortletCss = headerPortletCss;
1526    }
1527
1528    /**
1529     * Gets a list of JavaScript files that will be referenced from the page's
1530     * header relative to the portal's context path.
1531     *
1532     * @return      a list of JavaScript files that will be referenced from the
1533     *              page's header relative to the portal's context path
1534     */
1535    public List<String> getHeaderPortalJavaScript() {
1536        return _headerPortalJavaScript;
1537    }
1538
1539    /**
1540     * Sets a list of JavaScript files that will be referenced from the page's
1541     * header relative to the portal's context path.
1542     *
1543     * @param       headerPortalJavaScript a list of JavaScript files that will
1544     *              be referenced from the page's header relative to the
1545     *              portal's context path
1546     */
1547    public void setHeaderPortalJavaScript(List<String> headerPortalJavaScript) {
1548        _headerPortalJavaScript = headerPortalJavaScript;
1549    }
1550
1551    /**
1552     * Gets a list of JavaScript files that will be referenced from the page's
1553     * header relative to the portlet's context path.
1554     *
1555     * @return      a list of JavaScript files that will be referenced from the
1556     *              page's header relative to the portlet's context path
1557     */
1558    public List<String> getHeaderPortletJavaScript() {
1559        return _headerPortletJavaScript;
1560    }
1561
1562    /**
1563     * Sets a list of JavaScript files that will be referenced from the page's
1564     * header relative to the portlet's context path.
1565     *
1566     * @param       headerPortletJavaScript a list of JavaScript files that will
1567     *              be referenced from the page's header relative to the
1568     *              portlet's context path
1569     */
1570    public void setHeaderPortletJavaScript(
1571        List<String> headerPortletJavaScript) {
1572
1573        _headerPortletJavaScript = headerPortletJavaScript;
1574    }
1575
1576    /**
1577     * Gets a list of CSS files that will be referenced from the page's footer
1578     * relative to the portal's context path.
1579     *
1580     * @return      a list of CSS files that will be referenced from the page's
1581     *              footer relative to the portal's context path
1582     */
1583    public List<String> getFooterPortalCss() {
1584        return _footerPortalCss;
1585    }
1586
1587    /**
1588     * Sets a list of CSS files that will be referenced from the page's footer
1589     * relative to the portal's context path.
1590     *
1591     * @param       footerPortalCss a list of CSS files that will be referenced
1592     *              from the page's footer relative to the portal's context path
1593     */
1594    public void setFooterPortalCss(List<String> footerPortalCss) {
1595        _footerPortalCss = footerPortalCss;
1596    }
1597
1598    /**
1599     * Gets a list of CSS files that will be referenced from the page's footer
1600     * relative to the portlet's context path.
1601     *
1602     * @return      a list of CSS files that will be referenced from the page's
1603     *              footer relative to the portlet's context path
1604     */
1605    public List<String> getFooterPortletCss() {
1606        return _footerPortletCss;
1607    }
1608
1609    /**
1610     * Sets a list of CSS files that will be referenced from the page's footer
1611     * relative to the portlet's context path.
1612     *
1613     * @param       footerPortletCss a list of CSS files that will be referenced
1614     *              from the page's footer relative to the portlet's context
1615     *              path
1616     */
1617    public void setFooterPortletCss(List<String> footerPortletCss) {
1618        _footerPortletCss = footerPortletCss;
1619    }
1620
1621    /**
1622     * Gets a list of JavaScript files that will be referenced from the page's
1623     * footer relative to the portal's context path.
1624     *
1625     * @return      a list of JavaScript files that will be referenced from the
1626     *              page's footer relative to the portal's context path
1627     */
1628    public List<String> getFooterPortalJavaScript() {
1629        return _footerPortalJavaScript;
1630    }
1631
1632    /**
1633     * Sets a list of JavaScript files that will be referenced from the page's
1634     * footer relative to the portal's context path.
1635     *
1636     * @param       footerPortalJavaScript a list of JavaScript files that will
1637     *              be referenced from the page's footer relative to the
1638     *              portal's context path
1639     */
1640    public void setFooterPortalJavaScript(List<String> footerPortalJavaScript) {
1641        _footerPortalJavaScript = footerPortalJavaScript;
1642    }
1643
1644    /**
1645     * Gets a list of JavaScript files that will be referenced from the page's
1646     * footer relative to the portlet's context path.
1647     *
1648     * @return      a list of JavaScript files that will be referenced from the
1649     *              page's footer relative to the portlet's context path
1650     */
1651    public List<String> getFooterPortletJavaScript() {
1652        return _footerPortletJavaScript;
1653    }
1654
1655    /**
1656     * Sets a list of JavaScript files that will be referenced from the page's
1657     * footer relative to the portlet's context path.
1658     *
1659     * @param       footerPortletJavaScript a list of JavaScript files that will
1660     *              be referenced from the page's footer relative to the
1661     *              portlet's context path
1662     */
1663    public void setFooterPortletJavaScript(
1664        List<String> footerPortletJavaScript) {
1665
1666        _footerPortletJavaScript = footerPortletJavaScript;
1667    }
1668
1669    /**
1670     * Gets the name of the CSS class that will be injected in the DIV that
1671     * wraps this portlet.
1672     *
1673     * @return      the name of the CSS class that will be injected in the DIV
1674     *              that wraps this portlet
1675     */
1676    public String getCssClassWrapper() {
1677        return _cssClassWrapper;
1678    }
1679
1680    /**
1681     * Sets the name of the CSS class that will be injected in the DIV that
1682     * wraps this portlet.
1683     *
1684     * @param       cssClassWrapper the name of the CSS class that will be
1685     *              injected in the DIV that wraps this portlet
1686     */
1687    public void setCssClassWrapper(String cssClassWrapper) {
1688        _cssClassWrapper = cssClassWrapper;
1689    }
1690
1691    /**
1692     * Gets the Facebook integration method of the portlet.
1693     *
1694     * @return      the Facebook integration method of the portlet
1695     */
1696    public String getFacebookIntegration() {
1697        return _facebookIntegration;
1698    }
1699
1700    /**
1701     * Sets the Facebook integration method of the portlet.
1702     *
1703     * @param       facebookIntegration the Facebook integration method of the
1704     *              portlet
1705     */
1706    public void setFacebookIntegration(String facebookIntegration) {
1707        if (Validator.isNotNull(facebookIntegration)) {
1708            _facebookIntegration = facebookIntegration;
1709        }
1710    }
1711
1712    /**
1713     * Returns true if default resources for the portlet are added to a page.
1714     *
1715     * @return      true if default resources for the portlet are added to a
1716     *              page
1717     */
1718    public boolean getAddDefaultResource() {
1719        return _addDefaultResource;
1720    }
1721
1722    /**
1723     * Returns true if default resources for the portlet are added to a page.
1724     *
1725     * @return      true if default resources for the portlet are added to a
1726     *              page
1727     */
1728    public boolean isAddDefaultResource() {
1729        return _addDefaultResource;
1730    }
1731
1732    /**
1733     * Sets to true if default resources for the portlet are added to a page.
1734     *
1735     * @param       addDefaultResource boolean value for whether or not default
1736     *              resources for the portlet are added to a page
1737     */
1738    public void setAddDefaultResource(boolean addDefaultResource) {
1739        _addDefaultResource = addDefaultResource;
1740    }
1741
1742    /**
1743     * Sets a string of ordered comma delimited portlet ids.
1744     *
1745     * @param       roles a string of ordered comma delimited portlet ids
1746     */
1747    public void setRoles(String roles) {
1748        _rolesArray = StringUtil.split(roles);
1749
1750        super.setRoles(roles);
1751    }
1752
1753    /**
1754     * Gets an array of required roles of the portlet.
1755     *
1756     * @return      an array of required roles of the portlet
1757     */
1758    public String[] getRolesArray() {
1759        return _rolesArray;
1760    }
1761
1762    /**
1763     * Sets an array of required roles of the portlet.
1764     *
1765     * @param       rolesArray an array of required roles of the portlet
1766     */
1767    public void setRolesArray(String[] rolesArray) {
1768        _rolesArray = rolesArray;
1769
1770        super.setRoles(StringUtil.merge(rolesArray));
1771    }
1772
1773    /**
1774     * Gets the unlinked roles of the portlet.
1775     *
1776     * @return      unlinked roles of the portlet
1777     */
1778    public Set<String> getUnlinkedRoles() {
1779        return _unlinkedRoles;
1780    }
1781
1782    /**
1783     * Sets the unlinked roles of the portlet.
1784     *
1785     * @param       unlinkedRoles the unlinked roles of the portlet
1786     */
1787    public void setUnlinkedRoles(Set<String> unlinkedRoles) {
1788        _unlinkedRoles = unlinkedRoles;
1789    }
1790
1791    /**
1792     * Gets the role mappers of the portlet.
1793     *
1794     * @return      role mappers of the portlet
1795     */
1796    public Map<String, String> getRoleMappers() {
1797        return _roleMappers;
1798    }
1799
1800    /**
1801     * Sets the role mappers of the portlet.
1802     *
1803     * @param       roleMappers the role mappers of the portlet
1804     */
1805    public void setRoleMappers(Map<String, String> roleMappers) {
1806        _roleMappers = roleMappers;
1807    }
1808
1809    /**
1810     * Link the role names set in portlet.xml with the Liferay roles set in
1811     * liferay-portlet.xml.
1812     */
1813    public void linkRoles() {
1814        List<String> linkedRoles = new ArrayList<String>();
1815
1816        Iterator<String> itr = _unlinkedRoles.iterator();
1817
1818        while (itr.hasNext()) {
1819            String unlinkedRole = itr.next();
1820
1821            String roleLink = _roleMappers.get(unlinkedRole);
1822
1823            if (Validator.isNotNull(roleLink)) {
1824                if (_log.isDebugEnabled()) {
1825                    _log.debug(
1826                        "Linking role for portlet [" + getPortletId() +
1827                            "] with role-name [" + unlinkedRole +
1828                                "] to role-link [" + roleLink + "]");
1829                }
1830
1831                linkedRoles.add(roleLink);
1832            }
1833            else {
1834                _log.error(
1835                    "Unable to link role for portlet [" + getPortletId() +
1836                        "] with role-name [" + unlinkedRole +
1837                            "] because role-link is null");
1838            }
1839        }
1840
1841        String[] array = linkedRoles.toArray(new String[linkedRoles.size()]);
1842
1843        Arrays.sort(array);
1844
1845        setRolesArray(array);
1846    }
1847
1848    /**
1849     * Returns true if the portlet has a role with the specified name.
1850     *
1851     * @return      true if the portlet has a role with the specified name
1852     */
1853    public boolean hasRoleWithName(String roleName) {
1854        if ((_rolesArray == null) || (_rolesArray.length == 0)) {
1855            return false;
1856        }
1857
1858        for (int i = 0; i < _rolesArray.length; i++) {
1859            if (_rolesArray[i].equalsIgnoreCase(roleName)) {
1860                return true;
1861            }
1862        }
1863
1864        return false;
1865    }
1866
1867    /**
1868     * Returns true if the user has the permission to add the portlet to a
1869     * layout.
1870     *
1871     * @return      true if the user has the permission to add the portlet to a
1872     *              layout
1873     */
1874    public boolean hasAddPortletPermission(long userId) {
1875        try {
1876            if ((_rolesArray == null) || (_rolesArray.length == 0)) {
1877                return true;
1878            }
1879            else if (RoleLocalServiceUtil.hasUserRoles(
1880                        userId, getCompanyId(), _rolesArray, true)) {
1881
1882                return true;
1883            }
1884            else if (RoleLocalServiceUtil.hasUserRole(
1885                        userId, getCompanyId(), RoleConstants.ADMINISTRATOR,
1886                        true)) {
1887
1888                return true;
1889            }
1890            else {
1891                User user = UserLocalServiceUtil.getUserById(userId);
1892
1893                if (user.isDefaultUser() &&
1894                    hasRoleWithName(RoleConstants.GUEST)) {
1895
1896                    return true;
1897                }
1898            }
1899        }
1900        catch (Exception e) {
1901            _log.error(e);
1902        }
1903
1904        return false;
1905    }
1906
1907    /**
1908     * Returns true if the portlet is a system portlet that a user cannot
1909     * manually add to their page.
1910     *
1911     * @return      true if the portlet is a system portlet that a user cannot
1912     *              manually add to their page
1913     */
1914    public boolean getSystem() {
1915        return _system;
1916    }
1917
1918    /**
1919     * Returns true if the portlet is a system portlet that a user cannot
1920     * manually add to their page.
1921     *
1922     * @return      true if the portlet is a system portlet that a user cannot
1923     *              manually add to their page
1924     */
1925    public boolean isSystem() {
1926        return _system;
1927    }
1928
1929    /**
1930     * Sets to true if the portlet is a system portlet that a user cannot
1931     * manually add to their page.
1932     *
1933     * @param       system boolean value for whether the portlet is a system
1934     *              portlet that a user cannot manually add to their page
1935     */
1936    public void setSystem(boolean system) {
1937        _system = system;
1938    }
1939
1940    /**
1941     * Returns true to include the portlet and make it available to be made
1942     * active.
1943     *
1944     * @return      true to include the portlet and make it available to be made
1945     *              active
1946     */
1947    public boolean getInclude() {
1948        return _include;
1949    }
1950
1951    /**
1952     * Returns true to include the portlet and make it available to be made
1953     * active.
1954     *
1955     * @return      true to include the portlet and make it available to be made
1956     *              active
1957     */
1958    public boolean isInclude() {
1959        return _include;
1960    }
1961
1962    /**
1963     * Sets to true to include the portlet and make it available to be made
1964     * active.
1965     *
1966     * @param       include boolean value for whether to include the portlet and
1967     *              make it available to be made active
1968     */
1969    public void setInclude(boolean include) {
1970        _include = include;
1971    }
1972
1973    /**
1974     * Gets the init parameters of the portlet.
1975     *
1976     * @return      init parameters of the portlet
1977     */
1978    public Map<String, String> getInitParams() {
1979        return _initParams;
1980    }
1981
1982    /**
1983     * Sets the init parameters of the portlet.
1984     *
1985     * @param       initParams the init parameters of the portlet
1986     */
1987    public void setInitParams(Map<String, String> initParams) {
1988        _initParams = initParams;
1989    }
1990
1991    /**
1992     * Gets expiration cache of the portlet.
1993     *
1994     * @return      expiration cache of the portlet
1995     */
1996    public Integer getExpCache() {
1997        return _expCache;
1998    }
1999
2000    /**
2001     * Sets expiration cache of the portlet.
2002     *
2003     * @param       expCache expiration cache of the portlet
2004     */
2005    public void setExpCache(Integer expCache) {
2006        _expCache = expCache;
2007    }
2008
2009    /**
2010     * Gets the portlet modes of the portlet.
2011     *
2012     * @return      portlet modes of the portlet
2013     */
2014    public Map<String, Set<String>> getPortletModes() {
2015        return _portletModes;
2016    }
2017
2018    /**
2019     * Sets the portlet modes of the portlet.
2020     *
2021     * @param       portletModes the portlet modes of the portlet
2022     */
2023    public void setPortletModes(Map<String, Set<String>> portletModes) {
2024        _portletModes = portletModes;
2025    }
2026
2027    /**
2028     * Returns true if the portlet supports the specified mime type and
2029     * portlet mode.
2030     *
2031     * @return      true if the portlet supports the specified mime type and
2032     *              portlet mode
2033     */
2034    public boolean hasPortletMode(String mimeType, PortletMode portletMode) {
2035        if (mimeType == null) {
2036            mimeType = ContentTypes.TEXT_HTML;
2037        }
2038
2039        Set<String> mimeTypeModes = _portletModes.get(mimeType);
2040
2041        if (mimeTypeModes == null) {
2042            return false;
2043        }
2044
2045        if (mimeTypeModes.contains(portletMode.toString())) {
2046            return true;
2047        }
2048        else {
2049            return false;
2050        }
2051    }
2052
2053    /**
2054     * Gets a list of all portlet modes supported by the portlet.
2055     *
2056     * @return      a list of all portlet modes supported by the portlet
2057     */
2058    public Set<String> getAllPortletModes() {
2059        Set<String> allPortletModes = new TreeSet<String>();
2060
2061        Iterator<Map.Entry <String, Set<String>>> itr1 =
2062            _portletModes.entrySet().iterator();
2063
2064        while (itr1.hasNext()) {
2065            Map.Entry<String, Set<String>> entry = itr1.next();
2066
2067            Set<String> mimeTypeModes = entry.getValue();
2068
2069            Iterator<String> itr2 = mimeTypeModes.iterator();
2070
2071            while (itr2.hasNext()) {
2072                String portletMode = itr2.next();
2073
2074                allPortletModes.add(portletMode);
2075            }
2076        }
2077
2078        return allPortletModes;
2079    }
2080
2081    /**
2082     * Returns true if the portlet supports more than one mime type.
2083     *
2084     * @return      true if the portlet supports more than one mime type
2085     */
2086    public boolean hasMultipleMimeTypes() {
2087        if (_portletModes.size() > 1) {
2088            return true;
2089        }
2090        else {
2091            return false;
2092        }
2093    }
2094
2095    /**
2096     * Gets the supported locales of the portlet.
2097     *
2098     * @return      supported locales of the portlet
2099     */
2100    public Set<String> getSupportedLocales() {
2101        return _supportedLocales;
2102    }
2103
2104    /**
2105     * Sets the supported locales of the portlet.
2106     *
2107     * @param       supportedLocales the supported locales of the portlet
2108     */
2109    public void setSupportedLocales(Set<String> supportedLocales) {
2110        _supportedLocales = supportedLocales;
2111    }
2112
2113    /**
2114     * Gets the resource bundle of the portlet.
2115     *
2116     * @return      resource bundle of the portlet
2117     */
2118    public String getResourceBundle() {
2119        return _resourceBundle;
2120    }
2121
2122    /**
2123     * Sets the resource bundle of the portlet.
2124     *
2125     * @param       resourceBundle the resource bundle of the portlet
2126     */
2127    public void setResourceBundle(String resourceBundle) {
2128        _resourceBundle = resourceBundle;
2129    }
2130
2131    /**
2132     * Gets the portlet info of the portlet.
2133     *
2134     * @return      portlet info of the portlet
2135     */
2136    public PortletInfo getPortletInfo() {
2137        return _portletInfo;
2138    }
2139
2140    /**
2141     * Sets the portlet info of the portlet.
2142     *
2143     * @param       portletInfo the portlet info of the portlet
2144     */
2145    public void setPortletInfo(PortletInfo portletInfo) {
2146        _portletInfo = portletInfo;
2147    }
2148
2149    /**
2150     * Gets the filters of the portlet.
2151     *
2152     * @return      filters of the portlet
2153     */
2154    public Map<String, PortletFilter> getPortletFilters() {
2155        return _portletFilters;
2156    }
2157
2158    /**
2159     * Sets the filters of the portlet.
2160     *
2161     * @param       portletFilters the filters of the portlet
2162     */
2163    public void setPortletFilters(Map<String, PortletFilter> portletFilters) {
2164        _portletFilters = portletFilters;
2165    }
2166
2167    /**
2168     * Adds a supported processing event.
2169     *
2170     * @param       publicRenderParameter a supported processing event
2171     */
2172    public void addProcessingEvent(QName processingEvent) {
2173        _processingEvents.add(processingEvent);
2174        _processingEventsByQName.put(
2175            QNameUtil.getKey(processingEvent), processingEvent);
2176    }
2177
2178    /**
2179     * Gets the supported processing event from a namespace URI and a local
2180     * part.
2181     *
2182     * @return      the supported processing event from a namespace URI and a
2183     *              local part
2184     */
2185    public QName getProcessingEvent(String uri, String localPart) {
2186        return _processingEventsByQName.get(
2187            QNameUtil.getKey(uri, localPart));
2188    }
2189
2190    /**
2191     * Gets the supported processing events of the portlet.
2192     *
2193     * @return      supported processing events of the portlet
2194     */
2195    public Set<QName> getProcessingEvents() {
2196        return _processingEvents;
2197    }
2198
2199    /**
2200     * Sets the supported processing events of the portlet.
2201     *
2202     * @param       processingEvents the supported processing events of the
2203     *              portlet
2204     */
2205    public void setProcessingEvents(Set<QName> processingEvents) {
2206        for (QName processingEvent : processingEvents) {
2207            addProcessingEvent(processingEvent);
2208        }
2209    }
2210
2211    /**
2212     * Adds a supported publishing event.
2213     *
2214     * @param       publicRenderParameter a supported publishing event
2215     */
2216    public void addPublishingEvent(QName publishingEvent) {
2217        _publishingEvents.add(publishingEvent);
2218    }
2219
2220    /**
2221     * Gets the supported publishing events of the portlet.
2222     *
2223     * @return      supported publishing events of the portlet
2224     */
2225    public Set<QName> getPublishingEvents() {
2226        return _publishingEvents;
2227    }
2228
2229    /**
2230     * Sets the supported publishing events of the portlet.
2231     *
2232     * @param       publishingEvents the supported publishing events of the
2233     *              portlet
2234     */
2235    public void setPublishingEvents(Set<QName> publishingEvents) {
2236        for (QName publishingEvent : publishingEvents) {
2237            addPublishingEvent(publishingEvent);
2238        }
2239    }
2240
2241    /**
2242     * Adds a supported public render parameter.
2243     *
2244     * @param       publicRenderParameter a supported public render parameter
2245     */
2246    public void addPublicRenderParameter(
2247        PublicRenderParameter publicRenderParameter) {
2248
2249        _publicRenderParameters.add(publicRenderParameter);
2250        _publicRenderParametersByIdentifier.put(
2251            publicRenderParameter.getIdentifier(), publicRenderParameter);
2252        _publicRenderParametersByQName.put(
2253            QNameUtil.getKey(publicRenderParameter.getQName()),
2254            publicRenderParameter);
2255    }
2256
2257    /**
2258     * Gets the supported public render parameter from an identifier.
2259     *
2260     * @return      the supported public render parameter from an identifier
2261     */
2262    public PublicRenderParameter getPublicRenderParameter(String identifier) {
2263        return _publicRenderParametersByIdentifier.get(identifier);
2264    }
2265
2266    /**
2267     * Gets the supported public render parameter from a namespace URI and a
2268     * local part.
2269     *
2270     * @return      the supported public render parameter from a namespace URI
2271     *              and a local part
2272     */
2273    public PublicRenderParameter getPublicRenderParameter(
2274        String uri, String localPart) {
2275
2276        return _publicRenderParametersByQName.get(
2277            QNameUtil.getKey(uri, localPart));
2278    }
2279
2280    /**
2281     * Gets the supported public render parameters of the portlet.
2282     *
2283     * @return      the supported public render parameters of the portlet
2284     */
2285    public Set<PublicRenderParameter> getPublicRenderParameters() {
2286        return _publicRenderParameters;
2287    }
2288
2289    /**
2290     * Sets the supported public render parameters of the portlet.
2291     *
2292     * @param       publicRenderParameters the supported public render
2293     *              parameters of the portlet
2294     */
2295    public void setPublicRenderParameters(
2296        Set<PublicRenderParameter> publicRenderParameters) {
2297
2298        for (PublicRenderParameter publicRenderParameter :
2299                publicRenderParameters) {
2300
2301            addPublicRenderParameter(publicRenderParameter);
2302        }
2303    }
2304
2305    /**
2306     * Gets the servlet context path of the portlet.
2307     *
2308     * @return      the servlet context path of the portlet
2309     */
2310    public String getContextPath() {
2311        String virtualPath = getVirtualPath();
2312
2313        if (Validator.isNotNull(virtualPath)) {
2314            return virtualPath;
2315        }
2316
2317        if (_portletApp.isWARFile()) {
2318            StringBuilder sb = new StringBuilder();
2319
2320            sb.append(StringPool.SLASH);
2321            sb.append(_portletApp.getServletContextName());
2322
2323            return sb.toString();
2324        }
2325        else {
2326            return PortalUtil.getPathContext();
2327        }
2328    }
2329
2330    /**
2331     * Get the application this portlet belongs to.
2332     *
2333     * @return      the application this portlet belongs to
2334     */
2335    public PortletApp getPortletApp() {
2336        return _portletApp;
2337    }
2338
2339    /**
2340     * Sets the application this portlet belongs to.
2341     *
2342     * @param       portletApp the application this portlet belongs to
2343     */
2344    public void setPortletApp(PortletApp portletApp) {
2345        _portletApp = portletApp;
2346    }
2347
2348    /**
2349     * Returns true if the portlet is found in a WAR file.
2350     *
2351     * @param       portletId the cloned instance portlet id
2352     * @return      a cloned instance of the portlet
2353     */
2354    public Portlet getClonedInstance(String portletId) {
2355        if (_clonedInstances == null) {
2356
2357            // LEP-528
2358
2359            return null;
2360        }
2361
2362        Portlet clonedInstance = _clonedInstances.get(portletId);
2363
2364        if (clonedInstance == null) {
2365            clonedInstance = (Portlet)clone();
2366
2367            clonedInstance.setPortletId(portletId);
2368
2369            // Disable caching of cloned instances until we can figure out how
2370            // to elegantly refresh the cache when the portlet is dynamically
2371            // updated by the user. For example, the user might change the
2372            // portlet from one column to the next. Cloned instances that are
2373            // cached would not see the new change. We can then also cache
2374            // static portlet instances.
2375
2376            //_clonedInstances.put(portletId, clonedInstance);
2377        }
2378
2379        return clonedInstance;
2380    }
2381
2382    /**
2383     * Returns true if the portlet is a static portlet that is cannot be moved.
2384     *
2385     * @return      true if the portlet is a static portlet that is cannot be
2386     *              moved
2387     */
2388    public boolean getStatic() {
2389        return _staticPortlet;
2390    }
2391
2392    /**
2393     * Returns true if the portlet is a static portlet that is cannot be moved.
2394     *
2395     * @return      true if the portlet is a static portlet that is cannot be
2396     *              moved
2397     */
2398    public boolean isStatic() {
2399        return _staticPortlet;
2400    }
2401
2402    /**
2403     * Sets to true if the portlet is a static portlet that is cannot be moved.
2404     *
2405     * @param       staticPortlet boolean value for whether the portlet is a
2406     *              static portlet that cannot be moved
2407     */
2408    public void setStatic(boolean staticPortlet) {
2409        _staticPortlet = staticPortlet;
2410    }
2411
2412    /**
2413     * Returns true if the portlet is a static portlet at the start of a list of
2414     * portlets.
2415     *
2416     * @return      true if the portlet is a static portlet at the start of a
2417     *              list of portlets
2418     */
2419    public boolean getStaticStart() {
2420        return _staticPortletStart;
2421    }
2422
2423    /**
2424     * Returns true if the portlet is a static portlet at the start of a list of
2425     * portlets.
2426     *
2427     * @return      true if the portlet is a static portlet at the start of a
2428     *              list of portlets
2429     */
2430    public boolean isStaticStart() {
2431        return _staticPortletStart;
2432    }
2433
2434    /**
2435     * Sets to true if the portlet is a static portlet at the start of a list of
2436     * portlets.
2437     *
2438     * @param       staticPortletStart boolean value for whether the portlet is
2439     *              a static portlet at the start of a list of portlets
2440     */
2441    public void setStaticStart(boolean staticPortletStart) {
2442        _staticPortletStart = staticPortletStart;
2443    }
2444
2445    /**
2446     * Returns true if the portlet is a static portlet at the end of a list of
2447     * portlets.
2448     *
2449     * @return      true if the portlet is a static portlet at the end of a
2450     *              list of portlets
2451     */
2452    public boolean getStaticEnd() {
2453        return !_staticPortletStart;
2454    }
2455
2456    /**
2457     * Returns true if the portlet is a static portlet at the end of a list of
2458     * portlets.
2459     *
2460     * @return      true if the portlet is a static portlet at the end of a
2461     *              list of portlets
2462     */
2463    public boolean isStaticEnd() {
2464        return !_staticPortletStart;
2465    }
2466
2467    /**
2468     * Creates and returns a copy of this object.
2469     *
2470     * @return      a copy of this object
2471     */
2472    public Object clone() {
2473        return new PortletImpl(
2474            getPortletId(), getPluginPackage(), getDefaultPluginSetting(),
2475            getCompanyId(), getTimestamp(), getIcon(), getVirtualPath(),
2476            getStrutsPath(), getPortletName(), getDisplayName(),
2477            getPortletClass(), getConfigurationActionClass(), getIndexerClass(),
2478            getOpenSearchClass(), getSchedulerClass(), getPortletURLClass(),
2479            getFriendlyURLMapperClass(), getURLEncoderClass(),
2480            getPortletDataHandlerClass(), getPortletLayoutListenerClass(),
2481            getPopMessageListenerClass(), getSocialActivityInterpreterClass(),
2482            getSocialRequestInterpreterClass(), getDefaultPreferences(),
2483            getPreferencesValidator(), isPreferencesCompanyWide(),
2484            isPreferencesUniquePerLayout(), isPreferencesOwnedByGroup(),
2485            isUseDefaultTemplate(), isShowPortletAccessDenied(),
2486            isShowPortletInactive(), isActionURLRedirect(),
2487            isRestoreCurrentView(), isMaximizeEdit(), isMaximizeHelp(),
2488            isPopUpPrint(), isLayoutCacheable(), isInstanceable(),
2489            getUserPrincipalStrategy(), isPrivateRequestAttributes(),
2490            isPrivateSessionAttributes(), getRenderWeight(), isAjaxable(),
2491            getHeaderPortalCss(), getHeaderPortletCss(),
2492            getHeaderPortalJavaScript(), getHeaderPortletJavaScript(),
2493            getFooterPortalCss(), getFooterPortletCss(),
2494            getFooterPortalJavaScript(), getFooterPortletJavaScript(),
2495            getCssClassWrapper(), getFacebookIntegration(),
2496            isAddDefaultResource(), getRoles(), getUnlinkedRoles(),
2497            getRoleMappers(), isSystem(), isActive(), isInclude(),
2498            getInitParams(), getExpCache(), getPortletModes(),
2499            getSupportedLocales(), getResourceBundle(), getPortletInfo(),
2500            getPortletFilters(), getProcessingEvents(), getPublishingEvents(),
2501            getPublicRenderParameters(), getPortletApp());
2502    }
2503
2504    /**
2505     * Compares this portlet to the specified object.
2506     *
2507     * @param       obj the object to compare this portlet against
2508     * @return      the value 0 if the argument portlet is equal to this
2509     *              portlet; a value less than -1 if this portlet is less than
2510     *              the portlet argument; and 1 if this portlet is greater than
2511     *              the portlet argument
2512     */
2513    public int compareTo(Object obj) {
2514        Portlet portlet = (Portlet)obj;
2515
2516        return getPortletId().compareTo(portlet.getPortletId());
2517    }
2518
2519    /**
2520     * Checks whether this portlet is equal to the specified object.
2521     *
2522     * @param       obj the object to compare this portlet against
2523     * @return      true if the portlet is equal to the specified object
2524     */
2525    public boolean equals(Object obj) {
2526        Portlet portlet = (Portlet)obj;
2527
2528        return getPortletId().equals(portlet.getPortletId());
2529    }
2530
2531    /**
2532     * Log instance for this class.
2533     */
2534    private static Log _log = LogFactoryUtil.getLog(PortletImpl.class);
2535
2536    /**
2537     * Package this plugin belongs to.
2538     */
2539    private PluginPackage _pluginPackage;
2540
2541    /**
2542     * Plugin settings associated with the portlet.
2543     */
2544    private PluginSetting _defaultPluginSetting;
2545
2546    /**
2547     * The timestamp of the portlet.
2548     */
2549    private long _timestamp;
2550
2551    /**
2552     * The icon of the portlet.
2553     */
2554    private String _icon;
2555
2556    /**
2557     * The virtual path of the portlet.
2558     */
2559    private String _virtualPath;
2560
2561    /**
2562     * The struts path of the portlet.
2563     */
2564    private String _strutsPath;
2565
2566    /**
2567     * The name of the portlet.
2568     */
2569    private String _portletName;
2570
2571    /**
2572     * The display name of the portlet.
2573     */
2574    private String _displayName;
2575
2576    /**
2577     * The name of the portlet class of the portlet.
2578     */
2579    private String _portletClass;
2580
2581    /**
2582     * The configuration action class of the portlet.
2583     */
2584    private String _configurationActionClass;
2585
2586    /**
2587     * The name of the indexer class of the portlet.
2588     */
2589    private String _indexerClass;
2590
2591    /**
2592     * The name of the open search class of the portlet.
2593     */
2594    private String _openSearchClass;
2595
2596    /**
2597     * The name of the scheduler class of the portlet.
2598     */
2599    private String _schedulerClass;
2600
2601    /**
2602     * The name of the portlet URL class of the portlet.
2603     */
2604    private String _portletURLClass;
2605
2606    /**
2607     * The name of the friendly URL mapper class of the portlet.
2608     */
2609    private String _friendlyURLMapperClass;
2610
2611    /**
2612     * The name of the URL encoder class of the portlet.
2613     */
2614    private String _urlEncoderClass;
2615
2616    /**
2617     * The name of the portlet data handler class of the portlet.
2618     */
2619    private String _portletDataHandlerClass;
2620
2621    /**
2622     * The name of the portlet data layout listener class of the portlet.
2623     */
2624    private String _portletLayoutListenerClass;
2625
2626    /**
2627     * The name of the POP message listener class of the portlet.
2628     */
2629    private String _popMessageListenerClass;
2630
2631    /**
2632     * The name of the social activity interpreter class of the portlet.
2633     */
2634    private String _socialActivityInterpreterClass;
2635
2636    /**
2637     * The name of the social request interpreter class of the portlet.
2638     */
2639    private String _socialRequestInterpreterClass;
2640
2641    /**
2642     * The default preferences of the portlet.
2643     */
2644    private String _defaultPreferences;
2645
2646    /**
2647     * The name of the preferences validator class of the portlet.
2648     */
2649    private String _prefsValidator;
2650
2651    /**
2652     * True if preferences are shared across the entire company.
2653     */
2654    private boolean _prefsCompanyWide;
2655
2656    /**
2657     * True if preferences are unique per layout.
2658     */
2659    private boolean _prefsUniquePerLayout = true;
2660
2661    /**
2662     * True if preferences are owned by the group when the portlet is shown in a
2663     * group layout. False if preferences are owned by the user at all times.
2664     */
2665    private boolean _prefsOwnedByGroup = true;
2666
2667    /**
2668     * True if the portlet uses the default template.
2669     */
2670    private boolean _useDefaultTemplate = true;
2671
2672    /**
2673     * True if users are shown that they do not have access to the portlet.
2674     */
2675    private boolean _showPortletAccessDenied =
2676        PropsValues.LAYOUT_SHOW_PORTLET_ACCESS_DENIED;
2677
2678    /**
2679     * True if users are shown that the portlet is inactive.
2680     */
2681    private boolean _showPortletInactive =
2682        PropsValues.LAYOUT_SHOW_PORTLET_INACTIVE;
2683
2684    /**
2685     * True if an action URL for this portlet should cause an auto redirect.
2686     */
2687    private boolean _actionURLRedirect;
2688
2689    /**
2690     * True if the portlet restores to the current view from the maximized
2691     * state.
2692     */
2693    private boolean _restoreCurrentView = true;
2694
2695    /**
2696     * True if the portlet goes into the maximized state when the user goes into
2697     * the edit mode.
2698     */
2699    private boolean _maximizeEdit;
2700
2701    /**
2702     * True if the portlet goes into the maximized state when the user goes into
2703     * the help mode.
2704     */
2705    private boolean _maximizeHelp;
2706
2707    /**
2708     * True if the portlet goes into the pop up state when the user goes into
2709     * the print mode.
2710     */
2711    private boolean _popUpPrint = true;
2712
2713    /**
2714     * True if the portlet can be cached within the layout.
2715     */
2716    private boolean _layoutCacheable;
2717
2718    /**
2719     * True if the portlet can be added multiple times to a layout.
2720     */
2721    private boolean _instanceable;
2722
2723    /**
2724     * The user principal strategy of the portlet.
2725     */
2726    private String _userPrincipalStrategy =
2727        PortletConstants.USER_PRINCIPAL_STRATEGY_USER_ID;
2728
2729    /**
2730     * True if the portlet does not share request attributes with the portal or
2731     * portlets from another WAR.
2732     */
2733    private boolean _privateRequestAttributes = true;
2734
2735    /**
2736     * True if the portlet does not share session attributes with the portal.
2737     */
2738    private boolean _privateSessionAttributes = true;
2739
2740    /**
2741     * Render weight of the portlet.
2742     */
2743    private int _renderWeight = 1;
2744
2745    /**
2746     * True if the portlet can be displayed via Ajax.
2747     */
2748    private boolean _ajaxable = true;
2749
2750    /**
2751     * A list of CSS files that will be referenced from the page's header
2752     * relative to the portal's context path.
2753     */
2754    private List<String> _headerPortalCss;
2755
2756    /**
2757     * A list of CSS files that will be referenced from the page's header
2758     * relative to the portlet's context path.
2759     */
2760    private List<String> _headerPortletCss;
2761
2762    /**
2763     * A list of JavaScript files that will be referenced from the page's header
2764     * relative to the portal's context path.
2765     */
2766    private List<String> _headerPortalJavaScript;
2767
2768    /**
2769     * A list of JavaScript files that will be referenced from the page's header
2770     * relative to the portlet's context path.
2771     */
2772    private List<String> _headerPortletJavaScript;
2773
2774    /**
2775     * A list of CSS files that will be referenced from the page's footer
2776     * relative to the portal's context path.
2777     */
2778    private List<String> _footerPortalCss;
2779
2780    /**
2781     * A list of CSS files that will be referenced from the page's footer
2782     * relative to the portlet's context path.
2783     */
2784    private List<String> _footerPortletCss;
2785
2786    /**
2787     * A list of JavaScript files that will be referenced from the page's footer
2788     * relative to the portal's context path.
2789     */
2790    private List<String> _footerPortalJavaScript;
2791
2792    /**
2793     * A list of JavaScript files that will be referenced from the page's footer
2794     * relative to the portlet's context path.
2795     */
2796    private List<String> _footerPortletJavaScript;
2797
2798    /**
2799     * The name of the CSS class that will be injected in the DIV that wraps
2800     * this portlet.
2801     */
2802    private String _cssClassWrapper = StringPool.BLANK;
2803
2804    /**
2805     * The Facebook integration method of the portlet.
2806     */
2807    private String _facebookIntegration =
2808        PortletConstants.FACEBOOK_INTEGRATION_IFRAME;
2809
2810    /**
2811     * True if default resources for the portlet are added to a page.
2812     */
2813    private boolean _addDefaultResource;
2814
2815    /**
2816     * An array of required roles of the portlet.
2817     */
2818    private String[] _rolesArray;
2819
2820    /**
2821     * The unlinked roles of the portlet.
2822     */
2823    private Set<String> _unlinkedRoles;
2824
2825    /**
2826     * The role mappers of the portlet.
2827     */
2828    private Map<String, String> _roleMappers;
2829
2830    /**
2831     * True if the portlet is a system portlet that a user cannot manually add
2832     * to their page.
2833     */
2834    private boolean _system;
2835
2836    /**
2837     * True to include the portlet and make it available to be made active.
2838     */
2839    private boolean _include = true;
2840
2841    /**
2842     * The init parameters of the portlet.
2843     */
2844    private Map<String, String> _initParams;
2845
2846    /**
2847     * The expiration cache of the portlet.
2848     */
2849    private Integer _expCache;
2850
2851    /**
2852     * The portlet modes of the portlet.
2853     */
2854    private Map<String, Set<String>> _portletModes;
2855
2856    /**
2857     * The supported locales of the portlet.
2858     */
2859    private Set<String> _supportedLocales;
2860
2861    /**
2862     * The resource bundle of the portlet.
2863     */
2864    private String _resourceBundle;
2865
2866    /**
2867     * The portlet info of the portlet.
2868     */
2869    private PortletInfo _portletInfo;
2870
2871    /**
2872     * The filters of the portlet.
2873     */
2874    private Map<String, PortletFilter> _portletFilters;
2875
2876    /**
2877     * The supported processing events of the portlet.
2878     */
2879    private Set<QName> _processingEvents = new HashSet<QName>();
2880
2881    /**
2882     * Map of the supported processing events of the portlet keyed by the QName.
2883     */
2884    private Map<String, QName> _processingEventsByQName =
2885        new HashMap<String, QName>();
2886
2887    /**
2888     * The supported publishing events of the portlet.
2889     */
2890    private Set<QName> _publishingEvents = new HashSet<QName>();
2891
2892    /**
2893     * The supported public render parameters of the portlet.
2894     */
2895    private Set<PublicRenderParameter> _publicRenderParameters =
2896        new HashSet<PublicRenderParameter>();
2897
2898    /**
2899     * Map of the supported public render parameters of the portlet keyed by the
2900     * identifier.
2901     */
2902    private Map<String, PublicRenderParameter>
2903        _publicRenderParametersByIdentifier =
2904            new HashMap<String, PublicRenderParameter>();
2905
2906    /**
2907     * Map of the supported public render parameters of the portlet keyed by the
2908     * QName.
2909     */
2910    private Map<String, PublicRenderParameter>
2911        _publicRenderParametersByQName =
2912            new HashMap<String, PublicRenderParameter>();
2913
2914    /**
2915     * The application this portlet belongs to.
2916     */
2917    private PortletApp _portletApp;
2918
2919    /**
2920     * The cloned instances of the portlet.
2921     */
2922    private Map<String, Portlet> _clonedInstances;
2923
2924    /**
2925     * True if the portlet is a static portlet that is cannot be moved.
2926     */
2927    private boolean _staticPortlet;
2928
2929    /**
2930     * True if the portlet is a static portlet at the start of a list of
2931     * portlets.
2932     */
2933    private boolean _staticPortletStart;
2934
2935}