1
14
15 package com.liferay.portal.model.impl;
16
17 import com.liferay.portal.kernel.job.Scheduler;
18 import com.liferay.portal.kernel.log.Log;
19 import com.liferay.portal.kernel.log.LogFactoryUtil;
20 import com.liferay.portal.kernel.plugin.PluginPackage;
21 import com.liferay.portal.kernel.poller.PollerProcessor;
22 import com.liferay.portal.kernel.pop.MessageListener;
23 import com.liferay.portal.kernel.portlet.ConfigurationAction;
24 import com.liferay.portal.kernel.portlet.FriendlyURLMapper;
25 import com.liferay.portal.kernel.portlet.PortletBag;
26 import com.liferay.portal.kernel.portlet.PortletBagPool;
27 import com.liferay.portal.kernel.portlet.PortletLayoutListener;
28 import com.liferay.portal.kernel.scheduler.SchedulerEntry;
29 import com.liferay.portal.kernel.search.Indexer;
30 import com.liferay.portal.kernel.search.OpenSearch;
31 import com.liferay.portal.kernel.servlet.URLEncoder;
32 import com.liferay.portal.kernel.util.ContentTypes;
33 import com.liferay.portal.kernel.util.InstancePool;
34 import com.liferay.portal.kernel.util.StringPool;
35 import com.liferay.portal.kernel.util.StringUtil;
36 import com.liferay.portal.kernel.util.Validator;
37 import com.liferay.portal.kernel.workflow.WorkflowHandler;
38 import com.liferay.portal.kernel.xml.QName;
39 import com.liferay.portal.kernel.xmlrpc.Method;
40 import com.liferay.portal.lar.PortletDataHandler;
41 import com.liferay.portal.model.Plugin;
42 import com.liferay.portal.model.PluginSetting;
43 import com.liferay.portal.model.Portlet;
44 import com.liferay.portal.model.PortletApp;
45 import com.liferay.portal.model.PortletConstants;
46 import com.liferay.portal.model.PortletFilter;
47 import com.liferay.portal.model.PortletInfo;
48 import com.liferay.portal.model.PublicRenderParameter;
49 import com.liferay.portal.model.User;
50 import com.liferay.portal.security.permission.ActionKeys;
51 import com.liferay.portal.security.permission.PermissionChecker;
52 import com.liferay.portal.security.permission.PermissionCheckerFactoryUtil;
53 import com.liferay.portal.security.permission.PermissionThreadLocal;
54 import com.liferay.portal.service.UserLocalServiceUtil;
55 import com.liferay.portal.service.permission.PortletPermissionUtil;
56 import com.liferay.portal.util.PortalUtil;
57 import com.liferay.portal.util.PropsValues;
58 import com.liferay.portal.webdav.WebDAVStorage;
59 import com.liferay.portlet.ControlPanelEntry;
60 import com.liferay.portlet.PortletBagImpl;
61 import com.liferay.portlet.PortletQNameUtil;
62 import com.liferay.portlet.asset.model.AssetRendererFactory;
63 import com.liferay.portlet.expando.model.CustomAttributesDisplay;
64 import com.liferay.portlet.social.model.SocialActivityInterpreter;
65 import com.liferay.portlet.social.model.SocialRequestInterpreter;
66
67 import java.util.ArrayList;
68 import java.util.Arrays;
69 import java.util.HashMap;
70 import java.util.HashSet;
71 import java.util.Hashtable;
72 import java.util.Iterator;
73 import java.util.LinkedHashMap;
74 import java.util.List;
75 import java.util.Map;
76 import java.util.Set;
77 import java.util.TreeSet;
78
79 import javax.portlet.PortletMode;
80 import javax.portlet.WindowState;
81
82
87 public class PortletImpl extends PortletModelImpl implements Portlet {
88
89
92 public PortletImpl() {
93 }
94
95
98 public PortletImpl(long companyId, String portletId) {
99 setCompanyId(companyId);
100 setPortletId(portletId);
101 setStrutsPath(portletId);
102 setActive(true);
103 _schedulerEntries = new ArrayList<SchedulerEntry>();
104 _assetRendererFactoryClasses = new ArrayList<String>();
105 _customAttributesDisplayClasses = new ArrayList<String>();
106 _workflowHandlerClasses = new ArrayList<String>();
107 _headerPortalCss = new ArrayList<String>();
108 _headerPortletCss = new ArrayList<String>();
109 _headerPortalJavaScript = new ArrayList<String>();
110 _headerPortletJavaScript = new ArrayList<String>();
111 _footerPortalCss = new ArrayList<String>();
112 _footerPortletCss = new ArrayList<String>();
113 _footerPortalJavaScript = new ArrayList<String>();
114 _footerPortletJavaScript = new ArrayList<String>();
115 _unlinkedRoles = new HashSet<String>();
116 _roleMappers = new LinkedHashMap<String, String>();
117 _initParams = new HashMap<String, String>();
118 _portletModes = new HashMap<String, Set<String>>();
119 _windowStates = new HashMap<String, Set<String>>();
120 _supportedLocales = new HashSet<String>();
121 _portletFilters = new LinkedHashMap<String, PortletFilter>();
122 _processingEvents = new HashSet<QName>();
123 _publishingEvents = new HashSet<QName>();
124 _publicRenderParameters = new HashSet<PublicRenderParameter>();
125 }
126
127
130 public PortletImpl(
131 String portletId, PluginPackage pluginPackage,
132 PluginSetting pluginSetting, long companyId, long timestamp,
133 String icon, String virtualPath, String strutsPath, String portletName,
134 String displayName, String portletClass,
135 String configurationActionClass, String indexerClass,
136 String openSearchClass, String schedulerClass,
137 List<SchedulerEntry> schedulerEntries, String portletURLClass,
138 String friendlyURLMapperClass, String urlEncoderClass,
139 String portletDataHandlerClass, String portletLayoutListenerClass,
140 String pollerProcessorClass, String popMessageListenerClass,
141 String socialActivityInterpreterClass,
142 String socialRequestInterpreterClass, String webDAVStorageToken,
143 String webDAVStorageClass, String xmlRpcMethodClass,
144 String controlPanelEntryCategory, double controlPanelEntryWeight,
145 String controlPanelClass, List<String> assetRendererFactoryClasses,
146 List<String> customAttributesDisplayClasses,
147 List<String> workflowHandlerClasses, String defaultPreferences,
148 String preferencesValidator, boolean preferencesCompanyWide,
149 boolean preferencesUniquePerLayout, boolean preferencesOwnedByGroup,
150 boolean useDefaultTemplate, boolean showPortletAccessDenied,
151 boolean showPortletInactive, boolean actionURLRedirect,
152 boolean restoreCurrentView, boolean maximizeEdit, boolean maximizeHelp,
153 boolean popUpPrint, boolean layoutCacheable, boolean instanceable,
154 boolean scopeable, String userPrincipalStrategy,
155 boolean privateRequestAttributes, boolean privateSessionAttributes,
156 int renderWeight, boolean ajaxable, List<String> headerPortalCss,
157 List<String> headerPortletCss, List<String> headerPortalJavaScript,
158 List<String> headerPortletJavaScript, List<String> footerPortalCss,
159 List<String> footerPortletCss, List<String> footerPortalJavaScript,
160 List<String> footerPortletJavaScript, String cssClassWrapper,
161 String facebookIntegration, boolean addDefaultResource, String roles,
162 Set<String> unlinkedRoles, Map<String, String> roleMappers,
163 boolean system, boolean active, boolean include,
164 Map<String, String> initParams, Integer expCache,
165 Map<String, Set<String>> portletModes,
166 Map<String, Set<String>> windowStates, Set<String> supportedLocales,
167 String resourceBundle, PortletInfo portletInfo,
168 Map<String, PortletFilter> portletFilters, Set<QName> processingEvents,
169 Set<QName> publishingEvents,
170 Set<PublicRenderParameter> publicRenderParameters,
171 PortletApp portletApp) {
172
173 setPortletId(portletId);
174 _pluginPackage = pluginPackage;
175 _defaultPluginSetting = pluginSetting;
176 setCompanyId(companyId);
177 _timestamp = timestamp;
178 _icon = icon;
179 _virtualPath = virtualPath;
180 _strutsPath = strutsPath;
181 _portletName = portletName;
182 _displayName = displayName;
183 _portletClass = portletClass;
184 _configurationActionClass = configurationActionClass;
185 _indexerClass = indexerClass;
186 _openSearchClass = openSearchClass;
187 _schedulerClass = schedulerClass;
188 _schedulerEntries = schedulerEntries;
189 _portletURLClass = portletURLClass;
190 _friendlyURLMapperClass = friendlyURLMapperClass;
191 _urlEncoderClass = urlEncoderClass;
192 _portletDataHandlerClass = portletDataHandlerClass;
193 _portletLayoutListenerClass = portletLayoutListenerClass;
194 _pollerProcessorClass = pollerProcessorClass;
195 _popMessageListenerClass = popMessageListenerClass;
196 _socialActivityInterpreterClass = socialActivityInterpreterClass;
197 _socialRequestInterpreterClass = socialRequestInterpreterClass;
198 _webDAVStorageToken = webDAVStorageToken;
199 _webDAVStorageClass = webDAVStorageClass;
200 _xmlRpcMethodClass = xmlRpcMethodClass;
201 _controlPanelEntryCategory = controlPanelEntryCategory;
202 _controlPanelEntryWeight = controlPanelEntryWeight;
203 _controlPanelEntryClass = controlPanelClass;
204 _assetRendererFactoryClasses = assetRendererFactoryClasses;
205 _customAttributesDisplayClasses = customAttributesDisplayClasses;
206 _workflowHandlerClasses = workflowHandlerClasses;
207 _defaultPreferences = defaultPreferences;
208 _preferencesValidator = preferencesValidator;
209 _preferencesCompanyWide = preferencesCompanyWide;
210 _preferencesUniquePerLayout = preferencesUniquePerLayout;
211 _preferencesOwnedByGroup = preferencesOwnedByGroup;
212 _useDefaultTemplate = useDefaultTemplate;
213 _showPortletAccessDenied = showPortletAccessDenied;
214 _showPortletInactive = showPortletInactive;
215 _actionURLRedirect = actionURLRedirect;
216 _restoreCurrentView = restoreCurrentView;
217 _maximizeEdit = maximizeEdit;
218 _maximizeHelp = maximizeHelp;
219 _popUpPrint = popUpPrint;
220 _layoutCacheable = layoutCacheable;
221 _instanceable = instanceable;
222 _scopeable = scopeable;
223 _userPrincipalStrategy = userPrincipalStrategy;
224 _privateRequestAttributes = privateRequestAttributes;
225 _privateSessionAttributes = privateSessionAttributes;
226 _renderWeight = renderWeight;
227 _ajaxable = ajaxable;
228 _headerPortalCss = headerPortalCss;
229 _headerPortletCss = headerPortletCss;
230 _headerPortalJavaScript = headerPortalJavaScript;
231 _headerPortletJavaScript = headerPortletJavaScript;
232 _footerPortalCss = footerPortalCss;
233 _footerPortletCss = footerPortletCss;
234 _footerPortalJavaScript = footerPortalJavaScript;
235 _footerPortletJavaScript = footerPortletJavaScript;
236 _cssClassWrapper = cssClassWrapper;
237 _facebookIntegration = facebookIntegration;
238 _scopeable = scopeable;
239 _addDefaultResource = addDefaultResource;
240 setRoles(roles);
241 _unlinkedRoles = unlinkedRoles;
242 _roleMappers = roleMappers;
243 _system = system;
244 setActive(active);
245 _include = include;
246 _initParams = initParams;
247 _expCache = expCache;
248 _portletModes = portletModes;
249 _windowStates = windowStates;
250 _supportedLocales = supportedLocales;
251 _resourceBundle = resourceBundle;
252 _portletInfo = portletInfo;
253 _portletFilters = portletFilters;
254 setProcessingEvents(processingEvents);
255 setPublishingEvents(publishingEvents);
256 setPublicRenderParameters(publicRenderParameters);
257 _portletApp = portletApp;
258
259 if (_instanceable) {
260 _clonedInstances = new Hashtable<String, Portlet>();
261 }
262 }
263
264
269 public String getRootPortletId() {
270 return PortletConstants.getRootPortletId(getPortletId());
271 }
272
273
278 public String getInstanceId() {
279 return PortletConstants.getInstanceId(getPortletId());
280 }
281
282
287 public String getPluginId() {
288 return getRootPortletId();
289 }
290
291
296 public String getPluginType() {
297 return Plugin.TYPE_PORTLET;
298 }
299
300
305 public PluginPackage getPluginPackage() {
306 return _pluginPackage;
307 }
308
309
314 public void setPluginPackage(PluginPackage pluginPackage) {
315 _pluginPackage = pluginPackage;
316 }
317
318
323 public PluginSetting getDefaultPluginSetting() {
324 return _defaultPluginSetting;
325 }
326
327
332 public void setDefaultPluginSetting(PluginSetting pluginSetting) {
333 _defaultPluginSetting = pluginSetting;
334 }
335
336
341 public long getTimestamp() {
342 return _timestamp;
343 }
344
345
350 public void setTimestamp(long timestamp) {
351 _timestamp = timestamp;
352 }
353
354
359 public String getIcon() {
360 return _icon;
361 }
362
363
368 public void setIcon(String icon) {
369 _icon = icon;
370 }
371
372
377 public String getVirtualPath() {
378 return _virtualPath;
379 }
380
381
386 public void setVirtualPath(String virtualPath) {
387 if (_portletApp.isWARFile() && Validator.isNull(virtualPath)) {
388 virtualPath = PropsValues.PORTLET_VIRTUAL_PATH;
389 }
390
391 _virtualPath = virtualPath;
392 }
393
394
399 public String getStrutsPath() {
400 return _strutsPath;
401 }
402
403
408 public void setStrutsPath(String strutsPath) {
409 _strutsPath = strutsPath;
410 }
411
412
417 public String getPortletName() {
418 return _portletName;
419 }
420
421
426 public void setPortletName(String portletName) {
427 _portletName = portletName;
428 }
429
430
435 public String getDisplayName() {
436 return _displayName;
437 }
438
439
444 public void setDisplayName(String displayName) {
445 _displayName = displayName;
446 }
447
448
453 public String getPortletClass() {
454 return _portletClass;
455 }
456
457
462 public void setPortletClass(String portletClass) {
463 _portletClass = portletClass;
464 }
465
466
471 public String getConfigurationActionClass() {
472 return _configurationActionClass;
473 }
474
475
481 public void setConfigurationActionClass(String configurationActionClass) {
482 _configurationActionClass = configurationActionClass;
483 }
484
485
490 public ConfigurationAction getConfigurationActionInstance() {
491 if (Validator.isNull(getConfigurationActionClass())) {
492 return null;
493 }
494
495 if (_portletApp.isWARFile()) {
496 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
497
498 return portletBag.getConfigurationActionInstance();
499 }
500
501 return (ConfigurationAction)InstancePool.get(
502 getConfigurationActionClass());
503 }
504
505
510 public String getIndexerClass() {
511 return _indexerClass;
512 }
513
514
519 public void setIndexerClass(String indexerClass) {
520 _indexerClass = indexerClass;
521 }
522
523
528 public Indexer getIndexerInstance() {
529 if (Validator.isNull(getIndexerClass())) {
530 return null;
531 }
532
533 if (_portletApp.isWARFile()) {
534 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
535
536 return portletBag.getIndexerInstance();
537 }
538
539 return (Indexer)InstancePool.get(getIndexerClass());
540 }
541
542
547 public String getOpenSearchClass() {
548 return _openSearchClass;
549 }
550
551
556 public void setOpenSearchClass(String openSearchClass) {
557 _openSearchClass = openSearchClass;
558 }
559
560
565 public OpenSearch getOpenSearchInstance() {
566 if (Validator.isNull(getOpenSearchClass())) {
567 return null;
568 }
569
570 if (_portletApp.isWARFile()) {
571 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
572
573 return portletBag.getOpenSearchInstance();
574 }
575
576 return (OpenSearch)InstancePool.get(getOpenSearchClass());
577 }
578
579
584 public String getSchedulerClass() {
585 return _schedulerClass;
586 }
587
588
593 public void setSchedulerClass(String schedulerClass) {
594 _schedulerClass = schedulerClass;
595 }
596
597
602 public Scheduler getSchedulerInstance() {
603 if (Validator.isNull(getSchedulerClass())) {
604 return null;
605 }
606
607 if (_portletApp.isWARFile()) {
608 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
609
610 return portletBag.getSchedulerInstance();
611 }
612
613 return (Scheduler)InstancePool.get(getSchedulerClass());
614 }
615
616
619 public void addSchedulerEntry(SchedulerEntry schedulerEntry) {
620 _schedulerEntries.add(schedulerEntry);
621 }
622
623
628 public List<SchedulerEntry> getSchedulerEntries() {
629 return _schedulerEntries;
630 }
631
632
637 public void setSchedulerEntries(List<SchedulerEntry> schedulerEntries) {
638 for (SchedulerEntry schedulerEntry : schedulerEntries) {
639 addSchedulerEntry(schedulerEntry);
640 }
641 }
642
643
648 public String getPortletURLClass() {
649 return _portletURLClass;
650 }
651
652
657 public void setPortletURLClass(String portletURLClass) {
658 _portletURLClass = portletURLClass;
659 }
660
661
666 public String getFriendlyURLMapperClass() {
667 return _friendlyURLMapperClass;
668 }
669
670
676 public void setFriendlyURLMapperClass(String friendlyURLMapperClass) {
677 _friendlyURLMapperClass = friendlyURLMapperClass;
678 }
679
680
685 public FriendlyURLMapper getFriendlyURLMapperInstance() {
686 if (Validator.isNull(getFriendlyURLMapperClass())) {
687 return null;
688 }
689
690 if (_portletApp.isWARFile()) {
691 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
692
693 return portletBag.getFriendlyURLMapperInstance();
694 }
695
696 return (FriendlyURLMapper)InstancePool.get(getFriendlyURLMapperClass());
697 }
698
699
704 public String getURLEncoderClass() {
705 return _urlEncoderClass;
706 }
707
708
713 public void setURLEncoderClass(String urlEncoderClass) {
714 _urlEncoderClass = urlEncoderClass;
715 }
716
717
722 public URLEncoder getURLEncoderInstance() {
723 if (Validator.isNull(getURLEncoderClass())) {
724 return null;
725 }
726
727 if (_portletApp.isWARFile()) {
728 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
729
730 return portletBag.getURLEncoderInstance();
731 }
732
733 return (URLEncoder)InstancePool.get(getURLEncoderClass());
734 }
735
736
741 public String getPortletDataHandlerClass() {
742 return _portletDataHandlerClass;
743 }
744
745
751 public void setPortletDataHandlerClass(String portletDataHandlerClass) {
752 _portletDataHandlerClass = portletDataHandlerClass;
753 }
754
755
760 public PortletDataHandler getPortletDataHandlerInstance() {
761 if (Validator.isNull(getPortletDataHandlerClass())) {
762 return null;
763 }
764
765 if (_portletApp.isWARFile()) {
766 PortletBagImpl portletBagImpl = (PortletBagImpl)PortletBagPool.get(
767 getRootPortletId());
768
769 return portletBagImpl.getPortletDataHandlerInstance();
770 }
771
772 return (PortletDataHandler)InstancePool.get(
773 getPortletDataHandlerClass());
774 }
775
776
781 public PortletLayoutListener getPortletLayoutListener() {
782 if (Validator.isNull(getPortletLayoutListenerClass())) {
783 return null;
784 }
785
786 return (PortletLayoutListener)InstancePool.get(
787 getPortletLayoutListenerClass());
788 }
789
790
795 public String getPortletLayoutListenerClass() {
796 return _portletLayoutListenerClass;
797 }
798
799
805 public void setPortletLayoutListenerClass(
806 String portletLayoutListenerClass) {
807
808 _portletLayoutListenerClass = portletLayoutListenerClass;
809 }
810
811
816 public PortletLayoutListener getPortletLayoutListenerInstance() {
817 if (Validator.isNull(getPortletLayoutListenerClass())) {
818 return null;
819 }
820
821 if (_portletApp.isWARFile()) {
822 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
823
824 return portletBag.getPortletLayoutListenerInstance();
825 }
826
827 return (PortletLayoutListener)InstancePool.get(
828 getPortletLayoutListenerClass());
829 }
830
831
836 public String getPollerProcessorClass() {
837 return _pollerProcessorClass;
838 }
839
840
846 public void setPollerProcessorClass(String pollerProcessorClass) {
847 _pollerProcessorClass = pollerProcessorClass;
848 }
849
850
855 public PollerProcessor getPollerProcessorInstance() {
856 if (Validator.isNull(getPollerProcessorClass())) {
857 return null;
858 }
859
860 if (_portletApp.isWARFile()) {
861 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
862
863 return portletBag.getPollerProcessorInstance();
864 }
865
866 return (PollerProcessor)InstancePool.get(getPollerProcessorClass());
867 }
868
869
874 public String getPopMessageListenerClass() {
875 return _popMessageListenerClass;
876 }
877
878
884 public void setPopMessageListenerClass(String popMessageListenerClass) {
885 _popMessageListenerClass = popMessageListenerClass;
886 }
887
888
893 public MessageListener getPopMessageListenerInstance() {
894 if (Validator.isNull(getPopMessageListenerClass())) {
895 return null;
896 }
897
898 if (_portletApp.isWARFile()) {
899 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
900
901 return portletBag.getPopMessageListenerInstance();
902 }
903
904 return (MessageListener)InstancePool.get(getPopMessageListenerClass());
905 }
906
907
912 public String getSocialActivityInterpreterClass() {
913 return _socialActivityInterpreterClass;
914 }
915
916
922 public void setSocialActivityInterpreterClass(
923 String socialActivityInterpreterClass) {
924
925 _socialActivityInterpreterClass = socialActivityInterpreterClass;
926 }
927
928
934 public SocialActivityInterpreter getSocialActivityInterpreterInstance() {
935 if (Validator.isNull(getSocialActivityInterpreterClass())) {
936 return null;
937 }
938
939 if (_portletApp.isWARFile()) {
940 PortletBagImpl portletBagImpl = (PortletBagImpl)PortletBagPool.get(
941 getRootPortletId());
942
943 return portletBagImpl.getSocialActivityInterpreterInstance();
944 }
945
946 return (SocialActivityInterpreter)InstancePool.get(
947 getSocialActivityInterpreterClass());
948 }
949
950
955 public String getSocialRequestInterpreterClass() {
956 return _socialRequestInterpreterClass;
957 }
958
959
965 public void setSocialRequestInterpreterClass(
966 String socialRequestInterpreterClass) {
967
968 _socialRequestInterpreterClass = socialRequestInterpreterClass;
969 }
970
971
977 public SocialRequestInterpreter getSocialRequestInterpreterInstance() {
978 if (Validator.isNull(getSocialRequestInterpreterClass())) {
979 return null;
980 }
981
982 if (_portletApp.isWARFile()) {
983 PortletBagImpl portletBagImpl = (PortletBagImpl)PortletBagPool.get(
984 getRootPortletId());
985
986 return portletBagImpl.getSocialRequestInterpreterInstance();
987 }
988
989 return (SocialRequestInterpreter)InstancePool.get(
990 getSocialRequestInterpreterClass());
991 }
992
993
998 public String getWebDAVStorageToken() {
999 return _webDAVStorageToken;
1000 }
1001
1002
1008 public void setWebDAVStorageToken(String webDAVStorageToken) {
1009 _webDAVStorageToken = webDAVStorageToken;
1010 }
1011
1012
1017 public String getWebDAVStorageClass() {
1018 return _webDAVStorageClass;
1019 }
1020
1021
1027 public void setWebDAVStorageClass(String webDAVStorageClass) {
1028 _webDAVStorageClass = webDAVStorageClass;
1029 }
1030
1031
1036 public WebDAVStorage getWebDAVStorageInstance() {
1037 if (Validator.isNull(getWebDAVStorageClass())) {
1038 return null;
1039 }
1040
1041 if (_portletApp.isWARFile()) {
1042 PortletBagImpl portletBagImpl = (PortletBagImpl)PortletBagPool.get(
1043 getRootPortletId());
1044
1045 return portletBagImpl.getWebDAVStorageInstance();
1046 }
1047
1048 return (WebDAVStorage)InstancePool.get(
1049 getWebDAVStorageClass());
1050 }
1051
1052
1057 public String getXmlRpcMethodClass() {
1058 return _xmlRpcMethodClass;
1059 }
1060
1061
1067 public void setXmlRpcMethodClass(String xmlRpcMethodClass) {
1068 _xmlRpcMethodClass = xmlRpcMethodClass;
1069 }
1070
1071
1076 public Method getXmlRpcMethodInstance() {
1077 if (Validator.isNull(getXmlRpcMethodClass())) {
1078 return null;
1079 }
1080
1081 if (_portletApp.isWARFile()) {
1082 PortletBagImpl portletBagImpl = (PortletBagImpl)PortletBagPool.get(
1083 getRootPortletId());
1084
1085 return portletBagImpl.getXmlRpcMethodInstance();
1086 }
1087
1088 return (Method)InstancePool.get(getXmlRpcMethodClass());
1089 }
1090
1091
1098 public String getControlPanelEntryCategory() {
1099 return _controlPanelEntryCategory;
1100 }
1101
1102
1109 public void setControlPanelEntryCategory(String controlPanelEntryCategory) {
1110 _controlPanelEntryCategory = controlPanelEntryCategory;
1111 }
1112
1113
1120 public double getControlPanelEntryWeight() {
1121 return _controlPanelEntryWeight;
1122 }
1123
1124
1132 public void setControlPanelEntryWeight(double controlPanelEntryWeight) {
1133 _controlPanelEntryWeight = controlPanelEntryWeight;
1134 }
1135
1136
1143 public String getControlPanelEntryClass() {
1144 return _controlPanelEntryClass;
1145 }
1146
1147
1154 public void setControlPanelEntryClass(String controlPanelEntryClass) {
1155 _controlPanelEntryClass = controlPanelEntryClass;
1156 }
1157
1158
1165 public ControlPanelEntry getControlPanelEntryInstance() {
1166 if (Validator.isNull(getControlPanelEntryClass())) {
1167 return null;
1168 }
1169
1170 if (_portletApp.isWARFile()) {
1171 PortletBagImpl portletBagImpl = (PortletBagImpl)PortletBagPool.get(
1172 getRootPortletId());
1173
1174 return portletBagImpl.getControlPanelEntryInstance();
1175 }
1176
1177 return (ControlPanelEntry)InstancePool.get(getControlPanelEntryClass());
1178 }
1179
1180
1187 public List<String> getAssetRendererFactoryClasses() {
1188 return _assetRendererFactoryClasses;
1189 }
1190
1191
1198 public void setAssetRendererFactoryClasses(
1199 List<String> assetRendererFactoryClasses) {
1200
1201 _assetRendererFactoryClasses = assetRendererFactoryClasses;
1202 }
1203
1204
1209 public List<AssetRendererFactory> getAssetRendererFactoryInstances() {
1210 if (getAssetRendererFactoryClasses().isEmpty()) {
1211 return null;
1212 }
1213
1214 if (_portletApp.isWARFile()) {
1215 PortletBagImpl portletBagImpl = (PortletBagImpl)PortletBagPool.get(
1216 getRootPortletId());
1217
1218 return portletBagImpl.getAssetRendererFactoryInstances();
1219 }
1220
1221 List<AssetRendererFactory> assetRendererFactoryInstances =
1222 new ArrayList<AssetRendererFactory>();
1223
1224 for (String assetRendererFactoryClass :
1225 getAssetRendererFactoryClasses()) {
1226
1227 AssetRendererFactory assetRendererFactoryInstance =
1228 (AssetRendererFactory)InstancePool.get(
1229 assetRendererFactoryClass);
1230
1231 assetRendererFactoryInstance.setClassNameId(
1232 PortalUtil.getClassNameId(
1233 assetRendererFactoryInstance.getClassName()));
1234 assetRendererFactoryInstance.setPortletId(getPortletId());
1235
1236 assetRendererFactoryInstances.add(assetRendererFactoryInstance);
1237 }
1238
1239 return assetRendererFactoryInstances;
1240 }
1241
1242
1249 public List<String> getCustomAttributesDisplayClasses() {
1250 return _customAttributesDisplayClasses;
1251 }
1252
1253
1260 public void setCustomAttributesDisplayClasses(
1261 List<String> customAttributesDisplayClasses) {
1262
1263 _customAttributesDisplayClasses = customAttributesDisplayClasses;
1264 }
1265
1266
1271 public List<CustomAttributesDisplay> getCustomAttributesDisplayInstances() {
1272 if (getCustomAttributesDisplayClasses().isEmpty()) {
1273 return null;
1274 }
1275
1276 if (_portletApp.isWARFile()) {
1277 PortletBagImpl portletBagImpl = (PortletBagImpl)PortletBagPool.get(
1278 getRootPortletId());
1279
1280 return portletBagImpl.getCustomAttributesDisplayInstances();
1281 }
1282
1283 List<CustomAttributesDisplay> customAttributesDisplayInstances =
1284 new ArrayList<CustomAttributesDisplay>();
1285
1286 for (String customAttributesDisplayClass :
1287 getCustomAttributesDisplayClasses()) {
1288
1289 CustomAttributesDisplay customAttributesDisplayInstance =
1290 (CustomAttributesDisplay)InstancePool.get(
1291 customAttributesDisplayClass);
1292
1293 customAttributesDisplayInstance.setClassNameId(
1294 PortalUtil.getClassNameId(
1295 customAttributesDisplayInstance.getClassName()));
1296 customAttributesDisplayInstance.setPortletId(getPortletId());
1297
1298 customAttributesDisplayInstances.add(
1299 customAttributesDisplayInstance);
1300 }
1301
1302 return customAttributesDisplayInstances;
1303 }
1304
1305
1312 public List<String> getWorkflowHandlerClasses() {
1313 return _workflowHandlerClasses;
1314 }
1315
1316
1323 public void setWorkflowHandlerClasses(List<String> workflowHandlerClasses) {
1324 _workflowHandlerClasses = workflowHandlerClasses;
1325 }
1326
1327
1332 public List<WorkflowHandler> getWorkflowHandlerInstances() {
1333 if (getWorkflowHandlerClasses().isEmpty()) {
1334 return null;
1335 }
1336
1337 if (_portletApp.isWARFile()) {
1338 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1339
1340 return portletBag.getWorkflowHandlerInstances();
1341 }
1342
1343 List<WorkflowHandler> workflowHandlerInstances =
1344 new ArrayList<WorkflowHandler>();
1345
1346 for (String workflowHandlerClass : getWorkflowHandlerClasses()) {
1347 WorkflowHandler workflowHandlerInstance =
1348 (WorkflowHandler)InstancePool.get(workflowHandlerClass);
1349
1350 workflowHandlerInstances.add(workflowHandlerInstance);
1351 }
1352
1353 return workflowHandlerInstances;
1354 }
1355
1356
1361 public String getDefaultPreferences() {
1362 if (Validator.isNull(_defaultPreferences)) {
1363 return PortletConstants.DEFAULT_PREFERENCES;
1364 }
1365 else {
1366 return _defaultPreferences;
1367 }
1368 }
1369
1370
1375 public void setDefaultPreferences(String defaultPreferences) {
1376 _defaultPreferences = defaultPreferences;
1377 }
1378
1379
1384 public String getPreferencesValidator() {
1385 return _preferencesValidator;
1386 }
1387
1388
1394 public void setPreferencesValidator(String preferencesValidator) {
1395 if (preferencesValidator != null) {
1396
1397
1400 _preferencesValidator = preferencesValidator.trim();
1401 }
1402 else {
1403 _preferencesValidator = null;
1404 }
1405 }
1406
1407
1412 public boolean getPreferencesCompanyWide() {
1413 return _preferencesCompanyWide;
1414 }
1415
1416
1421 public boolean isPreferencesCompanyWide() {
1422 return _preferencesCompanyWide;
1423 }
1424
1425
1431 public void setPreferencesCompanyWide(boolean preferencesCompanyWide) {
1432 _preferencesCompanyWide = preferencesCompanyWide;
1433 }
1434
1435
1440 public boolean getPreferencesUniquePerLayout() {
1441 return _preferencesUniquePerLayout;
1442 }
1443
1444
1449 public boolean isPreferencesUniquePerLayout() {
1450 return _preferencesUniquePerLayout;
1451 }
1452
1453
1459 public void setPreferencesUniquePerLayout(
1460 boolean preferencesUniquePerLayout) {
1461
1462 _preferencesUniquePerLayout = preferencesUniquePerLayout;
1463 }
1464
1465
1474 public boolean getPreferencesOwnedByGroup() {
1475 return _preferencesOwnedByGroup;
1476 }
1477
1478
1487 public boolean isPreferencesOwnedByGroup() {
1488 return _preferencesOwnedByGroup;
1489 }
1490
1491
1500 public void setPreferencesOwnedByGroup(boolean preferencesOwnedByGroup) {
1501 _preferencesOwnedByGroup = preferencesOwnedByGroup;
1502 }
1503
1504
1509 public boolean getUseDefaultTemplate() {
1510 return _useDefaultTemplate;
1511 }
1512
1513
1518 public boolean isUseDefaultTemplate() {
1519 return _useDefaultTemplate;
1520 }
1521
1522
1528 public void setUseDefaultTemplate(boolean useDefaultTemplate) {
1529 _useDefaultTemplate = useDefaultTemplate;
1530 }
1531
1532
1539 public boolean getShowPortletAccessDenied() {
1540 return _showPortletAccessDenied;
1541 }
1542
1543
1550 public boolean isShowPortletAccessDenied() {
1551 return _showPortletAccessDenied;
1552 }
1553
1554
1561 public void setShowPortletAccessDenied(boolean showPortletAccessDenied) {
1562 _showPortletAccessDenied = showPortletAccessDenied;
1563 }
1564
1565
1570 public boolean getShowPortletInactive() {
1571 return _showPortletInactive;
1572 }
1573
1574
1579 public boolean isShowPortletInactive() {
1580 return _showPortletInactive;
1581 }
1582
1583
1589 public void setShowPortletInactive(boolean showPortletInactive) {
1590 _showPortletInactive = showPortletInactive;
1591 }
1592
1593
1600 public boolean getActionURLRedirect() {
1601 return _actionURLRedirect;
1602 }
1603
1604
1611 public boolean isActionURLRedirect() {
1612 return _actionURLRedirect;
1613 }
1614
1615
1622 public void setActionURLRedirect(boolean actionURLRedirect) {
1623 _actionURLRedirect = actionURLRedirect;
1624 }
1625
1626
1633 public boolean getRestoreCurrentView() {
1634 return _restoreCurrentView;
1635 }
1636
1637
1644 public boolean isRestoreCurrentView() {
1645 return _restoreCurrentView;
1646 }
1647
1648
1655 public void setRestoreCurrentView(boolean restoreCurrentView) {
1656 _restoreCurrentView = restoreCurrentView;
1657 }
1658
1659
1666 public boolean getMaximizeEdit() {
1667 return _maximizeEdit;
1668 }
1669
1670
1677 public boolean isMaximizeEdit() {
1678 return _maximizeEdit;
1679 }
1680
1681
1688 public void setMaximizeEdit(boolean maximizeEdit) {
1689 _maximizeEdit = maximizeEdit;
1690 }
1691
1692
1699 public boolean getMaximizeHelp() {
1700 return _maximizeHelp;
1701 }
1702
1703
1710 public boolean isMaximizeHelp() {
1711 return _maximizeHelp;
1712 }
1713
1714
1721 public void setMaximizeHelp(boolean maximizeHelp) {
1722 _maximizeHelp = maximizeHelp;
1723 }
1724
1725
1732 public boolean getPopUpPrint() {
1733 return _popUpPrint;
1734 }
1735
1736
1743 public boolean isPopUpPrint() {
1744 return _popUpPrint;
1745 }
1746
1747
1754 public void setPopUpPrint(boolean popUpPrint) {
1755 _popUpPrint = popUpPrint;
1756 }
1757
1758
1763 public boolean getLayoutCacheable() {
1764 return _layoutCacheable;
1765 }
1766
1767
1772 public boolean isLayoutCacheable() {
1773 return _layoutCacheable;
1774 }
1775
1776
1782 public void setLayoutCacheable(boolean layoutCacheable) {
1783 _layoutCacheable = layoutCacheable;
1784 }
1785
1786
1791 public boolean getInstanceable() {
1792 return _instanceable;
1793 }
1794
1795
1800 public boolean isInstanceable() {
1801 return _instanceable;
1802 }
1803
1804
1810 public void setInstanceable(boolean instanceable) {
1811 _instanceable = instanceable;
1812 }
1813
1814
1819 public boolean getScopeable() {
1820 return _scopeable;
1821 }
1822
1823
1828 public boolean isScopeable() {
1829 return _scopeable;
1830 }
1831
1832
1838 public void setScopeable(boolean scopeable) {
1839 _scopeable = scopeable;
1840 }
1841
1842
1847 public String getUserPrincipalStrategy() {
1848 return _userPrincipalStrategy;
1849 }
1850
1851
1856 public void setUserPrincipalStrategy(String userPrincipalStrategy) {
1857 if (Validator.isNotNull(userPrincipalStrategy)) {
1858 _userPrincipalStrategy = userPrincipalStrategy;
1859 }
1860 }
1861
1862
1869 public boolean getPrivateRequestAttributes() {
1870 return _privateRequestAttributes;
1871 }
1872
1873
1880 public boolean isPrivateRequestAttributes() {
1881 return _privateRequestAttributes;
1882 }
1883
1884
1892 public void setPrivateRequestAttributes(boolean privateRequestAttributes) {
1893 _privateRequestAttributes = privateRequestAttributes;
1894 }
1895
1896
1903 public boolean getPrivateSessionAttributes() {
1904 return _privateSessionAttributes;
1905 }
1906
1907
1914 public boolean isPrivateSessionAttributes() {
1915 return _privateSessionAttributes;
1916 }
1917
1918
1925 public void setPrivateSessionAttributes(boolean privateSessionAttributes) {
1926 _privateSessionAttributes = privateSessionAttributes;
1927 }
1928
1929
1934 public int getRenderWeight() {
1935 return _renderWeight;
1936 }
1937
1938
1943 public void setRenderWeight(int renderWeight) {
1944 _renderWeight = renderWeight;
1945 }
1946
1947
1952 public boolean getAjaxable() {
1953 return _ajaxable;
1954 }
1955
1956
1961 public boolean isAjaxable() {
1962 return _ajaxable;
1963 }
1964
1965
1971 public void setAjaxable(boolean ajaxable) {
1972 _ajaxable = ajaxable;
1973 }
1974
1975
1982 public List<String> getHeaderPortalCss() {
1983 return _headerPortalCss;
1984 }
1985
1986
1993 public void setHeaderPortalCss(List<String> headerPortalCss) {
1994 _headerPortalCss = headerPortalCss;
1995 }
1996
1997
2004 public List<String> getHeaderPortletCss() {
2005 return _headerPortletCss;
2006 }
2007
2008
2015 public void setHeaderPortletCss(List<String> headerPortletCss) {
2016 _headerPortletCss = headerPortletCss;
2017 }
2018
2019
2026 public List<String> getHeaderPortalJavaScript() {
2027 return _headerPortalJavaScript;
2028 }
2029
2030
2038 public void setHeaderPortalJavaScript(List<String> headerPortalJavaScript) {
2039 _headerPortalJavaScript = headerPortalJavaScript;
2040 }
2041
2042
2049 public List<String> getHeaderPortletJavaScript() {
2050 return _headerPortletJavaScript;
2051 }
2052
2053
2061 public void setHeaderPortletJavaScript(
2062 List<String> headerPortletJavaScript) {
2063
2064 _headerPortletJavaScript = headerPortletJavaScript;
2065 }
2066
2067
2074 public List<String> getFooterPortalCss() {
2075 return _footerPortalCss;
2076 }
2077
2078
2085 public void setFooterPortalCss(List<String> footerPortalCss) {
2086 _footerPortalCss = footerPortalCss;
2087 }
2088
2089
2096 public List<String> getFooterPortletCss() {
2097 return _footerPortletCss;
2098 }
2099
2100
2107 public void setFooterPortletCss(List<String> footerPortletCss) {
2108 _footerPortletCss = footerPortletCss;
2109 }
2110
2111
2118 public List<String> getFooterPortalJavaScript() {
2119 return _footerPortalJavaScript;
2120 }
2121
2122
2130 public void setFooterPortalJavaScript(List<String> footerPortalJavaScript) {
2131 _footerPortalJavaScript = footerPortalJavaScript;
2132 }
2133
2134
2141 public List<String> getFooterPortletJavaScript() {
2142 return _footerPortletJavaScript;
2143 }
2144
2145
2153 public void setFooterPortletJavaScript(
2154 List<String> footerPortletJavaScript) {
2155
2156 _footerPortletJavaScript = footerPortletJavaScript;
2157 }
2158
2159
2166 public String getCssClassWrapper() {
2167 return _cssClassWrapper;
2168 }
2169
2170
2177 public void setCssClassWrapper(String cssClassWrapper) {
2178 _cssClassWrapper = cssClassWrapper;
2179 }
2180
2181
2186 public String getFacebookIntegration() {
2187 return _facebookIntegration;
2188 }
2189
2190
2195 public void setFacebookIntegration(String facebookIntegration) {
2196 if (Validator.isNotNull(facebookIntegration)) {
2197 _facebookIntegration = facebookIntegration;
2198 }
2199 }
2200
2201
2206 public boolean getAddDefaultResource() {
2207 return _addDefaultResource;
2208 }
2209
2210
2215 public boolean isAddDefaultResource() {
2216 return _addDefaultResource;
2217 }
2218
2219
2225 public void setAddDefaultResource(boolean addDefaultResource) {
2226 _addDefaultResource = addDefaultResource;
2227 }
2228
2229
2234 public void setRoles(String roles) {
2235 _rolesArray = StringUtil.split(roles);
2236
2237 super.setRoles(roles);
2238 }
2239
2240
2245 public String[] getRolesArray() {
2246 return _rolesArray;
2247 }
2248
2249
2254 public void setRolesArray(String[] rolesArray) {
2255 _rolesArray = rolesArray;
2256
2257 super.setRoles(StringUtil.merge(rolesArray));
2258 }
2259
2260
2265 public Set<String> getUnlinkedRoles() {
2266 return _unlinkedRoles;
2267 }
2268
2269
2274 public void setUnlinkedRoles(Set<String> unlinkedRoles) {
2275 _unlinkedRoles = unlinkedRoles;
2276 }
2277
2278
2283 public Map<String, String> getRoleMappers() {
2284 return _roleMappers;
2285 }
2286
2287
2292 public void setRoleMappers(Map<String, String> roleMappers) {
2293 _roleMappers = roleMappers;
2294 }
2295
2296
2300 public void linkRoles() {
2301 List<String> linkedRoles = new ArrayList<String>();
2302
2303 Iterator<String> itr = _unlinkedRoles.iterator();
2304
2305 while (itr.hasNext()) {
2306 String unlinkedRole = itr.next();
2307
2308 String roleLink = _roleMappers.get(unlinkedRole);
2309
2310 if (Validator.isNotNull(roleLink)) {
2311 if (_log.isDebugEnabled()) {
2312 _log.debug(
2313 "Linking role for portlet [" + getPortletId() +
2314 "] with role-name [" + unlinkedRole +
2315 "] to role-link [" + roleLink + "]");
2316 }
2317
2318 linkedRoles.add(roleLink);
2319 }
2320 else {
2321 _log.error(
2322 "Unable to link role for portlet [" + getPortletId() +
2323 "] with role-name [" + unlinkedRole +
2324 "] because role-link is null");
2325 }
2326 }
2327
2328 String[] array = linkedRoles.toArray(new String[linkedRoles.size()]);
2329
2330 Arrays.sort(array);
2331
2332 setRolesArray(array);
2333 }
2334
2335
2340 public boolean hasRoleWithName(String roleName) {
2341 if ((_rolesArray == null) || (_rolesArray.length == 0)) {
2342 return false;
2343 }
2344
2345 for (int i = 0; i < _rolesArray.length; i++) {
2346 if (_rolesArray[i].equalsIgnoreCase(roleName)) {
2347 return true;
2348 }
2349 }
2350
2351 return false;
2352 }
2353
2354
2361 public boolean hasAddPortletPermission(long userId) {
2362 PermissionChecker permissionChecker =
2363 PermissionThreadLocal.getPermissionChecker();
2364
2365 try {
2366 if ((permissionChecker == null) ||
2367 (permissionChecker.getUserId() != userId)) {
2368
2369 User user = UserLocalServiceUtil.getUser(userId);
2370
2371 permissionChecker = PermissionCheckerFactoryUtil.create(
2372 user, true);
2373 }
2374
2375 if (PortletPermissionUtil.contains(
2376 permissionChecker, getPortletId(),
2377 ActionKeys.ADD_TO_PAGE)) {
2378
2379 return true;
2380 }
2381 }
2382 catch (Exception e) {
2383 _log.error(e, e);
2384 }
2385
2386 return false;
2387 }
2388
2389
2396 public boolean getSystem() {
2397 return _system;
2398 }
2399
2400
2407 public boolean isSystem() {
2408 return _system;
2409 }
2410
2411
2418 public void setSystem(boolean system) {
2419 _system = system;
2420 }
2421
2422
2429 public boolean getInclude() {
2430 return _include;
2431 }
2432
2433
2440 public boolean isInclude() {
2441 return _include;
2442 }
2443
2444
2451 public void setInclude(boolean include) {
2452 _include = include;
2453 }
2454
2455
2460 public Map<String, String> getInitParams() {
2461 return _initParams;
2462 }
2463
2464
2469 public void setInitParams(Map<String, String> initParams) {
2470 _initParams = initParams;
2471 }
2472
2473
2478 public Integer getExpCache() {
2479 return _expCache;
2480 }
2481
2482
2487 public void setExpCache(Integer expCache) {
2488 _expCache = expCache;
2489 }
2490
2491
2496 public Map<String, Set<String>> getPortletModes() {
2497 return _portletModes;
2498 }
2499
2500
2505 public void setPortletModes(Map<String, Set<String>> portletModes) {
2506 _portletModes = portletModes;
2507 }
2508
2509
2516 public boolean hasPortletMode(String mimeType, PortletMode portletMode) {
2517 if (mimeType == null) {
2518 mimeType = ContentTypes.TEXT_HTML;
2519 }
2520
2521 Set<String> mimeTypePortletModes = _portletModes.get(mimeType);
2522
2523 if (mimeTypePortletModes == null) {
2524 return false;
2525 }
2526
2527 if (mimeTypePortletModes.contains(portletMode.toString())) {
2528 return true;
2529 }
2530 else {
2531 return false;
2532 }
2533 }
2534
2535
2540 public Set<String> getAllPortletModes() {
2541 Set<String> allPortletModes = new TreeSet<String>();
2542
2543 Iterator<Map.Entry <String, Set<String>>> itr1 =
2544 _portletModes.entrySet().iterator();
2545
2546 while (itr1.hasNext()) {
2547 Map.Entry<String, Set<String>> entry = itr1.next();
2548
2549 Set<String> mimeTypePortletModes = entry.getValue();
2550
2551 Iterator<String> itr2 = mimeTypePortletModes.iterator();
2552
2553 while (itr2.hasNext()) {
2554 String portletMode = itr2.next();
2555
2556 allPortletModes.add(portletMode);
2557 }
2558 }
2559
2560 return allPortletModes;
2561 }
2562
2563
2568 public boolean hasMultipleMimeTypes() {
2569 if (_portletModes.size() > 1) {
2570 return true;
2571 }
2572 else {
2573 return false;
2574 }
2575 }
2576
2577
2582 public Map<String, Set<String>> getWindowStates() {
2583 return _windowStates;
2584 }
2585
2586
2591 public void setWindowStates(Map<String, Set<String>> windowStates) {
2592 _windowStates = windowStates;
2593 }
2594
2595
2602 public boolean hasWindowState(String mimeType, WindowState windowState) {
2603 if (mimeType == null) {
2604 mimeType = ContentTypes.TEXT_HTML;
2605 }
2606
2607 Set<String> mimeTypeWindowStates = _windowStates.get(mimeType);
2608
2609 if (mimeTypeWindowStates == null) {
2610 return false;
2611 }
2612
2613 if (mimeTypeWindowStates.contains(windowState.toString())) {
2614 return true;
2615 }
2616 else {
2617 return false;
2618 }
2619 }
2620
2621
2626 public Set<String> getAllWindowStates() {
2627 Set<String> allWindowStates = new TreeSet<String>();
2628
2629 Iterator<Map.Entry <String, Set<String>>> itr1 =
2630 _windowStates.entrySet().iterator();
2631
2632 while (itr1.hasNext()) {
2633 Map.Entry<String, Set<String>> entry = itr1.next();
2634
2635 Set<String> mimeTypeWindowStates = entry.getValue();
2636
2637 Iterator<String> itr2 = mimeTypeWindowStates.iterator();
2638
2639 while (itr2.hasNext()) {
2640 String windowState = itr2.next();
2641
2642 allWindowStates.add(windowState);
2643 }
2644 }
2645
2646 return allWindowStates;
2647 }
2648
2649
2654 public Set<String> getSupportedLocales() {
2655 return _supportedLocales;
2656 }
2657
2658
2663 public void setSupportedLocales(Set<String> supportedLocales) {
2664 _supportedLocales = supportedLocales;
2665 }
2666
2667
2672 public String getResourceBundle() {
2673 return _resourceBundle;
2674 }
2675
2676
2681 public void setResourceBundle(String resourceBundle) {
2682 _resourceBundle = resourceBundle;
2683 }
2684
2685
2690 public PortletInfo getPortletInfo() {
2691 return _portletInfo;
2692 }
2693
2694
2699 public void setPortletInfo(PortletInfo portletInfo) {
2700 _portletInfo = portletInfo;
2701 }
2702
2703
2708 public Map<String, PortletFilter> getPortletFilters() {
2709 return _portletFilters;
2710 }
2711
2712
2717 public void setPortletFilters(Map<String, PortletFilter> portletFilters) {
2718 _portletFilters = portletFilters;
2719 }
2720
2721
2724 public void addProcessingEvent(QName processingEvent) {
2725 _processingEvents.add(processingEvent);
2726 _processingEventsByQName.put(
2727 PortletQNameUtil.getKey(processingEvent), processingEvent);
2728 }
2729
2730
2737 public QName getProcessingEvent(String uri, String localPart) {
2738 return _processingEventsByQName.get(
2739 PortletQNameUtil.getKey(uri, localPart));
2740 }
2741
2742
2747 public Set<QName> getProcessingEvents() {
2748 return _processingEvents;
2749 }
2750
2751
2756 public void setProcessingEvents(Set<QName> processingEvents) {
2757 for (QName processingEvent : processingEvents) {
2758 addProcessingEvent(processingEvent);
2759 }
2760 }
2761
2762
2765 public void addPublishingEvent(QName publishingEvent) {
2766 _publishingEvents.add(publishingEvent);
2767 }
2768
2769
2774 public Set<QName> getPublishingEvents() {
2775 return _publishingEvents;
2776 }
2777
2778
2783 public void setPublishingEvents(Set<QName> publishingEvents) {
2784 for (QName publishingEvent : publishingEvents) {
2785 addPublishingEvent(publishingEvent);
2786 }
2787 }
2788
2789
2794 public void addPublicRenderParameter(
2795 PublicRenderParameter publicRenderParameter) {
2796
2797 _publicRenderParameters.add(publicRenderParameter);
2798 _publicRenderParametersByIdentifier.put(
2799 publicRenderParameter.getIdentifier(), publicRenderParameter);
2800 _publicRenderParametersByQName.put(
2801 PortletQNameUtil.getKey(publicRenderParameter.getQName()),
2802 publicRenderParameter);
2803 }
2804
2805
2810 public PublicRenderParameter getPublicRenderParameter(String identifier) {
2811 return _publicRenderParametersByIdentifier.get(identifier);
2812 }
2813
2814
2821 public PublicRenderParameter getPublicRenderParameter(
2822 String uri, String localPart) {
2823
2824 return _publicRenderParametersByQName.get(
2825 PortletQNameUtil.getKey(uri, localPart));
2826 }
2827
2828
2833 public Set<PublicRenderParameter> getPublicRenderParameters() {
2834 return _publicRenderParameters;
2835 }
2836
2837
2843 public void setPublicRenderParameters(
2844 Set<PublicRenderParameter> publicRenderParameters) {
2845
2846 for (PublicRenderParameter publicRenderParameter :
2847 publicRenderParameters) {
2848
2849 addPublicRenderParameter(publicRenderParameter);
2850 }
2851 }
2852
2853
2858 public String getContextPath() {
2859 String virtualPath = getVirtualPath();
2860
2861 if (Validator.isNotNull(virtualPath)) {
2862 return virtualPath;
2863 }
2864
2865 if (_portletApp.isWARFile()) {
2866 return StringPool.SLASH.concat(_portletApp.getServletContextName());
2867 }
2868 else {
2869 return PortalUtil.getPathContext();
2870 }
2871 }
2872
2873
2878 public PortletApp getPortletApp() {
2879 return _portletApp;
2880 }
2881
2882
2887 public void setPortletApp(PortletApp portletApp) {
2888 _portletApp = portletApp;
2889 }
2890
2891
2897 public Portlet getClonedInstance(String portletId) {
2898 if (_clonedInstances == null) {
2899
2900
2902 return null;
2903 }
2904
2905 Portlet clonedInstance = _clonedInstances.get(portletId);
2906
2907 if (clonedInstance == null) {
2908 clonedInstance = (Portlet)clone();
2909
2910 clonedInstance.setPortletId(portletId);
2911
2912
2919 }
2921
2922 return clonedInstance;
2923 }
2924
2925
2930 public boolean getStatic() {
2931 return _staticPortlet;
2932 }
2933
2934
2939 public boolean isStatic() {
2940 return _staticPortlet;
2941 }
2942
2943
2949 public void setStatic(boolean staticPortlet) {
2950 _staticPortlet = staticPortlet;
2951 }
2952
2953
2960 public boolean getStaticStart() {
2961 return _staticPortletStart;
2962 }
2963
2964
2971 public boolean isStaticStart() {
2972 return _staticPortletStart;
2973 }
2974
2975
2982 public void setStaticStart(boolean staticPortletStart) {
2983 _staticPortletStart = staticPortletStart;
2984 }
2985
2986
2993 public boolean getStaticEnd() {
2994 return !_staticPortletStart;
2995 }
2996
2997
3004 public boolean isStaticEnd() {
3005 return !_staticPortletStart;
3006 }
3007
3008
3013 public boolean getUndeployedPortlet() {
3014 return _undeployedPortlet;
3015 }
3016
3017
3022 public boolean isUndeployedPortlet() {
3023 return _undeployedPortlet;
3024 }
3025
3026
3032 public void setUndeployedPortlet(boolean undeployedPortlet) {
3033 _undeployedPortlet = undeployedPortlet;
3034 }
3035
3036
3041 public Object clone() {
3042 Portlet portlet = new PortletImpl(
3043 getPortletId(), getPluginPackage(), getDefaultPluginSetting(),
3044 getCompanyId(), getTimestamp(), getIcon(), getVirtualPath(),
3045 getStrutsPath(), getPortletName(), getDisplayName(),
3046 getPortletClass(), getConfigurationActionClass(), getIndexerClass(),
3047 getOpenSearchClass(), getSchedulerClass(), getSchedulerEntries(),
3048 getPortletURLClass(), getFriendlyURLMapperClass(),
3049 getURLEncoderClass(), getPortletDataHandlerClass(),
3050 getPortletLayoutListenerClass(), getPollerProcessorClass(),
3051 getPopMessageListenerClass(), getSocialActivityInterpreterClass(),
3052 getSocialRequestInterpreterClass(), getWebDAVStorageToken(),
3053 getWebDAVStorageClass(), getXmlRpcMethodClass(),
3054 getControlPanelEntryCategory(), getControlPanelEntryWeight(),
3055 getControlPanelEntryClass(), getAssetRendererFactoryClasses(),
3056 getCustomAttributesDisplayClasses(), getWorkflowHandlerClasses(),
3057 getDefaultPreferences(), getPreferencesValidator(),
3058 isPreferencesCompanyWide(), isPreferencesUniquePerLayout(),
3059 isPreferencesOwnedByGroup(), isUseDefaultTemplate(),
3060 isShowPortletAccessDenied(), isShowPortletInactive(),
3061 isActionURLRedirect(), isRestoreCurrentView(), isMaximizeEdit(),
3062 isMaximizeHelp(), isPopUpPrint(), isLayoutCacheable(),
3063 isInstanceable(), isScopeable(), getUserPrincipalStrategy(),
3064 isPrivateRequestAttributes(), isPrivateSessionAttributes(),
3065 getRenderWeight(), isAjaxable(), getHeaderPortalCss(),
3066 getHeaderPortletCss(), getHeaderPortalJavaScript(),
3067 getHeaderPortletJavaScript(), getFooterPortalCss(),
3068 getFooterPortletCss(), getFooterPortalJavaScript(),
3069 getFooterPortletJavaScript(), getCssClassWrapper(),
3070 getFacebookIntegration(), isAddDefaultResource(), getRoles(),
3071 getUnlinkedRoles(), getRoleMappers(), isSystem(), isActive(),
3072 isInclude(), getInitParams(), getExpCache(), getPortletModes(),
3073 getWindowStates(), getSupportedLocales(), getResourceBundle(),
3074 getPortletInfo(), getPortletFilters(), getProcessingEvents(),
3075 getPublishingEvents(), getPublicRenderParameters(),
3076 getPortletApp());
3077
3078 portlet.setId(getId());
3079
3080 return portlet;
3081 }
3082
3083
3092 public int compareTo(Portlet portlet) {
3093 return getPortletId().compareTo(portlet.getPortletId());
3094 }
3095
3096
3102 public boolean equals(Object obj) {
3103 Portlet portlet = (Portlet)obj;
3104
3105 return getPortletId().equals(portlet.getPortletId());
3106 }
3107
3108
3111 private static Log _log = LogFactoryUtil.getLog(PortletImpl.class);
3112
3113
3116 private PluginPackage _pluginPackage;
3117
3118
3121 private PluginSetting _defaultPluginSetting;
3122
3123
3126 private long _timestamp;
3127
3128
3131 private String _icon;
3132
3133
3136 private String _virtualPath;
3137
3138
3141 private String _strutsPath;
3142
3143
3146 private String _portletName;
3147
3148
3151 private String _displayName;
3152
3153
3156 private String _portletClass;
3157
3158
3161 private String _configurationActionClass;
3162
3163
3166 private String _indexerClass;
3167
3168
3171 private String _openSearchClass;
3172
3173
3176 private String _schedulerClass;
3177
3178
3181 private List<SchedulerEntry> _schedulerEntries;
3182
3183
3186 private String _portletURLClass;
3187
3188
3191 private String _friendlyURLMapperClass;
3192
3193
3196 private String _urlEncoderClass;
3197
3198
3201 private String _portletDataHandlerClass;
3202
3203
3206 private String _portletLayoutListenerClass;
3207
3208
3211 private String _pollerProcessorClass;
3212
3213
3216 private String _popMessageListenerClass;
3217
3218
3221 private String _socialActivityInterpreterClass;
3222
3223
3226 private String _socialRequestInterpreterClass;
3227
3228
3231 private String _webDAVStorageToken;
3232
3233
3236 private String _webDAVStorageClass;
3237
3238
3241 private String _xmlRpcMethodClass;
3242
3243
3246 private String _defaultPreferences;
3247
3248
3251 private String _preferencesValidator;
3252
3253
3256 private boolean _preferencesCompanyWide;
3257
3258
3261 private boolean _preferencesUniquePerLayout = true;
3262
3263
3267 private boolean _preferencesOwnedByGroup = true;
3268
3269
3273 private String _controlPanelEntryCategory;
3274
3275
3279 private double _controlPanelEntryWeight = 100;
3280
3281
3285 private String _controlPanelEntryClass;
3286
3287
3291 private List<String> _assetRendererFactoryClasses;
3292
3293
3297 private List<String> _customAttributesDisplayClasses;
3298
3299
3303 private List<String> _workflowHandlerClasses;
3304
3305
3308 private boolean _useDefaultTemplate = true;
3309
3310
3313 private boolean _showPortletAccessDenied =
3314 PropsValues.LAYOUT_SHOW_PORTLET_ACCESS_DENIED;
3315
3316
3319 private boolean _showPortletInactive =
3320 PropsValues.LAYOUT_SHOW_PORTLET_INACTIVE;
3321
3322
3325 private boolean _actionURLRedirect;
3326
3327
3331 private boolean _restoreCurrentView = true;
3332
3333
3337 private boolean _maximizeEdit;
3338
3339
3343 private boolean _maximizeHelp;
3344
3345
3349 private boolean _popUpPrint = true;
3350
3351
3354 private boolean _layoutCacheable;
3355
3356
3359 private boolean _instanceable;
3360
3361
3364 private boolean _scopeable;
3365
3366
3369 private String _userPrincipalStrategy =
3370 PortletConstants.USER_PRINCIPAL_STRATEGY_USER_ID;
3371
3372
3376 private boolean _privateRequestAttributes = true;
3377
3378
3381 private boolean _privateSessionAttributes = true;
3382
3383
3386 private int _renderWeight = 1;
3387
3388
3391 private boolean _ajaxable = true;
3392
3393
3397 private List<String> _headerPortalCss;
3398
3399
3403 private List<String> _headerPortletCss;
3404
3405
3409 private List<String> _headerPortalJavaScript;
3410
3411
3415 private List<String> _headerPortletJavaScript;
3416
3417
3421 private List<String> _footerPortalCss;
3422
3423
3427 private List<String> _footerPortletCss;
3428
3429
3433 private List<String> _footerPortalJavaScript;
3434
3435
3439 private List<String> _footerPortletJavaScript;
3440
3441
3445 private String _cssClassWrapper = StringPool.BLANK;
3446
3447
3450 private String _facebookIntegration =
3451 PortletConstants.FACEBOOK_INTEGRATION_IFRAME;
3452
3453
3456 private boolean _addDefaultResource;
3457
3458
3461 private String[] _rolesArray;
3462
3463
3466 private Set<String> _unlinkedRoles;
3467
3468
3471 private Map<String, String> _roleMappers;
3472
3473
3477 private boolean _system;
3478
3479
3482 private boolean _include = true;
3483
3484
3487 private Map<String, String> _initParams;
3488
3489
3492 private Integer _expCache;
3493
3494
3497 private Map<String, Set<String>> _portletModes;
3498
3499
3502 private Map<String, Set<String>> _windowStates;
3503
3504
3507 private Set<String> _supportedLocales;
3508
3509
3512 private String _resourceBundle;
3513
3514
3517 private PortletInfo _portletInfo;
3518
3519
3522 private Map<String, PortletFilter> _portletFilters;
3523
3524
3527 private Set<QName> _processingEvents = new HashSet<QName>();
3528
3529
3532 private Map<String, QName> _processingEventsByQName =
3533 new HashMap<String, QName>();
3534
3535
3538 private Set<QName> _publishingEvents = new HashSet<QName>();
3539
3540
3543 private Set<PublicRenderParameter> _publicRenderParameters =
3544 new HashSet<PublicRenderParameter>();
3545
3546
3550 private Map<String, PublicRenderParameter>
3551 _publicRenderParametersByIdentifier =
3552 new HashMap<String, PublicRenderParameter>();
3553
3554
3558 private Map<String, PublicRenderParameter>
3559 _publicRenderParametersByQName =
3560 new HashMap<String, PublicRenderParameter>();
3561
3562
3565 private PortletApp _portletApp;
3566
3567
3570 private Map<String, Portlet> _clonedInstances;
3571
3572
3575 private boolean _staticPortlet;
3576
3577
3581 private boolean _staticPortletStart;
3582
3583
3586 private boolean _undeployedPortlet = false;
3587
3588}