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