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