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.ContextPathUtil;
036 import com.liferay.portal.kernel.util.StringPool;
037 import com.liferay.portal.kernel.util.StringUtil;
038 import com.liferay.portal.kernel.util.Validator;
039 import com.liferay.portal.kernel.webdav.WebDAVStorage;
040 import com.liferay.portal.kernel.workflow.WorkflowHandler;
041 import com.liferay.portal.kernel.xml.QName;
042 import com.liferay.portal.kernel.xmlrpc.Method;
043 import com.liferay.portal.model.Plugin;
044 import com.liferay.portal.model.PluginSetting;
045 import com.liferay.portal.model.Portlet;
046 import com.liferay.portal.model.PortletApp;
047 import com.liferay.portal.model.PortletConstants;
048 import com.liferay.portal.model.PortletFilter;
049 import com.liferay.portal.model.PortletInfo;
050 import com.liferay.portal.model.PublicRenderParameter;
051 import com.liferay.portal.model.User;
052 import com.liferay.portal.security.permission.ActionKeys;
053 import com.liferay.portal.security.permission.PermissionChecker;
054 import com.liferay.portal.security.permission.PermissionCheckerFactoryUtil;
055 import com.liferay.portal.security.permission.PermissionPropagator;
056 import com.liferay.portal.security.permission.PermissionThreadLocal;
057 import com.liferay.portal.service.UserLocalServiceUtil;
058 import com.liferay.portal.service.permission.PortletPermissionUtil;
059 import com.liferay.portal.util.PortalUtil;
060 import com.liferay.portal.util.PropsValues;
061 import com.liferay.portlet.ControlPanelEntry;
062 import com.liferay.portlet.PortletQNameUtil;
063 import com.liferay.portlet.asset.model.AssetRendererFactory;
064 import com.liferay.portlet.expando.model.CustomAttributesDisplay;
065 import com.liferay.portlet.social.model.SocialActivityInterpreter;
066 import com.liferay.portlet.social.model.SocialRequestInterpreter;
067
068 import java.util.ArrayList;
069 import java.util.Arrays;
070 import java.util.Collections;
071 import java.util.HashMap;
072 import java.util.HashSet;
073 import java.util.Iterator;
074 import java.util.LinkedHashMap;
075 import java.util.LinkedHashSet;
076 import java.util.List;
077 import java.util.Map;
078 import java.util.Set;
079 import java.util.TreeSet;
080 import java.util.concurrent.ConcurrentHashMap;
081
082 import javax.portlet.PortletMode;
083 import javax.portlet.WindowState;
084
085 import javax.servlet.ServletContext;
086
087
090 public class PortletImpl extends PortletBaseImpl {
091
092
095 public PortletImpl() {
096 }
097
098
101 public PortletImpl(long companyId, String portletId) {
102 setCompanyId(companyId);
103 setPortletId(portletId);
104 setStrutsPath(portletId);
105 setActive(true);
106 _indexerClasses = new ArrayList<String>();
107 _schedulerEntries = new ArrayList<SchedulerEntry>();
108 _assetRendererFactoryClasses = new ArrayList<String>();
109 _atomCollectionAdapterClasses = new ArrayList<String>();
110 _customAttributesDisplayClasses = new ArrayList<String>();
111 _workflowHandlerClasses = new ArrayList<String>();
112 _autopropagatedParameters = new LinkedHashSet<String>();
113 _headerPortalCss = new ArrayList<String>();
114 _headerPortletCss = new ArrayList<String>();
115 _headerPortalJavaScript = new ArrayList<String>();
116 _headerPortletJavaScript = new ArrayList<String>();
117 _footerPortalCss = new ArrayList<String>();
118 _footerPortletCss = new ArrayList<String>();
119 _footerPortalJavaScript = new ArrayList<String>();
120 _footerPortletJavaScript = new ArrayList<String>();
121 _unlinkedRoles = new HashSet<String>();
122 _roleMappers = new LinkedHashMap<String, String>();
123 _initParams = new HashMap<String, String>();
124 _portletModes = new HashMap<String, Set<String>>();
125 _windowStates = new HashMap<String, Set<String>>();
126 _supportedLocales = new HashSet<String>();
127 _portletFilters = new LinkedHashMap<String, PortletFilter>();
128 _processingEvents = new HashSet<QName>();
129 _publishingEvents = new HashSet<QName>();
130 _publicRenderParameters = new HashSet<PublicRenderParameter>();
131 }
132
133
136 public PortletImpl(
137 String portletId, Portlet rootPortlet, PluginPackage pluginPackage,
138 PluginSetting pluginSetting, long companyId, long timestamp,
139 String icon, String virtualPath, String strutsPath,
140 String parentStrutsPath, String portletName, String displayName,
141 String portletClass, String configurationActionClass,
142 List<String> indexerClasses, String openSearchClass,
143 List<SchedulerEntry> schedulerEntries, String portletURLClass,
144 String friendlyURLMapperClass, String friendlyURLMapping,
145 String friendlyURLRoutes, String urlEncoderClass,
146 String portletDataHandlerClass, String portletLayoutListenerClass,
147 String pollerProcessorClass, String popMessageListenerClass,
148 String socialActivityInterpreterClass,
149 String socialRequestInterpreterClass, String webDAVStorageToken,
150 String webDAVStorageClass, String xmlRpcMethodClass,
151 String controlPanelEntryCategory, double controlPanelEntryWeight,
152 String controlPanelClass, List<String> assetRendererFactoryClasses,
153 List<String> atomCollectionAdapterClasses,
154 List<String> customAttributesDisplayClasses,
155 String permissionPropagatorClass, List<String> workflowHandlerClasses,
156 String defaultPreferences, String preferencesValidator,
157 boolean preferencesCompanyWide, boolean preferencesUniquePerLayout,
158 boolean preferencesOwnedByGroup, boolean useDefaultTemplate,
159 boolean showPortletAccessDenied, boolean showPortletInactive,
160 boolean actionURLRedirect, boolean restoreCurrentView,
161 boolean maximizeEdit, boolean maximizeHelp, boolean popUpPrint,
162 boolean layoutCacheable, boolean instanceable, boolean remoteable,
163 boolean scopeable, String userPrincipalStrategy,
164 boolean privateRequestAttributes, boolean privateSessionAttributes,
165 Set<String> autopropagatedParameters, int actionTimeout,
166 int renderTimeout, int renderWeight, boolean ajaxable,
167 List<String> headerPortalCss, List<String> headerPortletCss,
168 List<String> headerPortalJavaScript,
169 List<String> headerPortletJavaScript, List<String> footerPortalCss,
170 List<String> footerPortletCss, List<String> footerPortalJavaScript,
171 List<String> footerPortletJavaScript, String cssClassWrapper,
172 String facebookIntegration, boolean addDefaultResource, String roles,
173 Set<String> unlinkedRoles, Map<String, String> roleMappers,
174 boolean system, boolean active, boolean include,
175 Map<String, String> initParams, Integer expCache,
176 Map<String, Set<String>> portletModes,
177 Map<String, Set<String>> windowStates, Set<String> supportedLocales,
178 String resourceBundle, PortletInfo portletInfo,
179 Map<String, PortletFilter> portletFilters, Set<QName> processingEvents,
180 Set<QName> publishingEvents,
181 Set<PublicRenderParameter> publicRenderParameters,
182 PortletApp portletApp) {
183
184 setPortletId(portletId);
185 _rootPortlet = rootPortlet;
186 _pluginPackage = pluginPackage;
187 _defaultPluginSetting = pluginSetting;
188 setCompanyId(companyId);
189 _timestamp = timestamp;
190 _icon = icon;
191 _virtualPath = virtualPath;
192 _strutsPath = strutsPath;
193 _portletName = portletName;
194 _parentStrutsPath = parentStrutsPath;
195 _displayName = displayName;
196 _portletClass = portletClass;
197 _configurationActionClass = configurationActionClass;
198 _indexerClasses = indexerClasses;
199 _openSearchClass = openSearchClass;
200 _schedulerEntries = schedulerEntries;
201 _portletURLClass = portletURLClass;
202 _friendlyURLMapperClass = friendlyURLMapperClass;
203 _friendlyURLMapping = friendlyURLMapping;
204 _friendlyURLRoutes = friendlyURLRoutes;
205 _urlEncoderClass = urlEncoderClass;
206 _portletDataHandlerClass = portletDataHandlerClass;
207 _portletLayoutListenerClass = portletLayoutListenerClass;
208 _pollerProcessorClass = pollerProcessorClass;
209 _popMessageListenerClass = popMessageListenerClass;
210 _socialActivityInterpreterClass = socialActivityInterpreterClass;
211 _socialRequestInterpreterClass = socialRequestInterpreterClass;
212 _webDAVStorageToken = webDAVStorageToken;
213 _webDAVStorageClass = webDAVStorageClass;
214 _xmlRpcMethodClass = xmlRpcMethodClass;
215 _controlPanelEntryCategory = controlPanelEntryCategory;
216 _controlPanelEntryWeight = controlPanelEntryWeight;
217 _controlPanelEntryClass = controlPanelClass;
218 _assetRendererFactoryClasses = assetRendererFactoryClasses;
219 _atomCollectionAdapterClasses = atomCollectionAdapterClasses;
220 _customAttributesDisplayClasses = customAttributesDisplayClasses;
221 _permissionPropagatorClass = permissionPropagatorClass;
222 _workflowHandlerClasses = workflowHandlerClasses;
223 _defaultPreferences = defaultPreferences;
224 _preferencesValidator = preferencesValidator;
225 _preferencesCompanyWide = preferencesCompanyWide;
226 _preferencesUniquePerLayout = preferencesUniquePerLayout;
227 _preferencesOwnedByGroup = preferencesOwnedByGroup;
228 _useDefaultTemplate = useDefaultTemplate;
229 _showPortletAccessDenied = showPortletAccessDenied;
230 _showPortletInactive = showPortletInactive;
231 _actionURLRedirect = actionURLRedirect;
232 _restoreCurrentView = restoreCurrentView;
233 _maximizeEdit = maximizeEdit;
234 _maximizeHelp = maximizeHelp;
235 _popUpPrint = popUpPrint;
236 _layoutCacheable = layoutCacheable;
237 _instanceable = instanceable;
238 _remoteable = remoteable;
239 _scopeable = scopeable;
240 _userPrincipalStrategy = userPrincipalStrategy;
241 _privateRequestAttributes = privateRequestAttributes;
242 _privateSessionAttributes = privateSessionAttributes;
243 _autopropagatedParameters = autopropagatedParameters;
244 _actionTimeout = actionTimeout;
245 _renderTimeout = renderTimeout;
246 _renderWeight = renderWeight;
247 _ajaxable = ajaxable;
248 _headerPortalCss = headerPortalCss;
249 _headerPortletCss = headerPortletCss;
250 _headerPortalJavaScript = headerPortalJavaScript;
251 _headerPortletJavaScript = headerPortletJavaScript;
252 _footerPortalCss = footerPortalCss;
253 _footerPortletCss = footerPortletCss;
254 _footerPortalJavaScript = footerPortalJavaScript;
255 _footerPortletJavaScript = footerPortletJavaScript;
256 _cssClassWrapper = cssClassWrapper;
257 _facebookIntegration = facebookIntegration;
258 _scopeable = scopeable;
259 _addDefaultResource = addDefaultResource;
260 setRoles(roles);
261 _unlinkedRoles = unlinkedRoles;
262 _roleMappers = roleMappers;
263 _system = system;
264 setActive(active);
265 _include = include;
266 _initParams = initParams;
267 _expCache = expCache;
268 _portletModes = portletModes;
269 _windowStates = windowStates;
270 _supportedLocales = supportedLocales;
271 _resourceBundle = resourceBundle;
272 _portletInfo = portletInfo;
273 _portletFilters = portletFilters;
274 setProcessingEvents(processingEvents);
275 setPublishingEvents(publishingEvents);
276 setPublicRenderParameters(publicRenderParameters);
277 _portletApp = portletApp;
278 }
279
280
285 public Portlet getRootPortlet() {
286 return _rootPortlet;
287 }
288
289
294 public String getRootPortletId() {
295 return PortletConstants.getRootPortletId(getPortletId());
296 }
297
298
303 public String getInstanceId() {
304 return PortletConstants.getInstanceId(getPortletId());
305 }
306
307
312 public String getPluginId() {
313 return getRootPortletId();
314 }
315
316
321 public String getPluginType() {
322 return Plugin.TYPE_PORTLET;
323 }
324
325
330 public PluginPackage getPluginPackage() {
331 return _pluginPackage;
332 }
333
334
339 public void setPluginPackage(PluginPackage pluginPackage) {
340 _pluginPackage = pluginPackage;
341 }
342
343
348 public PluginSetting getDefaultPluginSetting() {
349 return _defaultPluginSetting;
350 }
351
352
357 public void setDefaultPluginSetting(PluginSetting pluginSetting) {
358 _defaultPluginSetting = pluginSetting;
359 }
360
361
366 public long getTimestamp() {
367 return _timestamp;
368 }
369
370
375 public void setTimestamp(long timestamp) {
376 _timestamp = timestamp;
377 }
378
379
384 public String getIcon() {
385 return _icon;
386 }
387
388
393 public void setIcon(String icon) {
394 _icon = icon;
395 }
396
397
402 public String getVirtualPath() {
403 return _virtualPath;
404 }
405
406
411 public void setVirtualPath(String virtualPath) {
412 if (_portletApp.isWARFile() && Validator.isNull(virtualPath)) {
413 virtualPath = PropsValues.PORTLET_VIRTUAL_PATH;
414 }
415
416 _virtualPath = virtualPath;
417 }
418
419
424 public String getStrutsPath() {
425 return _strutsPath;
426 }
427
428
433 public void setStrutsPath(String strutsPath) {
434 _strutsPath = strutsPath;
435 }
436
437
442 public String getParentStrutsPath() {
443 return _parentStrutsPath;
444 }
445
446
451 public void setParentStrutsPath(String parentStrutsPath) {
452 _parentStrutsPath = parentStrutsPath;
453 }
454
455
460 public String getPortletName() {
461 return _portletName;
462 }
463
464
469 public void setPortletName(String portletName) {
470 _portletName = portletName;
471 }
472
473
478 public String getDisplayName() {
479 return _displayName;
480 }
481
482
487 public void setDisplayName(String displayName) {
488 _displayName = displayName;
489 }
490
491
496 public String getPortletClass() {
497 return _portletClass;
498 }
499
500
505 public void setPortletClass(String portletClass) {
506 _portletClass = portletClass;
507 }
508
509
514 public String getConfigurationActionClass() {
515 return _configurationActionClass;
516 }
517
518
524 public void setConfigurationActionClass(String configurationActionClass) {
525 _configurationActionClass = configurationActionClass;
526 }
527
528
533 public ConfigurationAction getConfigurationActionInstance() {
534 if (Validator.isNull(getConfigurationActionClass())) {
535 return null;
536 }
537
538 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
539
540 return portletBag.getConfigurationActionInstance();
541 }
542
543
550 public List<String> getIndexerClasses() {
551 return _indexerClasses;
552 }
553
554
561 public void setIndexerClasses(List<String> indexerClasses) {
562 _indexerClasses = indexerClasses;
563 }
564
565
570 public List<Indexer> getIndexerInstances() {
571 if (getIndexerClasses().isEmpty()) {
572 return Collections.emptyList();
573 }
574
575 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
576
577 return portletBag.getIndexerInstances();
578 }
579
580
585 public String getOpenSearchClass() {
586 return _openSearchClass;
587 }
588
589
594 public void setOpenSearchClass(String openSearchClass) {
595 _openSearchClass = openSearchClass;
596 }
597
598
603 public OpenSearch getOpenSearchInstance() {
604 if (Validator.isNull(getOpenSearchClass())) {
605 return null;
606 }
607
608 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
609
610 return portletBag.getOpenSearchInstance();
611 }
612
613
616 public void addSchedulerEntry(SchedulerEntry schedulerEntry) {
617 _schedulerEntries.add(schedulerEntry);
618 }
619
620
625 public List<SchedulerEntry> getSchedulerEntries() {
626 return _schedulerEntries;
627 }
628
629
634 public void setSchedulerEntries(List<SchedulerEntry> schedulerEntries) {
635 for (SchedulerEntry schedulerEntry : schedulerEntries) {
636 addSchedulerEntry(schedulerEntry);
637 }
638 }
639
640
645 public String getPortletURLClass() {
646 return _portletURLClass;
647 }
648
649
654 public void setPortletURLClass(String portletURLClass) {
655 _portletURLClass = portletURLClass;
656 }
657
658
663 public String getFriendlyURLMapperClass() {
664 return _friendlyURLMapperClass;
665 }
666
667
673 public void setFriendlyURLMapperClass(String friendlyURLMapperClass) {
674 _friendlyURLMapperClass = friendlyURLMapperClass;
675 }
676
677
682 public FriendlyURLMapper getFriendlyURLMapperInstance() {
683 if (Validator.isNull(getFriendlyURLMapperClass())) {
684 return null;
685 }
686
687 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
688
689 return portletBag.getFriendlyURLMapperInstance();
690 }
691
692
697 public String getFriendlyURLMapping() {
698 return _friendlyURLMapping;
699 }
700
701
707 public void setFriendlyURLMapping(String friendlyURLMapping) {
708 _friendlyURLMapping = friendlyURLMapping;
709 }
710
711
718 public String getFriendlyURLRoutes() {
719 return _friendlyURLRoutes;
720 }
721
722
729 public void setFriendlyURLRoutes(String friendlyURLRoutes) {
730 _friendlyURLRoutes = friendlyURLRoutes;
731 }
732
733
738 public String getURLEncoderClass() {
739 return _urlEncoderClass;
740 }
741
742
747 public void setURLEncoderClass(String urlEncoderClass) {
748 _urlEncoderClass = urlEncoderClass;
749 }
750
751
756 public URLEncoder getURLEncoderInstance() {
757 if (Validator.isNull(getURLEncoderClass())) {
758 return null;
759 }
760
761 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
762
763 return portletBag.getURLEncoderInstance();
764 }
765
766
771 public String getPortletDataHandlerClass() {
772 return _portletDataHandlerClass;
773 }
774
775
781 public void setPortletDataHandlerClass(String portletDataHandlerClass) {
782 _portletDataHandlerClass = portletDataHandlerClass;
783 }
784
785
790 public PortletDataHandler getPortletDataHandlerInstance() {
791 if (Validator.isNull(getPortletDataHandlerClass())) {
792 return null;
793 }
794
795 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
796
797 return portletBag.getPortletDataHandlerInstance();
798 }
799
800
805 public String getPortletLayoutListenerClass() {
806 return _portletLayoutListenerClass;
807 }
808
809
815 public void setPortletLayoutListenerClass(
816 String portletLayoutListenerClass) {
817
818 _portletLayoutListenerClass = portletLayoutListenerClass;
819 }
820
821
826 public PortletLayoutListener getPortletLayoutListenerInstance() {
827 if (Validator.isNull(getPortletLayoutListenerClass())) {
828 return null;
829 }
830
831 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
832
833 return portletBag.getPortletLayoutListenerInstance();
834 }
835
836
841 public String getPollerProcessorClass() {
842 return _pollerProcessorClass;
843 }
844
845
851 public void setPollerProcessorClass(String pollerProcessorClass) {
852 _pollerProcessorClass = pollerProcessorClass;
853 }
854
855
860 public PollerProcessor getPollerProcessorInstance() {
861 if (Validator.isNull(getPollerProcessorClass())) {
862 return null;
863 }
864
865 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
866
867 return portletBag.getPollerProcessorInstance();
868 }
869
870
875 public String getPopMessageListenerClass() {
876 return _popMessageListenerClass;
877 }
878
879
885 public void setPopMessageListenerClass(String popMessageListenerClass) {
886 _popMessageListenerClass = popMessageListenerClass;
887 }
888
889
894 public MessageListener getPopMessageListenerInstance() {
895 if (Validator.isNull(getPopMessageListenerClass())) {
896 return null;
897 }
898
899 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
900
901 return portletBag.getPopMessageListenerInstance();
902 }
903
904
909 public String getSocialActivityInterpreterClass() {
910 return _socialActivityInterpreterClass;
911 }
912
913
919 public void setSocialActivityInterpreterClass(
920 String socialActivityInterpreterClass) {
921
922 _socialActivityInterpreterClass = socialActivityInterpreterClass;
923 }
924
925
932 public SocialActivityInterpreter getSocialActivityInterpreterInstance() {
933 if (Validator.isNull(getSocialActivityInterpreterClass())) {
934 return null;
935 }
936
937 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
938
939 return portletBag.getSocialActivityInterpreterInstance();
940 }
941
942
947 public String getSocialRequestInterpreterClass() {
948 return _socialRequestInterpreterClass;
949 }
950
951
957 public void setSocialRequestInterpreterClass(
958 String socialRequestInterpreterClass) {
959
960 _socialRequestInterpreterClass = socialRequestInterpreterClass;
961 }
962
963
970 public SocialRequestInterpreter getSocialRequestInterpreterInstance() {
971 if (Validator.isNull(getSocialRequestInterpreterClass())) {
972 return null;
973 }
974
975 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
976
977 return portletBag.getSocialRequestInterpreterInstance();
978 }
979
980
985 public String getWebDAVStorageToken() {
986 return _webDAVStorageToken;
987 }
988
989
995 public void setWebDAVStorageToken(String webDAVStorageToken) {
996 _webDAVStorageToken = webDAVStorageToken;
997 }
998
999
1004 public String getWebDAVStorageClass() {
1005 return _webDAVStorageClass;
1006 }
1007
1008
1014 public void setWebDAVStorageClass(String webDAVStorageClass) {
1015 _webDAVStorageClass = webDAVStorageClass;
1016 }
1017
1018
1023 public WebDAVStorage getWebDAVStorageInstance() {
1024 if (Validator.isNull(getWebDAVStorageClass())) {
1025 return null;
1026 }
1027
1028 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1029
1030 return portletBag.getWebDAVStorageInstance();
1031 }
1032
1033
1038 public String getXmlRpcMethodClass() {
1039 return _xmlRpcMethodClass;
1040 }
1041
1042
1048 public void setXmlRpcMethodClass(String xmlRpcMethodClass) {
1049 _xmlRpcMethodClass = xmlRpcMethodClass;
1050 }
1051
1052
1057 public Method getXmlRpcMethodInstance() {
1058 if (Validator.isNull(getXmlRpcMethodClass())) {
1059 return null;
1060 }
1061
1062 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1063
1064 return portletBag.getXmlRpcMethodInstance();
1065 }
1066
1067
1074 public String getControlPanelEntryCategory() {
1075 return _controlPanelEntryCategory;
1076 }
1077
1078
1085 public void setControlPanelEntryCategory(String controlPanelEntryCategory) {
1086 _controlPanelEntryCategory = controlPanelEntryCategory;
1087 }
1088
1089
1096 public double getControlPanelEntryWeight() {
1097 return _controlPanelEntryWeight;
1098 }
1099
1100
1108 public void setControlPanelEntryWeight(double controlPanelEntryWeight) {
1109 _controlPanelEntryWeight = controlPanelEntryWeight;
1110 }
1111
1112
1119 public String getControlPanelEntryClass() {
1120 return _controlPanelEntryClass;
1121 }
1122
1123
1130 public void setControlPanelEntryClass(String controlPanelEntryClass) {
1131 _controlPanelEntryClass = controlPanelEntryClass;
1132 }
1133
1134
1141 public ControlPanelEntry getControlPanelEntryInstance() {
1142 if (Validator.isNull(getControlPanelEntryClass())) {
1143 return null;
1144 }
1145
1146 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1147
1148 return portletBag.getControlPanelEntryInstance();
1149 }
1150
1151
1158 public List<String> getAssetRendererFactoryClasses() {
1159 return _assetRendererFactoryClasses;
1160 }
1161
1162
1169 public void setAssetRendererFactoryClasses(
1170 List<String> assetRendererFactoryClasses) {
1171
1172 _assetRendererFactoryClasses = assetRendererFactoryClasses;
1173 }
1174
1175
1180 public List<AssetRendererFactory> getAssetRendererFactoryInstances() {
1181 if (getAssetRendererFactoryClasses().isEmpty()) {
1182 return null;
1183 }
1184
1185 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1186
1187 return portletBag.getAssetRendererFactoryInstances();
1188 }
1189
1190
1197 public List<String> getAtomCollectionAdapterClasses() {
1198 return _atomCollectionAdapterClasses;
1199 }
1200
1201
1208 public void setAtomCollectionAdapterClasses(
1209 List<String> atomCollectionAdapterClasses) {
1210
1211 _atomCollectionAdapterClasses = atomCollectionAdapterClasses;
1212 }
1213
1214
1219 public List<AtomCollectionAdapter<?>> getAtomCollectionAdapterInstances() {
1220 if (getAtomCollectionAdapterClasses().isEmpty()) {
1221 return null;
1222 }
1223
1224 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1225
1226 return portletBag.getAtomCollectionAdapterInstances();
1227 }
1228
1229
1236 public List<String> getCustomAttributesDisplayClasses() {
1237 return _customAttributesDisplayClasses;
1238 }
1239
1240
1247 public void setCustomAttributesDisplayClasses(
1248 List<String> customAttributesDisplayClasses) {
1249
1250 _customAttributesDisplayClasses = customAttributesDisplayClasses;
1251 }
1252
1253
1258 public List<CustomAttributesDisplay> getCustomAttributesDisplayInstances() {
1259 if (getCustomAttributesDisplayClasses().isEmpty()) {
1260 return null;
1261 }
1262
1263 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1264
1265 return portletBag.getCustomAttributesDisplayInstances();
1266 }
1267
1268
1273 public String getPermissionPropagatorClass() {
1274 return _permissionPropagatorClass;
1275 }
1276
1277
1280 public void setPermissionPropagatorClass(String permissionPropagatorClass) {
1281 _permissionPropagatorClass = permissionPropagatorClass;
1282 }
1283
1284
1289 public PermissionPropagator getPermissionPropagatorInstance() {
1290 if (Validator.isNull(getPermissionPropagatorClass())) {
1291 return null;
1292 }
1293
1294 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1295
1296 return portletBag.getPermissionPropagatorInstance();
1297 }
1298
1299
1306 public List<String> getWorkflowHandlerClasses() {
1307 return _workflowHandlerClasses;
1308 }
1309
1310
1317 public void setWorkflowHandlerClasses(List<String> workflowHandlerClasses) {
1318 _workflowHandlerClasses = workflowHandlerClasses;
1319 }
1320
1321
1326 public List<WorkflowHandler> getWorkflowHandlerInstances() {
1327 if (getWorkflowHandlerClasses().isEmpty()) {
1328 return null;
1329 }
1330
1331 PortletBag portletBag = PortletBagPool.get(getRootPortletId());
1332
1333 return portletBag.getWorkflowHandlerInstances();
1334 }
1335
1336
1341 public String getDefaultPreferences() {
1342 if (Validator.isNull(_defaultPreferences)) {
1343 return PortletConstants.DEFAULT_PREFERENCES;
1344 }
1345 else {
1346 return _defaultPreferences;
1347 }
1348 }
1349
1350
1355 public void setDefaultPreferences(String defaultPreferences) {
1356 _defaultPreferences = defaultPreferences;
1357 }
1358
1359
1364 public String getPreferencesValidator() {
1365 return _preferencesValidator;
1366 }
1367
1368
1374 public void setPreferencesValidator(String preferencesValidator) {
1375 if (preferencesValidator != null) {
1376
1377
1378
1379
1380 _preferencesValidator = preferencesValidator.trim();
1381 }
1382 else {
1383 _preferencesValidator = null;
1384 }
1385 }
1386
1387
1394 public boolean getPreferencesCompanyWide() {
1395 return _preferencesCompanyWide;
1396 }
1397
1398
1405 public boolean isPreferencesCompanyWide() {
1406 return _preferencesCompanyWide;
1407 }
1408
1409
1416 public void setPreferencesCompanyWide(boolean preferencesCompanyWide) {
1417 _preferencesCompanyWide = preferencesCompanyWide;
1418 }
1419
1420
1425 public boolean getPreferencesUniquePerLayout() {
1426 return _preferencesUniquePerLayout;
1427 }
1428
1429
1434 public boolean isPreferencesUniquePerLayout() {
1435 return _preferencesUniquePerLayout;
1436 }
1437
1438
1444 public void setPreferencesUniquePerLayout(
1445 boolean preferencesUniquePerLayout) {
1446
1447 _preferencesUniquePerLayout = preferencesUniquePerLayout;
1448 }
1449
1450
1459 public boolean getPreferencesOwnedByGroup() {
1460 return _preferencesOwnedByGroup;
1461 }
1462
1463
1472 public boolean isPreferencesOwnedByGroup() {
1473 return _preferencesOwnedByGroup;
1474 }
1475
1476
1485 public void setPreferencesOwnedByGroup(boolean preferencesOwnedByGroup) {
1486 _preferencesOwnedByGroup = preferencesOwnedByGroup;
1487 }
1488
1489
1494 public boolean getUseDefaultTemplate() {
1495 return _useDefaultTemplate;
1496 }
1497
1498
1503 public boolean isUseDefaultTemplate() {
1504 return _useDefaultTemplate;
1505 }
1506
1507
1513 public void setUseDefaultTemplate(boolean useDefaultTemplate) {
1514 _useDefaultTemplate = useDefaultTemplate;
1515 }
1516
1517
1524 public boolean getShowPortletAccessDenied() {
1525 return _showPortletAccessDenied;
1526 }
1527
1528
1535 public boolean isShowPortletAccessDenied() {
1536 return _showPortletAccessDenied;
1537 }
1538
1539
1546 public void setShowPortletAccessDenied(boolean showPortletAccessDenied) {
1547 _showPortletAccessDenied = showPortletAccessDenied;
1548 }
1549
1550
1556 public boolean getShowPortletInactive() {
1557 return _showPortletInactive;
1558 }
1559
1560
1566 public boolean isShowPortletInactive() {
1567 return _showPortletInactive;
1568 }
1569
1570
1576 public void setShowPortletInactive(boolean showPortletInactive) {
1577 _showPortletInactive = showPortletInactive;
1578 }
1579
1580
1587 public boolean getActionURLRedirect() {
1588 return _actionURLRedirect;
1589 }
1590
1591
1598 public boolean isActionURLRedirect() {
1599 return _actionURLRedirect;
1600 }
1601
1602
1609 public void setActionURLRedirect(boolean actionURLRedirect) {
1610 _actionURLRedirect = actionURLRedirect;
1611 }
1612
1613
1620 public boolean getRestoreCurrentView() {
1621 return _restoreCurrentView;
1622 }
1623
1624
1631 public boolean isRestoreCurrentView() {
1632 return _restoreCurrentView;
1633 }
1634
1635
1642 public void setRestoreCurrentView(boolean restoreCurrentView) {
1643 _restoreCurrentView = restoreCurrentView;
1644 }
1645
1646
1653 public boolean getMaximizeEdit() {
1654 return _maximizeEdit;
1655 }
1656
1657
1664 public boolean isMaximizeEdit() {
1665 return _maximizeEdit;
1666 }
1667
1668
1675 public void setMaximizeEdit(boolean maximizeEdit) {
1676 _maximizeEdit = maximizeEdit;
1677 }
1678
1679
1686 public boolean getMaximizeHelp() {
1687 return _maximizeHelp;
1688 }
1689
1690
1697 public boolean isMaximizeHelp() {
1698 return _maximizeHelp;
1699 }
1700
1701
1708 public void setMaximizeHelp(boolean maximizeHelp) {
1709 _maximizeHelp = maximizeHelp;
1710 }
1711
1712
1719 public boolean getPopUpPrint() {
1720 return _popUpPrint;
1721 }
1722
1723
1730 public boolean isPopUpPrint() {
1731 return _popUpPrint;
1732 }
1733
1734
1741 public void setPopUpPrint(boolean popUpPrint) {
1742 _popUpPrint = popUpPrint;
1743 }
1744
1745
1751 public boolean getLayoutCacheable() {
1752 return _layoutCacheable;
1753 }
1754
1755
1761 public boolean isLayoutCacheable() {
1762 return _layoutCacheable;
1763 }
1764
1765
1772 public void setLayoutCacheable(boolean layoutCacheable) {
1773 _layoutCacheable = layoutCacheable;
1774 }
1775
1776
1783 public boolean getInstanceable() {
1784 return _instanceable;
1785 }
1786
1787
1794 public boolean isInstanceable() {
1795 return _instanceable;
1796 }
1797
1798
1805 public void setInstanceable(boolean instanceable) {
1806 _instanceable = instanceable;
1807 }
1808
1809
1814 public boolean getRemoteable() {
1815 return _remoteable;
1816 }
1817
1818
1823 public boolean isRemoteable() {
1824 return _remoteable;
1825 }
1826
1827
1833 public void setRemoteable(boolean remoteable) {
1834 _remoteable = remoteable;
1835 }
1836
1837
1842 public boolean getScopeable() {
1843 return _scopeable;
1844 }
1845
1846
1851 public boolean isScopeable() {
1852 return _scopeable;
1853 }
1854
1855
1861 public void setScopeable(boolean scopeable) {
1862 _scopeable = scopeable;
1863 }
1864
1865
1870 public String getUserPrincipalStrategy() {
1871 return _userPrincipalStrategy;
1872 }
1873
1874
1879 public void setUserPrincipalStrategy(String userPrincipalStrategy) {
1880 if (Validator.isNotNull(userPrincipalStrategy)) {
1881 _userPrincipalStrategy = userPrincipalStrategy;
1882 }
1883 }
1884
1885
1892 public boolean getPrivateRequestAttributes() {
1893 return _privateRequestAttributes;
1894 }
1895
1896
1903 public boolean isPrivateRequestAttributes() {
1904 return _privateRequestAttributes;
1905 }
1906
1907
1915 public void setPrivateRequestAttributes(boolean privateRequestAttributes) {
1916 _privateRequestAttributes = privateRequestAttributes;
1917 }
1918
1919
1926 public boolean getPrivateSessionAttributes() {
1927 return _privateSessionAttributes;
1928 }
1929
1930
1937 public boolean isPrivateSessionAttributes() {
1938 return _privateSessionAttributes;
1939 }
1940
1941
1948 public void setPrivateSessionAttributes(boolean privateSessionAttributes) {
1949 _privateSessionAttributes = privateSessionAttributes;
1950 }
1951
1952
1959 public Set<String> getAutopropagatedParameters() {
1960 return _autopropagatedParameters;
1961 }
1962
1963
1970 public void setAutopropagatedParameters(
1971 Set<String> autopropagatedParameters) {
1972
1973 _autopropagatedParameters = autopropagatedParameters;
1974 }
1975
1976
1981 public int getActionTimeout() {
1982 return _actionTimeout;
1983 }
1984
1985
1990 public void setActionTimeout(int actionTimeout) {
1991 _actionTimeout = actionTimeout;
1992 }
1993
1994
1999 public int getRenderTimeout() {
2000 return _renderTimeout;
2001 }
2002
2003
2008 public void setRenderTimeout(int renderTimeout) {
2009 _renderTimeout = renderTimeout;
2010 }
2011
2012
2017 public int getRenderWeight() {
2018 return _renderWeight;
2019 }
2020
2021
2026 public void setRenderWeight(int renderWeight) {
2027 _renderWeight = renderWeight;
2028 }
2029
2030
2035 public boolean getAjaxable() {
2036 return _ajaxable;
2037 }
2038
2039
2044 public boolean isAjaxable() {
2045 return _ajaxable;
2046 }
2047
2048
2054 public void setAjaxable(boolean ajaxable) {
2055 _ajaxable = ajaxable;
2056 }
2057
2058
2065 public List<String> getHeaderPortalCss() {
2066 return _headerPortalCss;
2067 }
2068
2069
2076 public void setHeaderPortalCss(List<String> headerPortalCss) {
2077 _headerPortalCss = headerPortalCss;
2078 }
2079
2080
2087 public List<String> getHeaderPortletCss() {
2088 return _headerPortletCss;
2089 }
2090
2091
2098 public void setHeaderPortletCss(List<String> headerPortletCss) {
2099 _headerPortletCss = headerPortletCss;
2100 }
2101
2102
2109 public List<String> getHeaderPortalJavaScript() {
2110 return _headerPortalJavaScript;
2111 }
2112
2113
2121 public void setHeaderPortalJavaScript(List<String> headerPortalJavaScript) {
2122 _headerPortalJavaScript = headerPortalJavaScript;
2123 }
2124
2125
2132 public List<String> getHeaderPortletJavaScript() {
2133 return _headerPortletJavaScript;
2134 }
2135
2136
2144 public void setHeaderPortletJavaScript(
2145 List<String> headerPortletJavaScript) {
2146
2147 _headerPortletJavaScript = headerPortletJavaScript;
2148 }
2149
2150
2157 public List<String> getFooterPortalCss() {
2158 return _footerPortalCss;
2159 }
2160
2161
2168 public void setFooterPortalCss(List<String> footerPortalCss) {
2169 _footerPortalCss = footerPortalCss;
2170 }
2171
2172
2179 public List<String> getFooterPortletCss() {
2180 return _footerPortletCss;
2181 }
2182
2183
2190 public void setFooterPortletCss(List<String> footerPortletCss) {
2191 _footerPortletCss = footerPortletCss;
2192 }
2193
2194
2201 public List<String> getFooterPortalJavaScript() {
2202 return _footerPortalJavaScript;
2203 }
2204
2205
2213 public void setFooterPortalJavaScript(List<String> footerPortalJavaScript) {
2214 _footerPortalJavaScript = footerPortalJavaScript;
2215 }
2216
2217
2224 public List<String> getFooterPortletJavaScript() {
2225 return _footerPortletJavaScript;
2226 }
2227
2228
2236 public void setFooterPortletJavaScript(
2237 List<String> footerPortletJavaScript) {
2238
2239 _footerPortletJavaScript = footerPortletJavaScript;
2240 }
2241
2242
2249 public String getCssClassWrapper() {
2250 return _cssClassWrapper;
2251 }
2252
2253
2260 public void setCssClassWrapper(String cssClassWrapper) {
2261 _cssClassWrapper = cssClassWrapper;
2262 }
2263
2264
2269 public String getFacebookIntegration() {
2270 return _facebookIntegration;
2271 }
2272
2273
2278 public void setFacebookIntegration(String facebookIntegration) {
2279 if (Validator.isNotNull(facebookIntegration)) {
2280 _facebookIntegration = facebookIntegration;
2281 }
2282 }
2283
2284
2291 public boolean getAddDefaultResource() {
2292 return _addDefaultResource;
2293 }
2294
2295
2302 public boolean isAddDefaultResource() {
2303 return _addDefaultResource;
2304 }
2305
2306
2313 public void setAddDefaultResource(boolean addDefaultResource) {
2314 _addDefaultResource = addDefaultResource;
2315 }
2316
2317
2322 @Override
2323 public void setRoles(String roles) {
2324 _rolesArray = StringUtil.split(roles);
2325
2326 super.setRoles(roles);
2327 }
2328
2329
2334 public String[] getRolesArray() {
2335 return _rolesArray;
2336 }
2337
2338
2343 public void setRolesArray(String[] rolesArray) {
2344 _rolesArray = rolesArray;
2345
2346 super.setRoles(StringUtil.merge(rolesArray));
2347 }
2348
2349
2354 public Set<String> getUnlinkedRoles() {
2355 return _unlinkedRoles;
2356 }
2357
2358
2363 public void setUnlinkedRoles(Set<String> unlinkedRoles) {
2364 _unlinkedRoles = unlinkedRoles;
2365 }
2366
2367
2372 public Map<String, String> getRoleMappers() {
2373 return _roleMappers;
2374 }
2375
2376
2381 public void setRoleMappers(Map<String, String> roleMappers) {
2382 _roleMappers = roleMappers;
2383 }
2384
2385
2389 public void linkRoles() {
2390 List<String> linkedRoles = new ArrayList<String>();
2391
2392 Iterator<String> itr = _unlinkedRoles.iterator();
2393
2394 while (itr.hasNext()) {
2395 String unlinkedRole = itr.next();
2396
2397 String roleLink = _roleMappers.get(unlinkedRole);
2398
2399 if (Validator.isNotNull(roleLink)) {
2400 if (_log.isDebugEnabled()) {
2401 _log.debug(
2402 "Linking role for portlet [" + getPortletId() +
2403 "] with role-name [" + unlinkedRole +
2404 "] to role-link [" + roleLink + "]");
2405 }
2406
2407 linkedRoles.add(roleLink);
2408 }
2409 else {
2410 _log.error(
2411 "Unable to link role for portlet [" + getPortletId() +
2412 "] with role-name [" + unlinkedRole +
2413 "] because role-link is null");
2414 }
2415 }
2416
2417 String[] array = linkedRoles.toArray(new String[linkedRoles.size()]);
2418
2419 Arrays.sort(array);
2420
2421 setRolesArray(array);
2422 }
2423
2424
2431 public boolean hasRoleWithName(String roleName) {
2432 if ((_rolesArray == null) || (_rolesArray.length == 0)) {
2433 return false;
2434 }
2435
2436 for (int i = 0; i < _rolesArray.length; i++) {
2437 if (_rolesArray[i].equalsIgnoreCase(roleName)) {
2438 return true;
2439 }
2440 }
2441
2442 return false;
2443 }
2444
2445
2452 public boolean hasAddPortletPermission(long userId) {
2453 PermissionChecker permissionChecker =
2454 PermissionThreadLocal.getPermissionChecker();
2455
2456 try {
2457 if ((permissionChecker == null) ||
2458 (permissionChecker.getUserId() != userId)) {
2459
2460 User user = UserLocalServiceUtil.getUser(userId);
2461
2462 permissionChecker = PermissionCheckerFactoryUtil.create(
2463 user, true);
2464 }
2465
2466 if (PortletPermissionUtil.contains(
2467 permissionChecker, getRootPortletId(),
2468 ActionKeys.ADD_TO_PAGE)) {
2469
2470 return true;
2471 }
2472 }
2473 catch (Exception e) {
2474 _log.error(e, e);
2475 }
2476
2477 return false;
2478 }
2479
2480
2487 public boolean getSystem() {
2488 return _system;
2489 }
2490
2491
2498 public boolean isSystem() {
2499 return _system;
2500 }
2501
2502
2509 public void setSystem(boolean system) {
2510 _system = system;
2511 }
2512
2513
2520 public boolean getInclude() {
2521 return _include;
2522 }
2523
2524
2531 public boolean isInclude() {
2532 return _include;
2533 }
2534
2535
2542 public void setInclude(boolean include) {
2543 _include = include;
2544 }
2545
2546
2551 public boolean getReady() {
2552 return isReady();
2553 }
2554
2555
2560 public boolean isReady() {
2561 Boolean ready = _readyMap.get(getRootPortletId());
2562
2563 if (ready == null) {
2564 return true;
2565 }
2566 else {
2567 return ready;
2568 }
2569 }
2570
2571
2576 public void setReady(boolean ready) {
2577 _readyMap.put(getRootPortletId(), ready);
2578 }
2579
2580
2585 public Map<String, String> getInitParams() {
2586 return _initParams;
2587 }
2588
2589
2594 public void setInitParams(Map<String, String> initParams) {
2595 _initParams = initParams;
2596 }
2597
2598
2603 public Integer getExpCache() {
2604 return _expCache;
2605 }
2606
2607
2612 public void setExpCache(Integer expCache) {
2613 _expCache = expCache;
2614 }
2615
2616
2621 public Map<String, Set<String>> getPortletModes() {
2622 return _portletModes;
2623 }
2624
2625
2630 public void setPortletModes(Map<String, Set<String>> portletModes) {
2631 _portletModes = portletModes;
2632 }
2633
2634
2641 public boolean hasPortletMode(String mimeType, PortletMode portletMode) {
2642 if (mimeType == null) {
2643 mimeType = ContentTypes.TEXT_HTML;
2644 }
2645
2646 Set<String> mimeTypePortletModes = _portletModes.get(mimeType);
2647
2648 if (mimeTypePortletModes == null) {
2649 return false;
2650 }
2651
2652 if (mimeTypePortletModes.contains(portletMode.toString())) {
2653 return true;
2654 }
2655 else {
2656 return false;
2657 }
2658 }
2659
2660
2665 public Set<String> getAllPortletModes() {
2666 Set<String> allPortletModes = new TreeSet<String>();
2667
2668 Iterator<Map.Entry <String, Set<String>>> itr1 =
2669 _portletModes.entrySet().iterator();
2670
2671 while (itr1.hasNext()) {
2672 Map.Entry<String, Set<String>> entry = itr1.next();
2673
2674 Set<String> mimeTypePortletModes = entry.getValue();
2675
2676 Iterator<String> itr2 = mimeTypePortletModes.iterator();
2677
2678 while (itr2.hasNext()) {
2679 String portletMode = itr2.next();
2680
2681 allPortletModes.add(portletMode);
2682 }
2683 }
2684
2685 return allPortletModes;
2686 }
2687
2688
2694 public boolean hasMultipleMimeTypes() {
2695 if (_portletModes.size() > 1) {
2696 return true;
2697 }
2698 else {
2699 return false;
2700 }
2701 }
2702
2703
2708 public Map<String, Set<String>> getWindowStates() {
2709 return _windowStates;
2710 }
2711
2712
2717 public void setWindowStates(Map<String, Set<String>> windowStates) {
2718 _windowStates = windowStates;
2719 }
2720
2721
2728 public boolean hasWindowState(String mimeType, WindowState windowState) {
2729 if (mimeType == null) {
2730 mimeType = ContentTypes.TEXT_HTML;
2731 }
2732
2733 Set<String> mimeTypeWindowStates = _windowStates.get(mimeType);
2734
2735 if (mimeTypeWindowStates == null) {
2736 return false;
2737 }
2738
2739 if (mimeTypeWindowStates.contains(windowState.toString())) {
2740 return true;
2741 }
2742 else {
2743 return false;
2744 }
2745 }
2746
2747
2752 public Set<String> getAllWindowStates() {
2753 Set<String> allWindowStates = new TreeSet<String>();
2754
2755 Iterator<Map.Entry <String, Set<String>>> itr1 =
2756 _windowStates.entrySet().iterator();
2757
2758 while (itr1.hasNext()) {
2759 Map.Entry<String, Set<String>> entry = itr1.next();
2760
2761 Set<String> mimeTypeWindowStates = entry.getValue();
2762
2763 Iterator<String> itr2 = mimeTypeWindowStates.iterator();
2764
2765 while (itr2.hasNext()) {
2766 String windowState = itr2.next();
2767
2768 allWindowStates.add(windowState);
2769 }
2770 }
2771
2772 return allWindowStates;
2773 }
2774
2775
2780 public Set<String> getSupportedLocales() {
2781 return _supportedLocales;
2782 }
2783
2784
2789 public void setSupportedLocales(Set<String> supportedLocales) {
2790 _supportedLocales = supportedLocales;
2791 }
2792
2793
2798 public String getResourceBundle() {
2799 return _resourceBundle;
2800 }
2801
2802
2807 public void setResourceBundle(String resourceBundle) {
2808 _resourceBundle = resourceBundle;
2809 }
2810
2811
2816 public PortletInfo getPortletInfo() {
2817 return _portletInfo;
2818 }
2819
2820
2825 public void setPortletInfo(PortletInfo portletInfo) {
2826 _portletInfo = portletInfo;
2827 }
2828
2829
2834 public Map<String, PortletFilter> getPortletFilters() {
2835 return _portletFilters;
2836 }
2837
2838
2843 public void setPortletFilters(Map<String, PortletFilter> portletFilters) {
2844 _portletFilters = portletFilters;
2845 }
2846
2847
2850 public void addProcessingEvent(QName processingEvent) {
2851 _processingEvents.add(processingEvent);
2852 _processingEventsByQName.put(
2853 PortletQNameUtil.getKey(processingEvent), processingEvent);
2854 }
2855
2856
2863 public QName getProcessingEvent(String uri, String localPart) {
2864 return _processingEventsByQName.get(
2865 PortletQNameUtil.getKey(uri, localPart));
2866 }
2867
2868
2873 public Set<QName> getProcessingEvents() {
2874 return _processingEvents;
2875 }
2876
2877
2882 public void setProcessingEvents(Set<QName> processingEvents) {
2883 for (QName processingEvent : processingEvents) {
2884 addProcessingEvent(processingEvent);
2885 }
2886 }
2887
2888
2891 public void addPublishingEvent(QName publishingEvent) {
2892 _publishingEvents.add(publishingEvent);
2893 }
2894
2895
2900 public Set<QName> getPublishingEvents() {
2901 return _publishingEvents;
2902 }
2903
2904
2909 public void setPublishingEvents(Set<QName> publishingEvents) {
2910 for (QName publishingEvent : publishingEvents) {
2911 addPublishingEvent(publishingEvent);
2912 }
2913 }
2914
2915
2920 public void addPublicRenderParameter(
2921 PublicRenderParameter publicRenderParameter) {
2922
2923 _publicRenderParameters.add(publicRenderParameter);
2924
2925 String identifier = publicRenderParameter.getIdentifier();
2926
2927 _publicRenderParametersByIdentifier.put(
2928 identifier, publicRenderParameter);
2929
2930 QName qName = publicRenderParameter.getQName();
2931
2932 _publicRenderParametersByQName.put(
2933 PortletQNameUtil.getKey(qName), publicRenderParameter);
2934
2935 String publicRenderParameterName =
2936 PortletQNameUtil.getPublicRenderParameterName(qName);
2937
2938 PortletQNameUtil.setPublicRenderParameterIdentifier(
2939 publicRenderParameterName, identifier);
2940 }
2941
2942
2947 public PublicRenderParameter getPublicRenderParameter(String identifier) {
2948 return _publicRenderParametersByIdentifier.get(identifier);
2949 }
2950
2951
2958 public PublicRenderParameter getPublicRenderParameter(
2959 String uri, String localPart) {
2960
2961 return _publicRenderParametersByQName.get(
2962 PortletQNameUtil.getKey(uri, localPart));
2963 }
2964
2965
2970 public Set<PublicRenderParameter> getPublicRenderParameters() {
2971 return _publicRenderParameters;
2972 }
2973
2974
2980 public void setPublicRenderParameters(
2981 Set<PublicRenderParameter> publicRenderParameters) {
2982
2983 for (PublicRenderParameter publicRenderParameter :
2984 publicRenderParameters) {
2985
2986 addPublicRenderParameter(publicRenderParameter);
2987 }
2988 }
2989
2990
2995 public String getContextPath() {
2996 if (!_portletApp.isWARFile()) {
2997 return PortalUtil.getPathContext();
2998 }
2999
3000 String servletContextName = _portletApp.getServletContextName();
3001
3002 if (ServletContextPool.containsKey(servletContextName)) {
3003 ServletContext servletContext = ServletContextPool.get(
3004 servletContextName);
3005
3006 return ContextPathUtil.getContextPath(servletContext);
3007 }
3008
3009 return StringPool.SLASH.concat(servletContextName);
3010 }
3011
3012
3017 public String getStaticResourcePath() {
3018 String proxyPath = PortalUtil.getPathProxy();
3019
3020 String virtualPath = getVirtualPath();
3021
3022 if (Validator.isNotNull(virtualPath)) {
3023 return proxyPath.concat(virtualPath);
3024 }
3025
3026 String contextPath = getContextPath();
3027
3028 if (!_portletApp.isWARFile()) {
3029 return contextPath;
3030 }
3031
3032 return proxyPath.concat(contextPath);
3033 }
3034
3035
3040 public PortletApp getPortletApp() {
3041 return _portletApp;
3042 }
3043
3044
3049 public void setPortletApp(PortletApp portletApp) {
3050 _portletApp = portletApp;
3051
3052 _portletApp.addPortlet(this);
3053 }
3054
3055
3061 public Portlet getClonedInstance(String portletId) {
3062 Portlet portlet = (Portlet)clone();
3063
3064 portlet.setPortletId(portletId);
3065
3066 return portlet;
3067 }
3068
3069
3076 public boolean getStatic() {
3077 return _staticPortlet;
3078 }
3079
3080
3087 public boolean isStatic() {
3088 return _staticPortlet;
3089 }
3090
3091
3098 public void setStatic(boolean staticPortlet) {
3099 _staticPortlet = staticPortlet;
3100 }
3101
3102
3109 public boolean getStaticStart() {
3110 return _staticPortletStart;
3111 }
3112
3113
3120 public boolean isStaticStart() {
3121 return _staticPortletStart;
3122 }
3123
3124
3131 public void setStaticStart(boolean staticPortletStart) {
3132 _staticPortletStart = staticPortletStart;
3133 }
3134
3135
3142 public boolean getStaticEnd() {
3143 return !_staticPortletStart;
3144 }
3145
3146
3153 public boolean isStaticEnd() {
3154 return !_staticPortletStart;
3155 }
3156
3157
3163 public boolean getUndeployedPortlet() {
3164 return _undeployedPortlet;
3165 }
3166
3167
3173 public boolean isUndeployedPortlet() {
3174 return _undeployedPortlet;
3175 }
3176
3177
3183 public void setUndeployedPortlet(boolean undeployedPortlet) {
3184 _undeployedPortlet = undeployedPortlet;
3185 }
3186
3187
3192 @Override
3193 public Object clone() {
3194 Portlet portlet = new PortletImpl(
3195 getPortletId(), getRootPortlet(), getPluginPackage(),
3196 getDefaultPluginSetting(), getCompanyId(), getTimestamp(),
3197 getIcon(), getVirtualPath(), getStrutsPath(), getParentStrutsPath(),
3198 getPortletName(), getDisplayName(), getPortletClass(),
3199 getConfigurationActionClass(), getIndexerClasses(),
3200 getOpenSearchClass(), getSchedulerEntries(), getPortletURLClass(),
3201 getFriendlyURLMapperClass(), getFriendlyURLMapping(),
3202 getFriendlyURLRoutes(), getURLEncoderClass(),
3203 getPortletDataHandlerClass(), getPortletLayoutListenerClass(),
3204 getPollerProcessorClass(), getPopMessageListenerClass(),
3205 getSocialActivityInterpreterClass(),
3206 getSocialRequestInterpreterClass(), getWebDAVStorageToken(),
3207 getWebDAVStorageClass(), getXmlRpcMethodClass(),
3208 getControlPanelEntryCategory(), getControlPanelEntryWeight(),
3209 getControlPanelEntryClass(), getAssetRendererFactoryClasses(),
3210 getAtomCollectionAdapterClasses(),
3211 getCustomAttributesDisplayClasses(), getPermissionPropagatorClass(),
3212 getWorkflowHandlerClasses(), getDefaultPreferences(),
3213 getPreferencesValidator(), isPreferencesCompanyWide(),
3214 isPreferencesUniquePerLayout(), isPreferencesOwnedByGroup(),
3215 isUseDefaultTemplate(), isShowPortletAccessDenied(),
3216 isShowPortletInactive(), isActionURLRedirect(),
3217 isRestoreCurrentView(), isMaximizeEdit(), isMaximizeHelp(),
3218 isPopUpPrint(), isLayoutCacheable(), isInstanceable(),
3219 isRemoteable(), isScopeable(), getUserPrincipalStrategy(),
3220 isPrivateRequestAttributes(), isPrivateSessionAttributes(),
3221 getAutopropagatedParameters(), getActionTimeout(),
3222 getRenderTimeout(), getRenderWeight(), isAjaxable(),
3223 getHeaderPortalCss(), getHeaderPortletCss(),
3224 getHeaderPortalJavaScript(), getHeaderPortletJavaScript(),
3225 getFooterPortalCss(), getFooterPortletCss(),
3226 getFooterPortalJavaScript(), getFooterPortletJavaScript(),
3227 getCssClassWrapper(), getFacebookIntegration(),
3228 isAddDefaultResource(), getRoles(), getUnlinkedRoles(),
3229 getRoleMappers(), isSystem(), isActive(), isInclude(),
3230 getInitParams(), getExpCache(), getPortletModes(),
3231 getWindowStates(), getSupportedLocales(), getResourceBundle(),
3232 getPortletInfo(), getPortletFilters(), getProcessingEvents(),
3233 getPublishingEvents(), getPublicRenderParameters(),
3234 getPortletApp());
3235
3236 portlet.setId(getId());
3237 portlet.setUndeployedPortlet(isUndeployedPortlet());
3238
3239 return portlet;
3240 }
3241
3242
3251 @Override
3252 public int compareTo(Portlet portlet) {
3253 return getPortletId().compareTo(portlet.getPortletId());
3254 }
3255
3256
3262 @Override
3263 public boolean equals(Object obj) {
3264 Portlet portlet = (Portlet)obj;
3265
3266 return getPortletId().equals(portlet.getPortletId());
3267 }
3268
3269
3272 private static Log _log = LogFactoryUtil.getLog(PortletImpl.class);
3273
3274
3277 private static Map<String, Boolean> _readyMap =
3278 new ConcurrentHashMap<String, Boolean>();
3279
3280
3283 private Portlet _rootPortlet = this;
3284
3285
3288 private PluginPackage _pluginPackage;
3289
3290
3293 private PluginSetting _defaultPluginSetting;
3294
3295
3298 private long _timestamp;
3299
3300
3303 private String _icon;
3304
3305
3308 private String _virtualPath;
3309
3310
3313 private String _strutsPath;
3314
3315
3318 private String _parentStrutsPath;
3319
3320
3323 private String _portletName;
3324
3325
3328 private String _displayName;
3329
3330
3333 private String _portletClass;
3334
3335
3338 private String _configurationActionClass;
3339
3340
3344 private List<String> _indexerClasses;
3345
3346
3349 private String _openSearchClass;
3350
3351
3354 private List<SchedulerEntry> _schedulerEntries;
3355
3356
3359 private String _portletURLClass;
3360
3361
3364 private String _friendlyURLMapperClass;
3365
3366
3369 private String _friendlyURLMapping;
3370
3371
3375 private String _friendlyURLRoutes;
3376
3377
3380 private String _urlEncoderClass;
3381
3382
3385 private String _portletDataHandlerClass;
3386
3387
3390 private String _portletLayoutListenerClass;
3391
3392
3395 private String _pollerProcessorClass;
3396
3397
3400 private String _popMessageListenerClass;
3401
3402
3405 private String _socialActivityInterpreterClass;
3406
3407
3410 private String _socialRequestInterpreterClass;
3411
3412
3415 private String _webDAVStorageToken;
3416
3417
3420 private String _webDAVStorageClass;
3421
3422
3425 private String _xmlRpcMethodClass;
3426
3427
3430 private String _defaultPreferences;
3431
3432
3435 private String _preferencesValidator;
3436
3437
3440 private boolean _preferencesCompanyWide;
3441
3442
3445 private boolean _preferencesUniquePerLayout = true;
3446
3447
3452 private boolean _preferencesOwnedByGroup = true;
3453
3454
3458 private String _controlPanelEntryCategory;
3459
3460
3464 private double _controlPanelEntryWeight = 100;
3465
3466
3470 private String _controlPanelEntryClass;
3471
3472
3476 private List<String> _assetRendererFactoryClasses;
3477
3478
3482 private List<String> _atomCollectionAdapterClasses;
3483
3484
3488 private List<String> _customAttributesDisplayClasses;
3489
3490
3493 private String _permissionPropagatorClass;
3494
3495
3499 private List<String> _workflowHandlerClasses;
3500
3501
3504 private boolean _useDefaultTemplate = true;
3505
3506
3510 private boolean _showPortletAccessDenied =
3511 PropsValues.LAYOUT_SHOW_PORTLET_ACCESS_DENIED;
3512
3513
3516 private boolean _showPortletInactive =
3517 PropsValues.LAYOUT_SHOW_PORTLET_INACTIVE;
3518
3519
3523 private boolean _actionURLRedirect;
3524
3525
3529 private boolean _restoreCurrentView = true;
3530
3531
3535 private boolean _maximizeEdit;
3536
3537
3541 private boolean _maximizeHelp;
3542
3543
3547 private boolean _popUpPrint = true;
3548
3549
3552 private boolean _layoutCacheable;
3553
3554
3557 private boolean _instanceable;
3558
3559
3562 private boolean _remoteable;
3563
3564
3567 private boolean _scopeable;
3568
3569
3572 private String _userPrincipalStrategy =
3573 PortletConstants.USER_PRINCIPAL_STRATEGY_USER_ID;
3574
3575
3579 private boolean _privateRequestAttributes = true;
3580
3581
3585 private boolean _privateSessionAttributes = true;
3586
3587
3591 private Set<String> _autopropagatedParameters;
3592
3593
3596 private int _actionTimeout;
3597
3598
3601 private int _renderTimeout;
3602
3603
3606 private int _renderWeight = 1;
3607
3608
3611 private boolean _ajaxable = true;
3612
3613
3617 private List<String> _headerPortalCss;
3618
3619
3623 private List<String> _headerPortletCss;
3624
3625
3629 private List<String> _headerPortalJavaScript;
3630
3631
3635 private List<String> _headerPortletJavaScript;
3636
3637
3641 private List<String> _footerPortalCss;
3642
3643
3647 private List<String> _footerPortletCss;
3648
3649
3653 private List<String> _footerPortalJavaScript;
3654
3655
3659 private List<String> _footerPortletJavaScript;
3660
3661
3665 private String _cssClassWrapper = StringPool.BLANK;
3666
3667
3670 private String _facebookIntegration =
3671 PortletConstants.FACEBOOK_INTEGRATION_IFRAME;
3672
3673
3677 private boolean _addDefaultResource;
3678
3679
3682 private String[] _rolesArray = new String[0];
3683
3684
3687 private Set<String> _unlinkedRoles;
3688
3689
3692 private Map<String, String> _roleMappers;
3693
3694
3698 private boolean _system;
3699
3700
3704 private boolean _include = true;
3705
3706
3709 private Map<String, String> _initParams;
3710
3711
3714 private Integer _expCache;
3715
3716
3719 private Map<String, Set<String>> _portletModes;
3720
3721
3724 private Map<String, Set<String>> _windowStates;
3725
3726
3729 private Set<String> _supportedLocales;
3730
3731
3734 private String _resourceBundle;
3735
3736
3739 private PortletInfo _portletInfo;
3740
3741
3744 private Map<String, PortletFilter> _portletFilters;
3745
3746
3749 private Set<QName> _processingEvents = new HashSet<QName>();
3750
3751
3754 private Map<String, QName> _processingEventsByQName =
3755 new HashMap<String, QName>();
3756
3757
3760 private Set<QName> _publishingEvents = new HashSet<QName>();
3761
3762
3765 private Set<PublicRenderParameter> _publicRenderParameters =
3766 new HashSet<PublicRenderParameter>();
3767
3768
3772 private Map<String, PublicRenderParameter>
3773 _publicRenderParametersByIdentifier =
3774 new HashMap<String, PublicRenderParameter>();
3775
3776
3780 private Map<String, PublicRenderParameter>
3781 _publicRenderParametersByQName =
3782 new HashMap<String, PublicRenderParameter>();
3783
3784
3787 private PortletApp _portletApp;
3788
3789
3793 private boolean _staticPortlet;
3794
3795
3799 private boolean _staticPortletStart;
3800
3801
3804 private boolean _undeployedPortlet = false;
3805
3806 }