001
014
015 package com.liferay.portal.model.impl;
016
017 import com.liferay.portal.kernel.atom.AtomCollectionAdapter;
018 import com.liferay.portal.kernel.lar.PortletDataHandler;
019 import com.liferay.portal.kernel.log.Log;
020 import com.liferay.portal.kernel.log.LogFactoryUtil;
021 import com.liferay.portal.kernel.plugin.PluginPackage;
022 import com.liferay.portal.kernel.poller.PollerProcessor;
023 import com.liferay.portal.kernel.pop.MessageListener;
024 import com.liferay.portal.kernel.portlet.ConfigurationAction;
025 import com.liferay.portal.kernel.portlet.FriendlyURLMapper;
026 import com.liferay.portal.kernel.portlet.PortletBag;
027 import com.liferay.portal.kernel.portlet.PortletBagPool;
028 import com.liferay.portal.kernel.portlet.PortletLayoutListener;
029 import com.liferay.portal.kernel.scheduler.SchedulerEntry;
030 import com.liferay.portal.kernel.search.Indexer;
031 import com.liferay.portal.kernel.search.OpenSearch;
032 import com.liferay.portal.kernel.servlet.ServletContextPool;
033 import com.liferay.portal.kernel.servlet.URLEncoder;
034 import com.liferay.portal.kernel.util.ContentTypes;
035 import com.liferay.portal.kernel.util.StringPool;
036 import com.liferay.portal.kernel.util.StringUtil;
037 import com.liferay.portal.kernel.util.Validator;
038 import com.liferay.portal.kernel.webdav.WebDAVStorage;
039 import com.liferay.portal.kernel.workflow.WorkflowHandler;
040 import com.liferay.portal.kernel.xml.QName;
041 import com.liferay.portal.kernel.xmlrpc.Method;
042 import com.liferay.portal.model.Plugin;
043 import com.liferay.portal.model.PluginSetting;
044 import com.liferay.portal.model.Portlet;
045 import com.liferay.portal.model.PortletApp;
046 import com.liferay.portal.model.PortletConstants;
047 import com.liferay.portal.model.PortletFilter;
048 import com.liferay.portal.model.PortletInfo;
049 import com.liferay.portal.model.PublicRenderParameter;
050 import com.liferay.portal.model.User;
051 import com.liferay.portal.security.permission.ActionKeys;
052 import com.liferay.portal.security.permission.PermissionChecker;
053 import com.liferay.portal.security.permission.PermissionCheckerFactoryUtil;
054 import com.liferay.portal.security.permission.PermissionPropagator;
055 import com.liferay.portal.security.permission.PermissionThreadLocal;
056 import com.liferay.portal.service.UserLocalServiceUtil;
057 import com.liferay.portal.service.permission.PortletPermissionUtil;
058 import com.liferay.portal.util.PortalUtil;
059 import com.liferay.portal.util.PropsValues;
060 import com.liferay.portlet.ControlPanelEntry;
061 import com.liferay.portlet.PortletQNameUtil;
062 import com.liferay.portlet.asset.model.AssetRendererFactory;
063 import com.liferay.portlet.expando.model.CustomAttributesDisplay;
064 import com.liferay.portlet.social.model.SocialActivityInterpreter;
065 import com.liferay.portlet.social.model.SocialRequestInterpreter;
066
067 import java.util.ArrayList;
068 import java.util.Arrays;
069 import java.util.Collections;
070 import java.util.HashMap;
071 import java.util.HashSet;
072 import java.util.Iterator;
073 import java.util.LinkedHashMap;
074 import java.util.LinkedHashSet;
075 import java.util.List;
076 import java.util.Map;
077 import java.util.Set;
078 import java.util.TreeSet;
079 import java.util.concurrent.ConcurrentHashMap;
080
081 import javax.portlet.PortletMode;
082 import javax.portlet.WindowState;
083
084 import javax.servlet.ServletContext;
085
086
089 public class PortletImpl extends PortletBaseImpl {
090
091
094 public PortletImpl() {
095 }
096
097
100 public PortletImpl(long companyId, String portletId) {
101 setCompanyId(companyId);
102 setPortletId(portletId);
103 setStrutsPath(portletId);
104 setActive(true);
105 _indexerClasses = new ArrayList<String>();
106 _schedulerEntries = new ArrayList<SchedulerEntry>();
107 _assetRendererFactoryClasses = new ArrayList<String>();
108 _atomCollectionAdapterClasses = new ArrayList<String>();
109 _customAttributesDisplayClasses = new ArrayList<String>();
110 _workflowHandlerClasses = new ArrayList<String>();
111 _autopropagatedParameters = new LinkedHashSet<String>();
112 _headerPortalCss = new ArrayList<String>();
113 _headerPortletCss = new ArrayList<String>();
114 _headerPortalJavaScript = new ArrayList<String>();
115 _headerPortletJavaScript = new ArrayList<String>();
116 _footerPortalCss = new ArrayList<String>();
117 _footerPortletCss = new ArrayList<String>();
118 _footerPortalJavaScript = new ArrayList<String>();
119 _footerPortletJavaScript = new ArrayList<String>();
120 _unlinkedRoles = new HashSet<String>();
121 _roleMappers = new LinkedHashMap<String, String>();
122 _initParams = new HashMap<String, String>();
123 _portletModes = new HashMap<String, Set<String>>();
124 _windowStates = new HashMap<String, Set<String>>();
125 _supportedLocales = new HashSet<String>();
126 _portletFilters = new LinkedHashMap<String, PortletFilter>();
127 _processingEvents = new HashSet<QName>();
128 _publishingEvents = new HashSet<QName>();
129 _publicRenderParameters = new HashSet<PublicRenderParameter>();
130 }
131
132
135 public PortletImpl(
136 String portletId, Portlet rootPortlet, PluginPackage pluginPackage,
137 PluginSetting pluginSetting, long companyId, long timestamp,
138 String icon, String virtualPath, String strutsPath,
139 String parentStrutsPath, String portletName, String displayName,
140 String portletClass, String configurationActionClass,
141 List <String> indexerClasses, String openSearchClass,
142 List<SchedulerEntry> schedulerEntries, String portletURLClass,
143 String friendlyURLMapperClass, String friendlyURLMapping,
144 String friendlyURLRoutes, String urlEncoderClass,
145 String portletDataHandlerClass, String portletLayoutListenerClass,
146 String pollerProcessorClass, String popMessageListenerClass,
147 String socialActivityInterpreterClass,
148 String socialRequestInterpreterClass, String webDAVStorageToken,
149 String webDAVStorageClass, String xmlRpcMethodClass,
150 String controlPanelEntryCategory, double controlPanelEntryWeight,
151 String controlPanelClass, List<String> assetRendererFactoryClasses,
152 List<String> atomCollectionAdapterClasses,
153 List<String> customAttributesDisplayClasses,
154 String permissionPropagatorClass, List<String> workflowHandlerClasses,
155 String defaultPreferences, String preferencesValidator,
156 boolean preferencesCompanyWide, boolean preferencesUniquePerLayout,
157 boolean preferencesOwnedByGroup, boolean useDefaultTemplate,
158 boolean showPortletAccessDenied, boolean showPortletInactive,
159 boolean actionURLRedirect, boolean restoreCurrentView,
160 boolean maximizeEdit, boolean maximizeHelp, boolean popUpPrint,
161 boolean layoutCacheable, boolean instanceable, boolean remoteable,
162 boolean scopeable, String userPrincipalStrategy,
163 boolean privateRequestAttributes, boolean privateSessionAttributes,
164 Set<String> autopropagatedParameters, int actionTimeout,
165 int renderTimeout, int renderWeight, boolean ajaxable,
166 List<String> headerPortalCss, List<String> headerPortletCss,
167 List<String> headerPortalJavaScript,
168 List<String> headerPortletJavaScript, List<String> footerPortalCss,
169 List<String> footerPortletCss, List<String> footerPortalJavaScript,
170 List<String> footerPortletJavaScript, String cssClassWrapper,
171 String facebookIntegration, boolean addDefaultResource, String roles,
172 Set<String> unlinkedRoles, Map<String, String> roleMappers,
173 boolean system, boolean active, boolean include,
174 Map<String, String> initParams, Integer expCache,
175 Map<String, Set<String>> portletModes,
176 Map<String, Set<String>> windowStates, Set<String> supportedLocales,
177 String resourceBundle, PortletInfo portletInfo,
178 Map<String, PortletFilter> portletFilters, Set<QName> processingEvents,
179 Set<QName> publishingEvents,
180 Set<PublicRenderParameter> publicRenderParameters,
181 PortletApp portletApp) {
182
183 setPortletId(portletId);
184 _rootPortlet = rootPortlet;
185 _pluginPackage = pluginPackage;
186 _defaultPluginSetting = pluginSetting;
187 setCompanyId(companyId);
188 _timestamp = timestamp;
189 _icon = icon;
190 _virtualPath = virtualPath;
191 _strutsPath = strutsPath;
192 _portletName = portletName;
193 _parentStrutsPath = parentStrutsPath;
194 _displayName = displayName;
195 _portletClass = portletClass;
196 _configurationActionClass = configurationActionClass;
197 _indexerClasses = indexerClasses;
198 _openSearchClass = openSearchClass;
199 _schedulerEntries = schedulerEntries;
200 _portletURLClass = portletURLClass;
201 _friendlyURLMapperClass = friendlyURLMapperClass;
202 _friendlyURLMapping = friendlyURLMapping;
203 _friendlyURLRoutes = friendlyURLRoutes;
204 _urlEncoderClass = urlEncoderClass;
205 _portletDataHandlerClass = portletDataHandlerClass;
206 _portletLayoutListenerClass = portletLayoutListenerClass;
207 _pollerProcessorClass = pollerProcessorClass;
208 _popMessageListenerClass = popMessageListenerClass;
209 _socialActivityInterpreterClass = socialActivityInterpreterClass;
210 _socialRequestInterpreterClass = socialRequestInterpreterClass;
211 _webDAVStorageToken = webDAVStorageToken;
212 _webDAVStorageClass = webDAVStorageClass;
213 _xmlRpcMethodClass = xmlRpcMethodClass;
214 _controlPanelEntryCategory = controlPanelEntryCategory;
215 _controlPanelEntryWeight = controlPanelEntryWeight;
216 _controlPanelEntryClass = controlPanelClass;
217 _assetRendererFactoryClasses = assetRendererFactoryClasses;
218 _atomCollectionAdapterClasses = atomCollectionAdapterClasses;
219 _customAttributesDisplayClasses = customAttributesDisplayClasses;
220 _permissionPropagatorClass = permissionPropagatorClass;
221 _workflowHandlerClasses = workflowHandlerClasses;
222 _defaultPreferences = defaultPreferences;
223 _preferencesValidator = preferencesValidator;
224 _preferencesCompanyWide = preferencesCompanyWide;
225 _preferencesUniquePerLayout = preferencesUniquePerLayout;
226 _preferencesOwnedByGroup = preferencesOwnedByGroup;
227 _useDefaultTemplate = useDefaultTemplate;
228 _showPortletAccessDenied = showPortletAccessDenied;
229 _showPortletInactive = showPortletInactive;
230 _actionURLRedirect = actionURLRedirect;
231 _restoreCurrentView = restoreCurrentView;
232 _maximizeEdit = maximizeEdit;
233 _maximizeHelp = maximizeHelp;
234 _popUpPrint = popUpPrint;
235 _layoutCacheable = layoutCacheable;
236 _instanceable = instanceable;
237 _remoteable = remoteable;
238 _scopeable = scopeable;
239 _userPrincipalStrategy = userPrincipalStrategy;
240 _privateRequestAttributes = privateRequestAttributes;
241 _privateSessionAttributes = privateSessionAttributes;
242 _autopropagatedParameters = autopropagatedParameters;
243 _actionTimeout = actionTimeout;
244 _renderTimeout = renderTimeout;
245 _renderWeight = renderWeight;
246 _ajaxable = ajaxable;
247 _headerPortalCss = headerPortalCss;
248 _headerPortletCss = headerPortletCss;
249 _headerPortalJavaScript = headerPortalJavaScript;
250 _headerPortletJavaScript = headerPortletJavaScript;
251 _footerPortalCss = footerPortalCss;
252 _footerPortletCss = footerPortletCss;
253 _footerPortalJavaScript = footerPortalJavaScript;
254 _footerPortletJavaScript = footerPortletJavaScript;
255 _cssClassWrapper = cssClassWrapper;
256 _facebookIntegration = facebookIntegration;
257 _scopeable = scopeable;
258 _addDefaultResource = addDefaultResource;
259 setRoles(roles);
260 _unlinkedRoles = unlinkedRoles;
261 _roleMappers = roleMappers;
262 _system = system;
263 setActive(active);
264 _include = include;
265 _initParams = initParams;
266 _expCache = expCache;
267 _portletModes = portletModes;
268 _windowStates = windowStates;
269 _supportedLocales = supportedLocales;
270 _resourceBundle = resourceBundle;
271 _portletInfo = portletInfo;
272 _portletFilters = portletFilters;
273 setProcessingEvents(processingEvents);
274 setPublishingEvents(publishingEvents);
275 setPublicRenderParameters(publicRenderParameters);
276 _portletApp = portletApp;
277 }
278
279
284 public Portlet getRootPortlet() {
285 return _rootPortlet;
286 }
287
288
293 public String getRootPortletId() {
294 return PortletConstants.getRootPortletId(getPortletId());
295 }
296
297
302 public String getInstanceId() {
303 return PortletConstants.getInstanceId(getPortletId());
304 }
305
306
311 public String getPluginId() {
312 return getRootPortletId();
313 }
314
315
320 public String getPluginType() {
321 return Plugin.TYPE_PORTLET;
322 }
323
324
329 public PluginPackage getPluginPackage() {
330 return _pluginPackage;
331 }
332
333
338 public void setPluginPackage(PluginPackage pluginPackage) {
339 _pluginPackage = pluginPackage;
340 }
341
342
347 public PluginSetting getDefaultPluginSetting() {
348 return _defaultPluginSetting;
349 }
350
351
356 public void setDefaultPluginSetting(PluginSetting pluginSetting) {
357 _defaultPluginSetting = pluginSetting;
358 }
359
360
365 public long getTimestamp() {
366 return _timestamp;
367 }
368
369
374 public void setTimestamp(long timestamp) {
375 _timestamp = timestamp;
376 }
377
378
383 public String getIcon() {
384 return _icon;
385 }
386
387
392 public void setIcon(String icon) {
393 _icon = icon;
394 }
395
396
401 public String getVirtualPath() {
402 return _virtualPath;
403 }
404
405
410 public void setVirtualPath(String virtualPath) {
411 if (_portletApp.isWARFile() && Validator.isNull(virtualPath)) {
412 virtualPath = PropsValues.PORTLET_VIRTUAL_PATH;
413 }
414
415 _virtualPath = virtualPath;
416 }
417
418
423 public String getStrutsPath() {
424 return _strutsPath;
425 }
426
427
432 public void setStrutsPath(String strutsPath) {
433 _strutsPath = strutsPath;
434 }
435
436
441 public String getParentStrutsPath() {
442 return _parentStrutsPath;
443 }
444
445
450 public void setParentStrutsPath(String parentStrutsPath) {
451 _parentStrutsPath = parentStrutsPath;
452 }
453
454
459 public String getPortletName() {
460 return _portletName;
461 }
462
463
468 public void setPortletName(String portletName) {
469 _portletName = portletName;
470 }
471
472
477 public String getDisplayName() {
478 return _displayName;
479 }
480
481
486 public void setDisplayName(String displayName) {
487 _displayName = displayName;
488 }
489
490
495 public String getPortletClass() {
496 return _portletClass;
497 }
498
499
504 public void setPortletClass(String portletClass) {
505 _portletClass = portletClass;
506 }
507
508
513 public String getConfigurationActionClass() {
514 return _configurationActionClass;
515 }
516
517
523 public void setConfigurationActionClass(String configurationActionClass) {
524 _configurationActionClass = configurationActionClass;
525 }
526
527
532 public ConfigurationAction getConfigurationActionInstance() {
533 if (Validator.isNull(getConfigurationActionClass())) {
534 return null;
535 }
536
537 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
538
539 return portletBag.getConfigurationActionInstance();
540 }
541
542
549 public List<String> getIndexerClasses() {
550 return _indexerClasses;
551 }
552
553
560 public void setIndexerClasses(List<String> indexerClasses) {
561 _indexerClasses = indexerClasses;
562 }
563
564
569 public List<Indexer> getIndexerInstances() {
570 if (getIndexerClasses().isEmpty()) {
571 return Collections.emptyList();
572 }
573
574 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
575
576 return portletBag.getIndexerInstances();
577 }
578
579
584 public String getOpenSearchClass() {
585 return _openSearchClass;
586 }
587
588
593 public void setOpenSearchClass(String openSearchClass) {
594 _openSearchClass = openSearchClass;
595 }
596
597
602 public OpenSearch getOpenSearchInstance() {
603 if (Validator.isNull(getOpenSearchClass())) {
604 return null;
605 }
606
607 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
608
609 return portletBag.getOpenSearchInstance();
610 }
611
612
615 public void addSchedulerEntry(SchedulerEntry schedulerEntry) {
616 _schedulerEntries.add(schedulerEntry);
617 }
618
619
624 public List<SchedulerEntry> getSchedulerEntries() {
625 return _schedulerEntries;
626 }
627
628
633 public void setSchedulerEntries(List<SchedulerEntry> schedulerEntries) {
634 for (SchedulerEntry schedulerEntry : schedulerEntries) {
635 addSchedulerEntry(schedulerEntry);
636 }
637 }
638
639
644 public String getPortletURLClass() {
645 return _portletURLClass;
646 }
647
648
653 public void setPortletURLClass(String portletURLClass) {
654 _portletURLClass = portletURLClass;
655 }
656
657
662 public String getFriendlyURLMapperClass() {
663 return _friendlyURLMapperClass;
664 }
665
666
672 public void setFriendlyURLMapperClass(String friendlyURLMapperClass) {
673 _friendlyURLMapperClass = friendlyURLMapperClass;
674 }
675
676
681 public FriendlyURLMapper getFriendlyURLMapperInstance() {
682 if (Validator.isNull(getFriendlyURLMapperClass())) {
683 return null;
684 }
685
686 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
687
688 return portletBag.getFriendlyURLMapperInstance();
689 }
690
691
696 public String getFriendlyURLMapping() {
697 return _friendlyURLMapping;
698 }
699
700
706 public void setFriendlyURLMapping(String friendlyURLMapping) {
707 _friendlyURLMapping = friendlyURLMapping;
708 }
709
710
717 public String getFriendlyURLRoutes() {
718 return _friendlyURLRoutes;
719 }
720
721
728 public void setFriendlyURLRoutes(String friendlyURLRoutes) {
729 _friendlyURLRoutes = friendlyURLRoutes;
730 }
731
732
737 public String getURLEncoderClass() {
738 return _urlEncoderClass;
739 }
740
741
746 public void setURLEncoderClass(String urlEncoderClass) {
747 _urlEncoderClass = urlEncoderClass;
748 }
749
750
755 public URLEncoder getURLEncoderInstance() {
756 if (Validator.isNull(getURLEncoderClass())) {
757 return null;
758 }
759
760 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
761
762 return portletBag.getURLEncoderInstance();
763 }
764
765
770 public String getPortletDataHandlerClass() {
771 return _portletDataHandlerClass;
772 }
773
774
780 public void setPortletDataHandlerClass(String portletDataHandlerClass) {
781 _portletDataHandlerClass = portletDataHandlerClass;
782 }
783
784
789 public PortletDataHandler getPortletDataHandlerInstance() {
790 if (Validator.isNull(getPortletDataHandlerClass())) {
791 return null;
792 }
793
794 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
795
796 return portletBag.getPortletDataHandlerInstance();
797 }
798
799
804 public String getPortletLayoutListenerClass() {
805 return _portletLayoutListenerClass;
806 }
807
808
814 public void setPortletLayoutListenerClass(
815 String portletLayoutListenerClass) {
816
817 _portletLayoutListenerClass = portletLayoutListenerClass;
818 }
819
820
825 public PortletLayoutListener getPortletLayoutListenerInstance() {
826 if (Validator.isNull(getPortletLayoutListenerClass())) {
827 return null;
828 }
829
830 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
831
832 return portletBag.getPortletLayoutListenerInstance();
833 }
834
835
840 public String getPollerProcessorClass() {
841 return _pollerProcessorClass;
842 }
843
844
850 public void setPollerProcessorClass(String pollerProcessorClass) {
851 _pollerProcessorClass = pollerProcessorClass;
852 }
853
854
859 public PollerProcessor getPollerProcessorInstance() {
860 if (Validator.isNull(getPollerProcessorClass())) {
861 return null;
862 }
863
864 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
865
866 return portletBag.getPollerProcessorInstance();
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 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
899
900 return portletBag.getPopMessageListenerInstance();
901 }
902
903
908 public String getSocialActivityInterpreterClass() {
909 return _socialActivityInterpreterClass;
910 }
911
912
918 public void setSocialActivityInterpreterClass(
919 String socialActivityInterpreterClass) {
920
921 _socialActivityInterpreterClass = socialActivityInterpreterClass;
922 }
923
924
931 public SocialActivityInterpreter getSocialActivityInterpreterInstance() {
932 if (Validator.isNull(getSocialActivityInterpreterClass())) {
933 return null;
934 }
935
936 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
937
938 return portletBag.getSocialActivityInterpreterInstance();
939 }
940
941
946 public String getSocialRequestInterpreterClass() {
947 return _socialRequestInterpreterClass;
948 }
949
950
956 public void setSocialRequestInterpreterClass(
957 String socialRequestInterpreterClass) {
958
959 _socialRequestInterpreterClass = socialRequestInterpreterClass;
960 }
961
962
969 public SocialRequestInterpreter getSocialRequestInterpreterInstance() {
970 if (Validator.isNull(getSocialRequestInterpreterClass())) {
971 return null;
972 }
973
974 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
975
976 return portletBag.getSocialRequestInterpreterInstance();
977 }
978
979
984 public String getWebDAVStorageToken() {
985 return _webDAVStorageToken;
986 }
987
988
994 public void setWebDAVStorageToken(String webDAVStorageToken) {
995 _webDAVStorageToken = webDAVStorageToken;
996 }
997
998
1003 public String getWebDAVStorageClass() {
1004 return _webDAVStorageClass;
1005 }
1006
1007
1013 public void setWebDAVStorageClass(String webDAVStorageClass) {
1014 _webDAVStorageClass = webDAVStorageClass;
1015 }
1016
1017
1022 public WebDAVStorage getWebDAVStorageInstance() {
1023 if (Validator.isNull(getWebDAVStorageClass())) {
1024 return null;
1025 }
1026
1027 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1028
1029 return portletBag.getWebDAVStorageInstance();
1030 }
1031
1032
1037 public String getXmlRpcMethodClass() {
1038 return _xmlRpcMethodClass;
1039 }
1040
1041
1047 public void setXmlRpcMethodClass(String xmlRpcMethodClass) {
1048 _xmlRpcMethodClass = xmlRpcMethodClass;
1049 }
1050
1051
1056 public Method getXmlRpcMethodInstance() {
1057 if (Validator.isNull(getXmlRpcMethodClass())) {
1058 return null;
1059 }
1060
1061 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1062
1063 return portletBag.getXmlRpcMethodInstance();
1064 }
1065
1066
1073 public String getControlPanelEntryCategory() {
1074 return _controlPanelEntryCategory;
1075 }
1076
1077
1084 public void setControlPanelEntryCategory(String controlPanelEntryCategory) {
1085 _controlPanelEntryCategory = controlPanelEntryCategory;
1086 }
1087
1088
1095 public double getControlPanelEntryWeight() {
1096 return _controlPanelEntryWeight;
1097 }
1098
1099
1107 public void setControlPanelEntryWeight(double controlPanelEntryWeight) {
1108 _controlPanelEntryWeight = controlPanelEntryWeight;
1109 }
1110
1111
1118 public String getControlPanelEntryClass() {
1119 return _controlPanelEntryClass;
1120 }
1121
1122
1129 public void setControlPanelEntryClass(String controlPanelEntryClass) {
1130 _controlPanelEntryClass = controlPanelEntryClass;
1131 }
1132
1133
1140 public ControlPanelEntry getControlPanelEntryInstance() {
1141 if (Validator.isNull(getControlPanelEntryClass())) {
1142 return null;
1143 }
1144
1145 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1146
1147 return portletBag.getControlPanelEntryInstance();
1148 }
1149
1150
1157 public List<String> getAssetRendererFactoryClasses() {
1158 return _assetRendererFactoryClasses;
1159 }
1160
1161
1168 public void setAssetRendererFactoryClasses(
1169 List<String> assetRendererFactoryClasses) {
1170
1171 _assetRendererFactoryClasses = assetRendererFactoryClasses;
1172 }
1173
1174
1179 public List<AssetRendererFactory> getAssetRendererFactoryInstances() {
1180 if (getAssetRendererFactoryClasses().isEmpty()) {
1181 return null;
1182 }
1183
1184 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1185
1186 return portletBag.getAssetRendererFactoryInstances();
1187 }
1188
1189
1196 public List<String> getAtomCollectionAdapterClasses() {
1197 return _atomCollectionAdapterClasses;
1198 }
1199
1200
1207 public void setAtomCollectionAdapterClasses(
1208 List<String> atomCollectionAdapterClasses) {
1209
1210 _atomCollectionAdapterClasses = atomCollectionAdapterClasses;
1211 }
1212
1213
1218 public List<AtomCollectionAdapter<?>> getAtomCollectionAdapterInstances() {
1219 if (getAtomCollectionAdapterClasses().isEmpty()) {
1220 return null;
1221 }
1222
1223 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1224
1225 return portletBag.getAtomCollectionAdapterInstances();
1226 }
1227
1228
1235 public List<String> getCustomAttributesDisplayClasses() {
1236 return _customAttributesDisplayClasses;
1237 }
1238
1239
1246 public void setCustomAttributesDisplayClasses(
1247 List<String> customAttributesDisplayClasses) {
1248
1249 _customAttributesDisplayClasses = customAttributesDisplayClasses;
1250 }
1251
1252
1257 public List<CustomAttributesDisplay> getCustomAttributesDisplayInstances() {
1258 if (getCustomAttributesDisplayClasses().isEmpty()) {
1259 return null;
1260 }
1261
1262 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1263
1264 return portletBag.getCustomAttributesDisplayInstances();
1265 }
1266
1267
1272 public String getPermissionPropagatorClass() {
1273 return _permissionPropagatorClass;
1274 }
1275
1276
1282 public void setPermissionPropagatorClass(String permissionPropagatorClass) {
1283 _permissionPropagatorClass = permissionPropagatorClass;
1284 }
1285
1286
1291 public PermissionPropagator getPermissionPropagatorInstance() {
1292 if (Validator.isNull(getPermissionPropagatorClass())) {
1293 return null;
1294 }
1295
1296 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1297
1298 return portletBag.getPermissionPropagatorInstance();
1299 }
1300
1301
1308 public List<String> getWorkflowHandlerClasses() {
1309 return _workflowHandlerClasses;
1310 }
1311
1312
1319 public void setWorkflowHandlerClasses(List<String> workflowHandlerClasses) {
1320 _workflowHandlerClasses = workflowHandlerClasses;
1321 }
1322
1323
1328 public List<WorkflowHandler> getWorkflowHandlerInstances() {
1329 if (getWorkflowHandlerClasses().isEmpty()) {
1330 return null;
1331 }
1332
1333 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1334
1335 return portletBag.getWorkflowHandlerInstances();
1336 }
1337
1338
1343 public String getDefaultPreferences() {
1344 if (Validator.isNull(_defaultPreferences)) {
1345 return PortletConstants.DEFAULT_PREFERENCES;
1346 }
1347 else {
1348 return _defaultPreferences;
1349 }
1350 }
1351
1352
1357 public void setDefaultPreferences(String defaultPreferences) {
1358 _defaultPreferences = defaultPreferences;
1359 }
1360
1361
1366 public String getPreferencesValidator() {
1367 return _preferencesValidator;
1368 }
1369
1370
1376 public void setPreferencesValidator(String preferencesValidator) {
1377 if (preferencesValidator != null) {
1378
1379
1380
1381
1382 _preferencesValidator = preferencesValidator.trim();
1383 }
1384 else {
1385 _preferencesValidator = null;
1386 }
1387 }
1388
1389
1396 public boolean getPreferencesCompanyWide() {
1397 return _preferencesCompanyWide;
1398 }
1399
1400
1407 public boolean isPreferencesCompanyWide() {
1408 return _preferencesCompanyWide;
1409 }
1410
1411
1418 public void setPreferencesCompanyWide(boolean preferencesCompanyWide) {
1419 _preferencesCompanyWide = preferencesCompanyWide;
1420 }
1421
1422
1427 public boolean getPreferencesUniquePerLayout() {
1428 return _preferencesUniquePerLayout;
1429 }
1430
1431
1436 public boolean isPreferencesUniquePerLayout() {
1437 return _preferencesUniquePerLayout;
1438 }
1439
1440
1446 public void setPreferencesUniquePerLayout(
1447 boolean preferencesUniquePerLayout) {
1448
1449 _preferencesUniquePerLayout = preferencesUniquePerLayout;
1450 }
1451
1452
1461 public boolean getPreferencesOwnedByGroup() {
1462 return _preferencesOwnedByGroup;
1463 }
1464
1465
1474 public boolean isPreferencesOwnedByGroup() {
1475 return _preferencesOwnedByGroup;
1476 }
1477
1478
1487 public void setPreferencesOwnedByGroup(boolean preferencesOwnedByGroup) {
1488 _preferencesOwnedByGroup = preferencesOwnedByGroup;
1489 }
1490
1491
1496 public boolean getUseDefaultTemplate() {
1497 return _useDefaultTemplate;
1498 }
1499
1500
1505 public boolean isUseDefaultTemplate() {
1506 return _useDefaultTemplate;
1507 }
1508
1509
1515 public void setUseDefaultTemplate(boolean useDefaultTemplate) {
1516 _useDefaultTemplate = useDefaultTemplate;
1517 }
1518
1519
1526 public boolean getShowPortletAccessDenied() {
1527 return _showPortletAccessDenied;
1528 }
1529
1530
1537 public boolean isShowPortletAccessDenied() {
1538 return _showPortletAccessDenied;
1539 }
1540
1541
1548 public void setShowPortletAccessDenied(boolean showPortletAccessDenied) {
1549 _showPortletAccessDenied = showPortletAccessDenied;
1550 }
1551
1552
1558 public boolean getShowPortletInactive() {
1559 return _showPortletInactive;
1560 }
1561
1562
1568 public boolean isShowPortletInactive() {
1569 return _showPortletInactive;
1570 }
1571
1572
1578 public void setShowPortletInactive(boolean showPortletInactive) {
1579 _showPortletInactive = showPortletInactive;
1580 }
1581
1582
1589 public boolean getActionURLRedirect() {
1590 return _actionURLRedirect;
1591 }
1592
1593
1600 public boolean isActionURLRedirect() {
1601 return _actionURLRedirect;
1602 }
1603
1604
1611 public void setActionURLRedirect(boolean actionURLRedirect) {
1612 _actionURLRedirect = actionURLRedirect;
1613 }
1614
1615
1622 public boolean getRestoreCurrentView() {
1623 return _restoreCurrentView;
1624 }
1625
1626
1633 public boolean isRestoreCurrentView() {
1634 return _restoreCurrentView;
1635 }
1636
1637
1644 public void setRestoreCurrentView(boolean restoreCurrentView) {
1645 _restoreCurrentView = restoreCurrentView;
1646 }
1647
1648
1655 public boolean getMaximizeEdit() {
1656 return _maximizeEdit;
1657 }
1658
1659
1666 public boolean isMaximizeEdit() {
1667 return _maximizeEdit;
1668 }
1669
1670
1677 public void setMaximizeEdit(boolean maximizeEdit) {
1678 _maximizeEdit = maximizeEdit;
1679 }
1680
1681
1688 public boolean getMaximizeHelp() {
1689 return _maximizeHelp;
1690 }
1691
1692
1699 public boolean isMaximizeHelp() {
1700 return _maximizeHelp;
1701 }
1702
1703
1710 public void setMaximizeHelp(boolean maximizeHelp) {
1711 _maximizeHelp = maximizeHelp;
1712 }
1713
1714
1721 public boolean getPopUpPrint() {
1722 return _popUpPrint;
1723 }
1724
1725
1732 public boolean isPopUpPrint() {
1733 return _popUpPrint;
1734 }
1735
1736
1743 public void setPopUpPrint(boolean popUpPrint) {
1744 _popUpPrint = popUpPrint;
1745 }
1746
1747
1753 public boolean getLayoutCacheable() {
1754 return _layoutCacheable;
1755 }
1756
1757
1763 public boolean isLayoutCacheable() {
1764 return _layoutCacheable;
1765 }
1766
1767
1774 public void setLayoutCacheable(boolean layoutCacheable) {
1775 _layoutCacheable = layoutCacheable;
1776 }
1777
1778
1785 public boolean getInstanceable() {
1786 return _instanceable;
1787 }
1788
1789
1796 public boolean isInstanceable() {
1797 return _instanceable;
1798 }
1799
1800
1807 public void setInstanceable(boolean instanceable) {
1808 _instanceable = instanceable;
1809 }
1810
1811
1816 public boolean getRemoteable() {
1817 return _remoteable;
1818 }
1819
1820
1825 public boolean isRemoteable() {
1826 return _remoteable;
1827 }
1828
1829
1835 public void setRemoteable(boolean remoteable) {
1836 _remoteable = remoteable;
1837 }
1838
1839
1844 public boolean getScopeable() {
1845 return _scopeable;
1846 }
1847
1848
1853 public boolean isScopeable() {
1854 return _scopeable;
1855 }
1856
1857
1863 public void setScopeable(boolean scopeable) {
1864 _scopeable = scopeable;
1865 }
1866
1867
1872 public String getUserPrincipalStrategy() {
1873 return _userPrincipalStrategy;
1874 }
1875
1876
1881 public void setUserPrincipalStrategy(String userPrincipalStrategy) {
1882 if (Validator.isNotNull(userPrincipalStrategy)) {
1883 _userPrincipalStrategy = userPrincipalStrategy;
1884 }
1885 }
1886
1887
1894 public boolean getPrivateRequestAttributes() {
1895 return _privateRequestAttributes;
1896 }
1897
1898
1905 public boolean isPrivateRequestAttributes() {
1906 return _privateRequestAttributes;
1907 }
1908
1909
1917 public void setPrivateRequestAttributes(boolean privateRequestAttributes) {
1918 _privateRequestAttributes = privateRequestAttributes;
1919 }
1920
1921
1928 public boolean getPrivateSessionAttributes() {
1929 return _privateSessionAttributes;
1930 }
1931
1932
1939 public boolean isPrivateSessionAttributes() {
1940 return _privateSessionAttributes;
1941 }
1942
1943
1950 public void setPrivateSessionAttributes(boolean privateSessionAttributes) {
1951 _privateSessionAttributes = privateSessionAttributes;
1952 }
1953
1954
1961 public Set<String> getAutopropagatedParameters() {
1962 return _autopropagatedParameters;
1963 }
1964
1965
1972 public void setAutopropagatedParameters(
1973 Set<String> autopropagatedParameters) {
1974
1975 _autopropagatedParameters = autopropagatedParameters;
1976 }
1977
1978
1983 public int getActionTimeout() {
1984 return _actionTimeout;
1985 }
1986
1987
1992 public void setActionTimeout(int actionTimeout) {
1993 _actionTimeout = actionTimeout;
1994 }
1995
1996
2001 public int getRenderTimeout() {
2002 return _renderTimeout;
2003 }
2004
2005
2010 public void setRenderTimeout(int renderTimeout) {
2011 _renderTimeout = renderTimeout;
2012 }
2013
2014
2019 public int getRenderWeight() {
2020 return _renderWeight;
2021 }
2022
2023
2028 public void setRenderWeight(int renderWeight) {
2029 _renderWeight = renderWeight;
2030 }
2031
2032
2037 public boolean getAjaxable() {
2038 return _ajaxable;
2039 }
2040
2041
2046 public boolean isAjaxable() {
2047 return _ajaxable;
2048 }
2049
2050
2056 public void setAjaxable(boolean ajaxable) {
2057 _ajaxable = ajaxable;
2058 }
2059
2060
2067 public List<String> getHeaderPortalCss() {
2068 return _headerPortalCss;
2069 }
2070
2071
2078 public void setHeaderPortalCss(List<String> headerPortalCss) {
2079 _headerPortalCss = headerPortalCss;
2080 }
2081
2082
2089 public List<String> getHeaderPortletCss() {
2090 return _headerPortletCss;
2091 }
2092
2093
2100 public void setHeaderPortletCss(List<String> headerPortletCss) {
2101 _headerPortletCss = headerPortletCss;
2102 }
2103
2104
2111 public List<String> getHeaderPortalJavaScript() {
2112 return _headerPortalJavaScript;
2113 }
2114
2115
2123 public void setHeaderPortalJavaScript(List<String> headerPortalJavaScript) {
2124 _headerPortalJavaScript = headerPortalJavaScript;
2125 }
2126
2127
2134 public List<String> getHeaderPortletJavaScript() {
2135 return _headerPortletJavaScript;
2136 }
2137
2138
2146 public void setHeaderPortletJavaScript(
2147 List<String> headerPortletJavaScript) {
2148
2149 _headerPortletJavaScript = headerPortletJavaScript;
2150 }
2151
2152
2159 public List<String> getFooterPortalCss() {
2160 return _footerPortalCss;
2161 }
2162
2163
2170 public void setFooterPortalCss(List<String> footerPortalCss) {
2171 _footerPortalCss = footerPortalCss;
2172 }
2173
2174
2181 public List<String> getFooterPortletCss() {
2182 return _footerPortletCss;
2183 }
2184
2185
2192 public void setFooterPortletCss(List<String> footerPortletCss) {
2193 _footerPortletCss = footerPortletCss;
2194 }
2195
2196
2203 public List<String> getFooterPortalJavaScript() {
2204 return _footerPortalJavaScript;
2205 }
2206
2207
2215 public void setFooterPortalJavaScript(List<String> footerPortalJavaScript) {
2216 _footerPortalJavaScript = footerPortalJavaScript;
2217 }
2218
2219
2226 public List<String> getFooterPortletJavaScript() {
2227 return _footerPortletJavaScript;
2228 }
2229
2230
2238 public void setFooterPortletJavaScript(
2239 List<String> footerPortletJavaScript) {
2240
2241 _footerPortletJavaScript = footerPortletJavaScript;
2242 }
2243
2244
2251 public String getCssClassWrapper() {
2252 return _cssClassWrapper;
2253 }
2254
2255
2262 public void setCssClassWrapper(String cssClassWrapper) {
2263 _cssClassWrapper = cssClassWrapper;
2264 }
2265
2266
2271 public String getFacebookIntegration() {
2272 return _facebookIntegration;
2273 }
2274
2275
2280 public void setFacebookIntegration(String facebookIntegration) {
2281 if (Validator.isNotNull(facebookIntegration)) {
2282 _facebookIntegration = facebookIntegration;
2283 }
2284 }
2285
2286
2293 public boolean getAddDefaultResource() {
2294 return _addDefaultResource;
2295 }
2296
2297
2304 public boolean isAddDefaultResource() {
2305 return _addDefaultResource;
2306 }
2307
2308
2315 public void setAddDefaultResource(boolean addDefaultResource) {
2316 _addDefaultResource = addDefaultResource;
2317 }
2318
2319
2324 @Override
2325 public void setRoles(String roles) {
2326 _rolesArray = StringUtil.split(roles);
2327
2328 super.setRoles(roles);
2329 }
2330
2331
2336 public String[] getRolesArray() {
2337 return _rolesArray;
2338 }
2339
2340
2345 public void setRolesArray(String[] rolesArray) {
2346 _rolesArray = rolesArray;
2347
2348 super.setRoles(StringUtil.merge(rolesArray));
2349 }
2350
2351
2356 public Set<String> getUnlinkedRoles() {
2357 return _unlinkedRoles;
2358 }
2359
2360
2365 public void setUnlinkedRoles(Set<String> unlinkedRoles) {
2366 _unlinkedRoles = unlinkedRoles;
2367 }
2368
2369
2374 public Map<String, String> getRoleMappers() {
2375 return _roleMappers;
2376 }
2377
2378
2383 public void setRoleMappers(Map<String, String> roleMappers) {
2384 _roleMappers = roleMappers;
2385 }
2386
2387
2391 public void linkRoles() {
2392 List<String> linkedRoles = new ArrayList<String>();
2393
2394 Iterator<String> itr = _unlinkedRoles.iterator();
2395
2396 while (itr.hasNext()) {
2397 String unlinkedRole = itr.next();
2398
2399 String roleLink = _roleMappers.get(unlinkedRole);
2400
2401 if (Validator.isNotNull(roleLink)) {
2402 if (_log.isDebugEnabled()) {
2403 _log.debug(
2404 "Linking role for portlet [" + getPortletId() +
2405 "] with role-name [" + unlinkedRole +
2406 "] to role-link [" + roleLink + "]");
2407 }
2408
2409 linkedRoles.add(roleLink);
2410 }
2411 else {
2412 _log.error(
2413 "Unable to link role for portlet [" + getPortletId() +
2414 "] with role-name [" + unlinkedRole +
2415 "] because role-link is null");
2416 }
2417 }
2418
2419 String[] array = linkedRoles.toArray(new String[linkedRoles.size()]);
2420
2421 Arrays.sort(array);
2422
2423 setRolesArray(array);
2424 }
2425
2426
2433 public boolean hasRoleWithName(String roleName) {
2434 if ((_rolesArray == null) || (_rolesArray.length == 0)) {
2435 return false;
2436 }
2437
2438 for (int i = 0; i < _rolesArray.length; i++) {
2439 if (_rolesArray[i].equalsIgnoreCase(roleName)) {
2440 return true;
2441 }
2442 }
2443
2444 return false;
2445 }
2446
2447
2454 public boolean hasAddPortletPermission(long userId) {
2455 PermissionChecker permissionChecker =
2456 PermissionThreadLocal.getPermissionChecker();
2457
2458 try {
2459 if ((permissionChecker == null) ||
2460 (permissionChecker.getUserId() != userId)) {
2461
2462 User user = UserLocalServiceUtil.getUser(userId);
2463
2464 permissionChecker = PermissionCheckerFactoryUtil.create(
2465 user, true);
2466 }
2467
2468 if (PortletPermissionUtil.contains(
2469 permissionChecker, getRootPortletId(),
2470 ActionKeys.ADD_TO_PAGE)) {
2471
2472 return true;
2473 }
2474 }
2475 catch (Exception e) {
2476 _log.error(e, e);
2477 }
2478
2479 return false;
2480 }
2481
2482
2489 public boolean getSystem() {
2490 return _system;
2491 }
2492
2493
2500 public boolean isSystem() {
2501 return _system;
2502 }
2503
2504
2511 public void setSystem(boolean system) {
2512 _system = system;
2513 }
2514
2515
2522 public boolean getInclude() {
2523 return _include;
2524 }
2525
2526
2533 public boolean isInclude() {
2534 return _include;
2535 }
2536
2537
2544 public void setInclude(boolean include) {
2545 _include = include;
2546 }
2547
2548
2553 public boolean getReady() {
2554 return isReady();
2555 }
2556
2557
2562 public boolean isReady() {
2563 Boolean ready = _readyMap.get(getRootPortletId());
2564
2565 if (ready == null) {
2566 return true;
2567 }
2568 else {
2569 return ready;
2570 }
2571 }
2572
2573
2578 public void setReady(boolean ready) {
2579 _readyMap.put(getRootPortletId(), ready);
2580 }
2581
2582
2587 public Map<String, String> getInitParams() {
2588 return _initParams;
2589 }
2590
2591
2596 public void setInitParams(Map<String, String> initParams) {
2597 _initParams = initParams;
2598 }
2599
2600
2605 public Integer getExpCache() {
2606 return _expCache;
2607 }
2608
2609
2614 public void setExpCache(Integer expCache) {
2615 _expCache = expCache;
2616 }
2617
2618
2623 public Map<String, Set<String>> getPortletModes() {
2624 return _portletModes;
2625 }
2626
2627
2632 public void setPortletModes(Map<String, Set<String>> portletModes) {
2633 _portletModes = portletModes;
2634 }
2635
2636
2643 public boolean hasPortletMode(String mimeType, PortletMode portletMode) {
2644 if (mimeType == null) {
2645 mimeType = ContentTypes.TEXT_HTML;
2646 }
2647
2648 Set<String> mimeTypePortletModes = _portletModes.get(mimeType);
2649
2650 if (mimeTypePortletModes == null) {
2651 return false;
2652 }
2653
2654 if (mimeTypePortletModes.contains(portletMode.toString())) {
2655 return true;
2656 }
2657 else {
2658 return false;
2659 }
2660 }
2661
2662
2667 public Set<String> getAllPortletModes() {
2668 Set<String> allPortletModes = new TreeSet<String>();
2669
2670 Iterator<Map.Entry <String, Set<String>>> itr1 =
2671 _portletModes.entrySet().iterator();
2672
2673 while (itr1.hasNext()) {
2674 Map.Entry<String, Set<String>> entry = itr1.next();
2675
2676 Set<String> mimeTypePortletModes = entry.getValue();
2677
2678 Iterator<String> itr2 = mimeTypePortletModes.iterator();
2679
2680 while (itr2.hasNext()) {
2681 String portletMode = itr2.next();
2682
2683 allPortletModes.add(portletMode);
2684 }
2685 }
2686
2687 return allPortletModes;
2688 }
2689
2690
2696 public boolean hasMultipleMimeTypes() {
2697 if (_portletModes.size() > 1) {
2698 return true;
2699 }
2700 else {
2701 return false;
2702 }
2703 }
2704
2705
2710 public Map<String, Set<String>> getWindowStates() {
2711 return _windowStates;
2712 }
2713
2714
2719 public void setWindowStates(Map<String, Set<String>> windowStates) {
2720 _windowStates = windowStates;
2721 }
2722
2723
2730 public boolean hasWindowState(String mimeType, WindowState windowState) {
2731 if (mimeType == null) {
2732 mimeType = ContentTypes.TEXT_HTML;
2733 }
2734
2735 Set<String> mimeTypeWindowStates = _windowStates.get(mimeType);
2736
2737 if (mimeTypeWindowStates == null) {
2738 return false;
2739 }
2740
2741 if (mimeTypeWindowStates.contains(windowState.toString())) {
2742 return true;
2743 }
2744 else {
2745 return false;
2746 }
2747 }
2748
2749
2754 public Set<String> getAllWindowStates() {
2755 Set<String> allWindowStates = new TreeSet<String>();
2756
2757 Iterator<Map.Entry <String, Set<String>>> itr1 =
2758 _windowStates.entrySet().iterator();
2759
2760 while (itr1.hasNext()) {
2761 Map.Entry<String, Set<String>> entry = itr1.next();
2762
2763 Set<String> mimeTypeWindowStates = entry.getValue();
2764
2765 Iterator<String> itr2 = mimeTypeWindowStates.iterator();
2766
2767 while (itr2.hasNext()) {
2768 String windowState = itr2.next();
2769
2770 allWindowStates.add(windowState);
2771 }
2772 }
2773
2774 return allWindowStates;
2775 }
2776
2777
2782 public Set<String> getSupportedLocales() {
2783 return _supportedLocales;
2784 }
2785
2786
2791 public void setSupportedLocales(Set<String> supportedLocales) {
2792 _supportedLocales = supportedLocales;
2793 }
2794
2795
2800 public String getResourceBundle() {
2801 return _resourceBundle;
2802 }
2803
2804
2809 public void setResourceBundle(String resourceBundle) {
2810 _resourceBundle = resourceBundle;
2811 }
2812
2813
2818 public PortletInfo getPortletInfo() {
2819 return _portletInfo;
2820 }
2821
2822
2827 public void setPortletInfo(PortletInfo portletInfo) {
2828 _portletInfo = portletInfo;
2829 }
2830
2831
2836 public Map<String, PortletFilter> getPortletFilters() {
2837 return _portletFilters;
2838 }
2839
2840
2845 public void setPortletFilters(Map<String, PortletFilter> portletFilters) {
2846 _portletFilters = portletFilters;
2847 }
2848
2849
2852 public void addProcessingEvent(QName processingEvent) {
2853 _processingEvents.add(processingEvent);
2854 _processingEventsByQName.put(
2855 PortletQNameUtil.getKey(processingEvent), processingEvent);
2856 }
2857
2858
2865 public QName getProcessingEvent(String uri, String localPart) {
2866 return _processingEventsByQName.get(
2867 PortletQNameUtil.getKey(uri, localPart));
2868 }
2869
2870
2875 public Set<QName> getProcessingEvents() {
2876 return _processingEvents;
2877 }
2878
2879
2884 public void setProcessingEvents(Set<QName> processingEvents) {
2885 for (QName processingEvent : processingEvents) {
2886 addProcessingEvent(processingEvent);
2887 }
2888 }
2889
2890
2893 public void addPublishingEvent(QName publishingEvent) {
2894 _publishingEvents.add(publishingEvent);
2895 }
2896
2897
2902 public Set<QName> getPublishingEvents() {
2903 return _publishingEvents;
2904 }
2905
2906
2911 public void setPublishingEvents(Set<QName> publishingEvents) {
2912 for (QName publishingEvent : publishingEvents) {
2913 addPublishingEvent(publishingEvent);
2914 }
2915 }
2916
2917
2922 public void addPublicRenderParameter(
2923 PublicRenderParameter publicRenderParameter) {
2924
2925 _publicRenderParameters.add(publicRenderParameter);
2926
2927 String identifier = publicRenderParameter.getIdentifier();
2928
2929 _publicRenderParametersByIdentifier.put(
2930 identifier, publicRenderParameter);
2931
2932 QName qName = publicRenderParameter.getQName();
2933
2934 _publicRenderParametersByQName.put(
2935 PortletQNameUtil.getKey(qName), publicRenderParameter);
2936
2937 String publicRenderParameterName =
2938 PortletQNameUtil.getPublicRenderParameterName(qName);
2939
2940 PortletQNameUtil.setPublicRenderParameterIdentifier(
2941 publicRenderParameterName, identifier);
2942 }
2943
2944
2949 public PublicRenderParameter getPublicRenderParameter(String identifier) {
2950 return _publicRenderParametersByIdentifier.get(identifier);
2951 }
2952
2953
2960 public PublicRenderParameter getPublicRenderParameter(
2961 String uri, String localPart) {
2962
2963 return _publicRenderParametersByQName.get(
2964 PortletQNameUtil.getKey(uri, localPart));
2965 }
2966
2967
2972 public Set<PublicRenderParameter> getPublicRenderParameters() {
2973 return _publicRenderParameters;
2974 }
2975
2976
2982 public void setPublicRenderParameters(
2983 Set<PublicRenderParameter> publicRenderParameters) {
2984
2985 for (PublicRenderParameter publicRenderParameter :
2986 publicRenderParameters) {
2987
2988 addPublicRenderParameter(publicRenderParameter);
2989 }
2990 }
2991
2992
2997 public String getContextPath() {
2998 if (!_portletApp.isWARFile()) {
2999 return PortalUtil.getPathContext();
3000 }
3001
3002 String servletContextName = _portletApp.getServletContextName();
3003
3004 if (ServletContextPool.containsKey(servletContextName)) {
3005 ServletContext servletContext = ServletContextPool.get(
3006 servletContextName);
3007
3008 return servletContext.getContextPath();
3009 }
3010
3011 return StringPool.SLASH.concat(servletContextName);
3012 }
3013
3014
3019 public String getStaticResourcePath() {
3020 String proxyPath = PortalUtil.getPathProxy();
3021
3022 String virtualPath = getVirtualPath();
3023
3024 if (Validator.isNotNull(virtualPath)) {
3025 return proxyPath.concat(virtualPath);
3026 }
3027
3028 String contextPath = getContextPath();
3029
3030 if (!_portletApp.isWARFile()) {
3031 return contextPath;
3032 }
3033
3034 return proxyPath.concat(contextPath);
3035 }
3036
3037
3042 public PortletApp getPortletApp() {
3043 return _portletApp;
3044 }
3045
3046
3051 public void setPortletApp(PortletApp portletApp) {
3052 _portletApp = portletApp;
3053
3054 _portletApp.addPortlet(this);
3055 }
3056
3057
3063 public Portlet getClonedInstance(String portletId) {
3064 Portlet portlet = (Portlet)clone();
3065
3066 portlet.setPortletId(portletId);
3067
3068 return portlet;
3069 }
3070
3071
3078 public boolean getStatic() {
3079 return _staticPortlet;
3080 }
3081
3082
3089 public boolean isStatic() {
3090 return _staticPortlet;
3091 }
3092
3093
3100 public void setStatic(boolean staticPortlet) {
3101 _staticPortlet = staticPortlet;
3102 }
3103
3104
3111 public boolean getStaticStart() {
3112 return _staticPortletStart;
3113 }
3114
3115
3122 public boolean isStaticStart() {
3123 return _staticPortletStart;
3124 }
3125
3126
3133 public void setStaticStart(boolean staticPortletStart) {
3134 _staticPortletStart = staticPortletStart;
3135 }
3136
3137
3144 public boolean getStaticEnd() {
3145 return !_staticPortletStart;
3146 }
3147
3148
3155 public boolean isStaticEnd() {
3156 return !_staticPortletStart;
3157 }
3158
3159
3165 public boolean getUndeployedPortlet() {
3166 return _undeployedPortlet;
3167 }
3168
3169
3175 public boolean isUndeployedPortlet() {
3176 return _undeployedPortlet;
3177 }
3178
3179
3185 public void setUndeployedPortlet(boolean undeployedPortlet) {
3186 _undeployedPortlet = undeployedPortlet;
3187 }
3188
3189
3194 @Override
3195 public Object clone() {
3196 Portlet portlet = new PortletImpl(
3197 getPortletId(), getRootPortlet(), getPluginPackage(),
3198 getDefaultPluginSetting(), getCompanyId(), getTimestamp(),
3199 getIcon(), getVirtualPath(), getStrutsPath(), getParentStrutsPath(),
3200 getPortletName(), getDisplayName(), getPortletClass(),
3201 getConfigurationActionClass(), getIndexerClasses(),
3202 getOpenSearchClass(), getSchedulerEntries(), getPortletURLClass(),
3203 getFriendlyURLMapperClass(), getFriendlyURLMapping(),
3204 getFriendlyURLRoutes(), getURLEncoderClass(),
3205 getPortletDataHandlerClass(), getPortletLayoutListenerClass(),
3206 getPollerProcessorClass(), getPopMessageListenerClass(),
3207 getSocialActivityInterpreterClass(),
3208 getSocialRequestInterpreterClass(), getWebDAVStorageToken(),
3209 getWebDAVStorageClass(), getXmlRpcMethodClass(),
3210 getControlPanelEntryCategory(), getControlPanelEntryWeight(),
3211 getControlPanelEntryClass(), getAssetRendererFactoryClasses(),
3212 getAtomCollectionAdapterClasses(),
3213 getCustomAttributesDisplayClasses(), getPermissionPropagatorClass(),
3214 getWorkflowHandlerClasses(), getDefaultPreferences(),
3215 getPreferencesValidator(), isPreferencesCompanyWide(),
3216 isPreferencesUniquePerLayout(), isPreferencesOwnedByGroup(),
3217 isUseDefaultTemplate(), isShowPortletAccessDenied(),
3218 isShowPortletInactive(), isActionURLRedirect(),
3219 isRestoreCurrentView(), isMaximizeEdit(), isMaximizeHelp(),
3220 isPopUpPrint(), isLayoutCacheable(), isInstanceable(),
3221 isRemoteable(), isScopeable(), getUserPrincipalStrategy(),
3222 isPrivateRequestAttributes(), isPrivateSessionAttributes(),
3223 getAutopropagatedParameters(), getActionTimeout(),
3224 getRenderTimeout(), getRenderWeight(), isAjaxable(),
3225 getHeaderPortalCss(), getHeaderPortletCss(),
3226 getHeaderPortalJavaScript(), getHeaderPortletJavaScript(),
3227 getFooterPortalCss(), getFooterPortletCss(),
3228 getFooterPortalJavaScript(), getFooterPortletJavaScript(),
3229 getCssClassWrapper(), getFacebookIntegration(),
3230 isAddDefaultResource(), getRoles(), getUnlinkedRoles(),
3231 getRoleMappers(), isSystem(), isActive(), isInclude(),
3232 getInitParams(), getExpCache(), getPortletModes(),
3233 getWindowStates(), getSupportedLocales(), getResourceBundle(),
3234 getPortletInfo(), getPortletFilters(), getProcessingEvents(),
3235 getPublishingEvents(), getPublicRenderParameters(),
3236 getPortletApp());
3237
3238 portlet.setId(getId());
3239 portlet.setUndeployedPortlet(isUndeployedPortlet());
3240
3241 return portlet;
3242 }
3243
3244
3253 @Override
3254 public int compareTo(Portlet portlet) {
3255 return getPortletId().compareTo(portlet.getPortletId());
3256 }
3257
3258
3264 @Override
3265 public boolean equals(Object obj) {
3266 Portlet portlet = (Portlet)obj;
3267
3268 return getPortletId().equals(portlet.getPortletId());
3269 }
3270
3271
3274 private static Log _log = LogFactoryUtil.getLog(PortletImpl.class);
3275
3276
3279 private static Map<String, Boolean> _readyMap =
3280 new ConcurrentHashMap<String, Boolean>();
3281
3282
3285 private Portlet _rootPortlet = this;
3286
3287
3290 private PluginPackage _pluginPackage;
3291
3292
3295 private PluginSetting _defaultPluginSetting;
3296
3297
3300 private long _timestamp;
3301
3302
3305 private String _icon;
3306
3307
3310 private String _virtualPath;
3311
3312
3315 private String _strutsPath;
3316
3317
3320 private String _parentStrutsPath;
3321
3322
3325 private String _portletName;
3326
3327
3330 private String _displayName;
3331
3332
3335 private String _portletClass;
3336
3337
3340 private String _configurationActionClass;
3341
3342
3346 private List<String> _indexerClasses;
3347
3348
3351 private String _openSearchClass;
3352
3353
3356 private List<SchedulerEntry> _schedulerEntries;
3357
3358
3361 private String _portletURLClass;
3362
3363
3366 private String _friendlyURLMapperClass;
3367
3368
3371 private String _friendlyURLMapping;
3372
3373
3377 private String _friendlyURLRoutes;
3378
3379
3382 private String _urlEncoderClass;
3383
3384
3387 private String _portletDataHandlerClass;
3388
3389
3392 private String _portletLayoutListenerClass;
3393
3394
3397 private String _pollerProcessorClass;
3398
3399
3402 private String _popMessageListenerClass;
3403
3404
3407 private String _socialActivityInterpreterClass;
3408
3409
3412 private String _socialRequestInterpreterClass;
3413
3414
3417 private String _webDAVStorageToken;
3418
3419
3422 private String _webDAVStorageClass;
3423
3424
3427 private String _xmlRpcMethodClass;
3428
3429
3432 private String _defaultPreferences;
3433
3434
3437 private String _preferencesValidator;
3438
3439
3442 private boolean _preferencesCompanyWide;
3443
3444
3447 private boolean _preferencesUniquePerLayout = true;
3448
3449
3454 private boolean _preferencesOwnedByGroup = true;
3455
3456
3460 private String _controlPanelEntryCategory;
3461
3462
3466 private double _controlPanelEntryWeight = 100;
3467
3468
3472 private String _controlPanelEntryClass;
3473
3474
3478 private List<String> _assetRendererFactoryClasses;
3479
3480
3484 private List<String> _atomCollectionAdapterClasses;
3485
3486
3490 private List<String> _customAttributesDisplayClasses;
3491
3492
3495 private String _permissionPropagatorClass;
3496
3497
3501 private List<String> _workflowHandlerClasses;
3502
3503
3506 private boolean _useDefaultTemplate = true;
3507
3508
3512 private boolean _showPortletAccessDenied =
3513 PropsValues.LAYOUT_SHOW_PORTLET_ACCESS_DENIED;
3514
3515
3518 private boolean _showPortletInactive =
3519 PropsValues.LAYOUT_SHOW_PORTLET_INACTIVE;
3520
3521
3525 private boolean _actionURLRedirect;
3526
3527
3531 private boolean _restoreCurrentView = true;
3532
3533
3537 private boolean _maximizeEdit;
3538
3539
3543 private boolean _maximizeHelp;
3544
3545
3549 private boolean _popUpPrint = true;
3550
3551
3554 private boolean _layoutCacheable;
3555
3556
3559 private boolean _instanceable;
3560
3561
3564 private boolean _remoteable;
3565
3566
3569 private boolean _scopeable;
3570
3571
3574 private String _userPrincipalStrategy =
3575 PortletConstants.USER_PRINCIPAL_STRATEGY_USER_ID;
3576
3577
3581 private boolean _privateRequestAttributes = true;
3582
3583
3587 private boolean _privateSessionAttributes = true;
3588
3589
3593 private Set<String> _autopropagatedParameters;
3594
3595
3598 private int _actionTimeout;
3599
3600
3603 private int _renderTimeout;
3604
3605
3608 private int _renderWeight = 1;
3609
3610
3613 private boolean _ajaxable = true;
3614
3615
3619 private List<String> _headerPortalCss;
3620
3621
3625 private List<String> _headerPortletCss;
3626
3627
3631 private List<String> _headerPortalJavaScript;
3632
3633
3637 private List<String> _headerPortletJavaScript;
3638
3639
3643 private List<String> _footerPortalCss;
3644
3645
3649 private List<String> _footerPortletCss;
3650
3651
3655 private List<String> _footerPortalJavaScript;
3656
3657
3661 private List<String> _footerPortletJavaScript;
3662
3663
3667 private String _cssClassWrapper = StringPool.BLANK;
3668
3669
3672 private String _facebookIntegration =
3673 PortletConstants.FACEBOOK_INTEGRATION_IFRAME;
3674
3675
3679 private boolean _addDefaultResource;
3680
3681
3684 private String[] _rolesArray = new String[0];
3685
3686
3689 private Set<String> _unlinkedRoles;
3690
3691
3694 private Map<String, String> _roleMappers;
3695
3696
3700 private boolean _system;
3701
3702
3706 private boolean _include = true;
3707
3708
3711 private Map<String, String> _initParams;
3712
3713
3716 private Integer _expCache;
3717
3718
3721 private Map<String, Set<String>> _portletModes;
3722
3723
3726 private Map<String, Set<String>> _windowStates;
3727
3728
3731 private Set<String> _supportedLocales;
3732
3733
3736 private String _resourceBundle;
3737
3738
3741 private PortletInfo _portletInfo;
3742
3743
3746 private Map<String, PortletFilter> _portletFilters;
3747
3748
3751 private Set<QName> _processingEvents = new HashSet<QName>();
3752
3753
3756 private Map<String, QName> _processingEventsByQName =
3757 new HashMap<String, QName>();
3758
3759
3762 private Set<QName> _publishingEvents = new HashSet<QName>();
3763
3764
3767 private Set<PublicRenderParameter> _publicRenderParameters =
3768 new HashSet<PublicRenderParameter>();
3769
3770
3774 private Map<String, PublicRenderParameter>
3775 _publicRenderParametersByIdentifier =
3776 new HashMap<String, PublicRenderParameter>();
3777
3778
3782 private Map<String, PublicRenderParameter>
3783 _publicRenderParametersByQName =
3784 new HashMap<String, PublicRenderParameter>();
3785
3786
3789 private PortletApp _portletApp;
3790
3791
3795 private boolean _staticPortlet;
3796
3797
3801 private boolean _staticPortletStart;
3802
3803
3806 private boolean _undeployedPortlet = false;
3807
3808 }