001
014
015 package com.liferay.portal.util;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.kernel.portlet.LiferayPortletRequest;
020 import com.liferay.portal.kernel.portlet.LiferayPortletResponse;
021 import com.liferay.portal.kernel.servlet.taglib.ui.BreadcrumbEntry;
022 import com.liferay.portal.kernel.upload.UploadPortletRequest;
023 import com.liferay.portal.kernel.upload.UploadServletRequest;
024 import com.liferay.portal.model.BaseModel;
025 import com.liferay.portal.model.Company;
026 import com.liferay.portal.model.Group;
027 import com.liferay.portal.model.Layout;
028 import com.liferay.portal.model.LayoutSet;
029 import com.liferay.portal.model.Portlet;
030 import com.liferay.portal.model.Resource;
031 import com.liferay.portal.model.ResourcePermission;
032 import com.liferay.portal.model.User;
033 import com.liferay.portal.theme.ThemeDisplay;
034 import com.liferay.portlet.expando.model.ExpandoBridge;
035
036 import java.io.IOException;
037 import java.io.Serializable;
038
039 import java.util.Date;
040 import java.util.List;
041 import java.util.Locale;
042 import java.util.Map;
043 import java.util.Properties;
044 import java.util.Set;
045 import java.util.TimeZone;
046
047 import javax.portlet.ActionRequest;
048 import javax.portlet.ActionResponse;
049 import javax.portlet.PortletMode;
050 import javax.portlet.PortletPreferences;
051 import javax.portlet.PortletRequest;
052 import javax.portlet.PortletResponse;
053 import javax.portlet.PreferencesValidator;
054 import javax.portlet.RenderRequest;
055 import javax.portlet.RenderResponse;
056 import javax.portlet.ValidatorException;
057 import javax.portlet.WindowState;
058
059 import javax.servlet.ServletContext;
060 import javax.servlet.ServletException;
061 import javax.servlet.http.HttpServletRequest;
062 import javax.servlet.http.HttpServletResponse;
063 import javax.servlet.http.HttpSession;
064 import javax.servlet.jsp.PageContext;
065
066
070 public interface Portal {
071
072 public static final String FRIENDLY_URL_SEPARATOR = "/-/";
073
074 public static final String PATH_IMAGE = "/image";
075
076 public static final String PATH_MAIN = "/c";
077
078 public static final String PATH_PORTAL_LAYOUT = "/portal/layout";
079
080 public static final String PORTAL_REALM = "PortalRealm";
081
082 public static final String PORTLET_XML_FILE_NAME_CUSTOM =
083 "portlet-custom.xml";
084
085 public static final String PORTLET_XML_FILE_NAME_STANDARD = "portlet.xml";
086
087 public static final String TEMP_OBFUSCATION_VALUE =
088 "TEMP_OBFUSCATION_VALUE";
089
090
097 public void addPageDescription(
098 String description, HttpServletRequest request);
099
100
107 public void addPageKeywords(String keywords, HttpServletRequest request);
108
109
115 public void addPageSubtitle(String subtitle, HttpServletRequest request);
116
117
123 public void addPageTitle(String title, HttpServletRequest request);
124
125
131 public void addPortalPortEventListener(
132 PortalPortEventListener portalPortEventListener);
133
134
141 public void addPortletBreadcrumbEntry(
142 HttpServletRequest request, String title, String url);
143
144
152 public void addPortletBreadcrumbEntry(
153 HttpServletRequest request, String title, String url,
154 Map<String, Object> data);
155
156
165 public void addPortletDefaultResource(
166 HttpServletRequest request, Portlet portlet)
167 throws PortalException, SystemException;
168
169
186 public String addPreservedParameters(
187 ThemeDisplay themeDisplay, Layout layout, String url, boolean doAsUser);
188
189
197 public String addPreservedParameters(
198 ThemeDisplay themeDisplay, String url);
199
200
206 public void clearRequestParameters(RenderRequest renderRequest);
207
208
216 public void copyRequestParameters(
217 ActionRequest actionRequest, ActionResponse actionResponse);
218
219
227 public String escapeRedirect(String url);
228
229
237 public String generateRandomKey(HttpServletRequest request, String input);
238
239 public String getActualURL(
240 long groupId, boolean privateLayout, String mainPath,
241 String friendlyURL, Map<String, String[]> params,
242 Map<String, Object> requestContext)
243 throws PortalException, SystemException;
244
245
252 public Set<String> getAuthTokenIgnoreActions();
253
254
261 public Set<String> getAuthTokenIgnorePortlets();
262
263
273 public BaseModel<?> getBaseModel(Resource resource)
274 throws PortalException, SystemException;
275
276
287 public BaseModel<?> getBaseModel(ResourcePermission resourcePermission)
288 throws PortalException, SystemException;
289
290
301 public BaseModel<?> getBaseModel(String modelName, String primKey)
302 throws PortalException, SystemException;
303
304
315 public long getBasicAuthUserId(HttpServletRequest request)
316 throws PortalException, SystemException;
317
318
330 public long getBasicAuthUserId(HttpServletRequest request, long companyId)
331 throws PortalException, SystemException;
332
333
346 public String getCanonicalAlternateURL(
347 HttpServletRequest request, String url, Locale locale)
348 throws PortalException, SystemException;
349
350
361 public String getCanonicalURL(HttpServletRequest request)
362 throws PortalException, SystemException;
363
364
367 public String getCDNHost();
368
369
376 public String getCDNHost(boolean secure);
377
378
384 public String getCDNHostHttp(long companyId);
385
386
392 public String getCDNHostHttps(long companyId);
393
394
400 public String getClassName(long classNameId);
401
402
408 public long getClassNameId(Class<?> clazz);
409
410
416 public long getClassNameId(String value);
417
418
428 public String getClassNamePortletId(String className);
429
430 public Company getCompany(HttpServletRequest request)
431 throws PortalException, SystemException;
432
433 public Company getCompany(PortletRequest portletRequest)
434 throws PortalException, SystemException;
435
436 public long getCompanyId(HttpServletRequest requestuest);
437
438 public long getCompanyId(PortletRequest portletRequest);
439
440 public long[] getCompanyIds();
441
442 public String getComputerAddress();
443
444 public String getComputerName();
445
446 public String getControlPanelCategory(
447 String portletId, ThemeDisplay themeDisplay)
448 throws SystemException;
449
450 public String getControlPanelFullURL(
451 long scopeGroupId, String ppid, Map<String, String[]> params)
452 throws PortalException, SystemException;
453
454 public Set<Portlet> getControlPanelPortlets(long companyId, String category)
455 throws SystemException;
456
457 public List<Portlet> getControlPanelPortlets(
458 String category, ThemeDisplay themeDisplay)
459 throws SystemException;
460
461 public String getCurrentCompleteURL(HttpServletRequest request);
462
463 public String getCurrentURL(HttpServletRequest request);
464
465 public String getCurrentURL(PortletRequest portletRequest);
466
467 public String getCustomSQLFunctionIsNotNull();
468
469 public String getCustomSQLFunctionIsNull();
470
471
479 public Date getDate(int month, int day, int year);
480
481
498 public Date getDate(
499 int month, int day, int year, int hour, int min, PortalException pe)
500 throws PortalException;
501
502
521 public Date getDate(
522 int month, int day, int year, int hour, int min, TimeZone timeZone,
523 PortalException pe)
524 throws PortalException;
525
526
541 public Date getDate(int month, int day, int year, PortalException pe)
542 throws PortalException;
543
544
560 public Date getDate(
561 int month, int day, int year, TimeZone timeZone, PortalException pe)
562 throws PortalException;
563
564 public long getDefaultCompanyId();
565
566 public long getDigestAuthUserId(HttpServletRequest request)
567 throws PortalException, SystemException;
568
569 public String getEmailFromAddress(
570 PortletPreferences preferences, long companyId, String defaultValue)
571 throws SystemException;
572
573 public String getEmailFromName(
574 PortletPreferences preferences, long companyId, String defaultValue)
575 throws SystemException;
576
577 public Map<String, Serializable> getExpandoBridgeAttributes(
578 ExpandoBridge expandoBridge, PortletRequest portletRequest)
579 throws PortalException, SystemException;
580
581 public Serializable getExpandoValue(
582 PortletRequest portletRequest, String name, int type,
583 String displayType)
584 throws PortalException, SystemException;
585
586 public String getFacebookURL(
587 Portlet portlet, String facebookCanvasPageURL,
588 ThemeDisplay themeDisplay)
589 throws PortalException, SystemException;
590
591 public String getFirstPageLayoutTypes(PageContext pageContext);
592
593 public String getGlobalLibDir();
594
595 public String getGoogleGadgetURL(
596 Portlet portlet, ThemeDisplay themeDisplay)
597 throws PortalException, SystemException;
598
599 public String getGroupFriendlyURL(
600 Group group, boolean privateLayoutSet, ThemeDisplay themeDisplay)
601 throws PortalException, SystemException;
602
603 public String[] getGroupPermissions(HttpServletRequest request);
604
605 public String[] getGroupPermissions(PortletRequest portletRequest);
606
607 public String[] getGuestPermissions(HttpServletRequest request);
608
609 public String[] getGuestPermissions(PortletRequest portletRequest);
610
611 public String getHomeURL(HttpServletRequest request)
612 throws PortalException, SystemException;
613
614 public String getHost(HttpServletRequest request);
615
616 public String getHost(PortletRequest portletRequest);
617
618 public HttpServletRequest getHttpServletRequest(
619 PortletRequest portletRequest);
620
621 public HttpServletResponse getHttpServletResponse(
622 PortletResponse portletResponse);
623
624 public String getJournalArticleActualURL(
625 long groupId, String mainPath, String friendlyURL,
626 Map<String, String[]> params, Map<String, Object> requestContext)
627 throws PortalException, SystemException;
628
629 public String getJsSafePortletId(String portletId) ;
630
631 public String getLayoutActualURL(Layout layout);
632
633 public String getLayoutActualURL(Layout layout, String mainPath);
634
635 public String getLayoutActualURL(
636 long groupId, boolean privateLayout, String mainPath,
637 String friendlyURL)
638 throws PortalException, SystemException;
639
640 public String getLayoutActualURL(
641 long groupId, boolean privateLayout, String mainPath,
642 String friendlyURL, Map<String, String[]> params,
643 Map<String, Object> requestContext)
644 throws PortalException, SystemException;
645
646 public String getLayoutEditPage(Layout layout);
647
648 public String getLayoutEditPage(String type);
649
650 public String getLayoutFriendlyURL(
651 Layout layout, ThemeDisplay themeDisplay)
652 throws PortalException, SystemException;
653
654 public String getLayoutFriendlyURL(
655 Layout layout, ThemeDisplay themeDisplay, Locale locale)
656 throws PortalException, SystemException;
657
658 public String getLayoutFullURL(Layout layout, ThemeDisplay themeDisplay)
659 throws PortalException, SystemException;
660
661 public String getLayoutFullURL(
662 Layout layout, ThemeDisplay themeDisplay, boolean doAsUser)
663 throws PortalException, SystemException;
664
665 public String getLayoutFullURL(long groupId, String portletId)
666 throws PortalException, SystemException;
667
668 public String getLayoutFullURL(
669 long groupId, String portletId, boolean secure)
670 throws PortalException, SystemException;
671
672 public String getLayoutFullURL(ThemeDisplay themeDisplay)
673 throws PortalException, SystemException;
674
675 public String getLayoutSetFriendlyURL(
676 LayoutSet layoutSet, ThemeDisplay themeDisplay)
677 throws PortalException, SystemException;
678
679 public String getLayoutTarget(Layout layout);
680
681 public String getLayoutURL(Layout layout, ThemeDisplay themeDisplay)
682 throws PortalException, SystemException;
683
684 public String getLayoutURL(
685 Layout layout, ThemeDisplay themeDisplay, boolean doAsUser)
686 throws PortalException, SystemException;
687
688 public String getLayoutURL(ThemeDisplay themeDisplay)
689 throws PortalException, SystemException;
690
691 public String getLayoutViewPage(Layout layout);
692
693 public String getLayoutViewPage(String type);
694
695 public LiferayPortletRequest getLiferayPortletRequest(
696 PortletRequest portletRequest);
697
698 public LiferayPortletResponse getLiferayPortletResponse(
699 PortletResponse portletResponse);
700
701 public Locale getLocale(HttpServletRequest request);
702
703 public Locale getLocale(RenderRequest renderRequest);
704
705 public String getMailId(String mx, String popPortletPrefix, Object... ids);
706
707 public String getNetvibesURL(Portlet portlet, ThemeDisplay themeDisplay)
708 throws PortalException, SystemException;
709
710 public String getNewPortletTitle(
711 String portletTitle, String oldScopeName, String newScopeName);
712
713 public HttpServletRequest getOriginalServletRequest(
714 HttpServletRequest request);
715
716 public String getOuterPortletId(HttpServletRequest request);
717
718 public long getParentGroupId(long scopeGroupId)
719 throws PortalException, SystemException;
720
721 public String getPathContext();
722
723 public String getPathFriendlyURLPrivateGroup();
724
725 public String getPathFriendlyURLPrivateUser();
726
727 public String getPathFriendlyURLPublic();
728
729 public String getPathImage();
730
731 public String getPathMain();
732
733 public String getPathProxy();
734
735 public long getPlidFromFriendlyURL(long companyId, String friendlyURL);
736
737 public long getPlidFromPortletId(
738 long groupId, boolean privateLayout, String portletId)
739 throws PortalException, SystemException;
740
741 public long getPlidFromPortletId(long groupId, String portletId)
742 throws PortalException, SystemException;
743
744 public String getPortalLibDir();
745
746
749 public int getPortalPort();
750
751 public int getPortalPort(boolean secure);
752
753 public Properties getPortalProperties();
754
755 public String getPortalURL(HttpServletRequest request);
756
757 public String getPortalURL(HttpServletRequest request, boolean secure);
758
759 public String getPortalURL(PortletRequest portletRequest);
760
761 public String getPortalURL(PortletRequest portletRequest, boolean secure);
762
763 public String getPortalURL(
764 String serverName, int serverPort, boolean secure);
765
766 public String getPortalURL(Layout layout, ThemeDisplay themeDisplay)
767 throws PortalException, SystemException;
768
769 public String getPortalURL(ThemeDisplay themeDisplay)
770 throws PortalException, SystemException;
771
772 public String getPortalWebDir();
773
774 public Set<String> getPortletAddDefaultResourceCheckWhitelist();
775
776 public Set<String> getPortletAddDefaultResourceCheckWhitelistActions();
777
778
781 public List<BreadcrumbEntry> getPortletBreadcrumbList(
782 HttpServletRequest request);
783
784 public List<BreadcrumbEntry> getPortletBreadcrumbs(
785 HttpServletRequest request);
786
787 public String getPortletDescription(
788 Portlet portlet, ServletContext servletContext, Locale locale);
789
790 public String getPortletDescription(Portlet portlet, User user);
791
792 public String getPortletDescription(String portletId, Locale locale);
793
794 public String getPortletDescription(String portletId, String languageId);
795
796 public String getPortletDescription(String portletId, User user);
797
798 public String getPortletId(HttpServletRequest request);
799
800 public String getPortletId(PortletRequest portletRequest);
801
802 public String getPortletNamespace(String portletId);
803
804 public String getPortletTitle(Portlet portlet, Locale locale);
805
806 public String getPortletTitle(
807 Portlet portlet, ServletContext servletContext, Locale locale);
808
809 public String getPortletTitle(Portlet portlet, String languageId);
810
811 public String getPortletTitle(Portlet portlet, User user);
812
813 public String getPortletTitle(RenderResponse renderResponse);
814
815 public String getPortletTitle(String portletId, Locale locale);
816
817 public String getPortletTitle(String portletId, String languageId);
818
819 public String getPortletTitle(String portletId, User user);
820
821 public String getPortletXmlFileName() throws SystemException;
822
823 public PortletPreferences getPreferences(HttpServletRequest request);
824
825 public PreferencesValidator getPreferencesValidator(
826 Portlet portlet);
827
828 public String getRelativeHomeURL(HttpServletRequest request)
829 throws PortalException, SystemException;
830
831 public long getScopeGroupId(HttpServletRequest request)
832 throws PortalException, SystemException;
833
834 public long getScopeGroupId(HttpServletRequest request, String portletId)
835 throws PortalException, SystemException;
836
837 public long getScopeGroupId(Layout layout);
838
839 public long getScopeGroupId(Layout layout, String portletId);
840
841 public long getScopeGroupId(long plid);
842
843 public long getScopeGroupId(PortletRequest portletRequest)
844 throws PortalException, SystemException;
845
846 public User getSelectedUser(HttpServletRequest request)
847 throws PortalException, SystemException;
848
849 public User getSelectedUser(
850 HttpServletRequest request, boolean checkPermission)
851 throws PortalException, SystemException;
852
853 public User getSelectedUser(PortletRequest portletRequest)
854 throws PortalException, SystemException;
855
856 public User getSelectedUser(
857 PortletRequest portletRequest, boolean checkPermission)
858 throws PortalException, SystemException;
859
860 public ServletContext getServletContext(
861 Portlet portlet, ServletContext servletContext);
862
863
873 public String getSiteLoginURL(ThemeDisplay themeDisplay)
874 throws PortalException, SystemException;
875
876 public String getStaticResourceURL(
877 HttpServletRequest request, String uri);
878
879 public String getStaticResourceURL(
880 HttpServletRequest request, String uri, long timestamp);
881
882 public String getStaticResourceURL(
883 HttpServletRequest request, String uri, String queryString);
884
885 public String getStaticResourceURL(
886 HttpServletRequest request, String uri, String queryString,
887 long timestamp);
888
889 public String getStrutsAction(HttpServletRequest request);
890
891 public String[] getSystemGroups();
892
893 public String[] getSystemOrganizationRoles();
894
895 public String[] getSystemRoles();
896
897 public String[] getSystemSiteRoles();
898
899 public UploadPortletRequest getUploadPortletRequest(
900 PortletRequest portletRequest);
901
902 public UploadServletRequest getUploadServletRequest(
903 HttpServletRequest request);
904
905 public Date getUptime();
906
907 public String getURLWithSessionId(String url, String sessionId);
908
909 public User getUser(HttpServletRequest request)
910 throws PortalException, SystemException;
911
912 public User getUser(PortletRequest portletRequest)
913 throws PortalException, SystemException;
914
915 public String getUserEmailAddress(long userId) throws SystemException;
916
917 public long getUserId(HttpServletRequest request);
918
919 public long getUserId(PortletRequest portletRequest);
920
921 public String getUserName(long userId, String defaultUserName);
922
923 public String getUserName(
924 long userId, String defaultUserName, HttpServletRequest request);
925
926 public String getUserName(
927 long userId, String defaultUserName, String userAttribute);
928
929 public String getUserName(
930 long userId, String defaultUserName, String userAttribute,
931 HttpServletRequest request);
932
933 public String getUserPassword(HttpServletRequest request);
934
935 public String getUserPassword(HttpSession session);
936
937 public String getUserPassword(PortletRequest portletRequest);
938
939 public String getUserValue(long userId, String param, String defaultValue)
940 throws SystemException;
941
942 public long getValidUserId(long companyId, long userId)
943 throws PortalException, SystemException;
944
945 public String getWidgetURL(Portlet portlet, ThemeDisplay themeDisplay)
946 throws PortalException, SystemException;
947
948 public boolean isAllowAddPortletDefaultResource(
949 HttpServletRequest request, Portlet portlet)
950 throws PortalException, SystemException;
951
952
955 public boolean isCommunityAdmin(User user, long groupId) throws Exception;
956
957
960 public boolean isCommunityOwner(User user, long groupId) throws Exception;
961
962 public boolean isCompanyAdmin(User user) throws Exception;
963
964 public boolean isCompanyControlPanelPortlet(
965 String portletId, String category, ThemeDisplay themeDisplay)
966 throws PortalException, SystemException;
967
968 public boolean isCompanyControlPanelPortlet(
969 String portletId, ThemeDisplay themeDisplay)
970 throws PortalException, SystemException;
971
972 public boolean isCompanyControlPanelVisible(ThemeDisplay themeDisplay)
973 throws PortalException, SystemException;
974
975 public boolean isControlPanelPortlet(
976 String portletId, String category, ThemeDisplay themeDisplay)
977 throws SystemException;
978
979 public boolean isControlPanelPortlet(
980 String portletId, ThemeDisplay themeDisplay)
981 throws SystemException;
982
983 public boolean isGroupAdmin(User user, long groupId) throws Exception;
984
985 public boolean isGroupOwner(User user, long groupId) throws Exception;
986
987 public boolean isLayoutDescendant(Layout layout, long layoutId)
988 throws PortalException, SystemException;
989
990 public boolean isLayoutFirstPageable(Layout layout);
991
992 public boolean isLayoutFirstPageable(String type);
993
994 public boolean isLayoutFriendliable(Layout layout);
995
996 public boolean isLayoutFriendliable(String type);
997
998 public boolean isLayoutParentable(Layout layout);
999
1000 public boolean isLayoutParentable(String type);
1001
1002 public boolean isLayoutSitemapable(Layout layout);
1003
1004 public boolean isMethodGet(PortletRequest portletRequest);
1005
1006 public boolean isMethodPost(PortletRequest portletRequest);
1007
1008 public boolean isMultipartRequest(HttpServletRequest request);
1009
1010 public boolean isOmniadmin(long userId);
1011
1012 public boolean isReservedParameter(String name);
1013
1014 public boolean isSecure(HttpServletRequest request);
1015
1016 public boolean isSystemGroup(String groupName);
1017
1018 public boolean isSystemRole(String roleName);
1019
1020 public boolean isUpdateAvailable() throws SystemException;
1021
1022 public boolean isValidResourceId(String resourceId);
1023
1024 public void removePortalPortEventListener(
1025 PortalPortEventListener portalPortEventListener);
1026
1027 public String renderPage(
1028 ServletContext servletContext, HttpServletRequest request,
1029 HttpServletResponse response, String path)
1030 throws IOException, ServletException;
1031
1032 public String renderPortlet(
1033 ServletContext servletContext, HttpServletRequest request,
1034 HttpServletResponse response, Portlet portlet, String queryString,
1035 boolean writeOutput)
1036 throws IOException, ServletException;
1037
1038 public String renderPortlet(
1039 ServletContext servletContext, HttpServletRequest request,
1040 HttpServletResponse response, Portlet portlet, String queryString,
1041 String columnId, Integer columnPos, Integer columnCount,
1042 boolean writeOutput)
1043 throws IOException, ServletException;
1044
1045 public String renderPortlet(
1046 ServletContext servletContext, HttpServletRequest request,
1047 HttpServletResponse response, Portlet portlet, String queryString,
1048 String columnId, Integer columnPos, Integer columnCount,
1049 String path, boolean writeOutput)
1050 throws IOException, ServletException;
1051
1052 public void resetCDNHosts();
1053
1054 public Set<String> resetPortletAddDefaultResourceCheckWhitelist();
1055
1056 public Set<String> resetPortletAddDefaultResourceCheckWhitelistActions();
1057
1058 public void sendError(
1059 Exception e, ActionRequest actionRequest,
1060 ActionResponse actionResponse)
1061 throws IOException;
1062
1063 public void sendError(
1064 Exception e, HttpServletRequest request,
1065 HttpServletResponse response)
1066 throws IOException, ServletException;
1067
1068 public void sendError(
1069 int status, Exception e, ActionRequest actionRequest,
1070 ActionResponse actionResponse)
1071 throws IOException;
1072
1073 public void sendError(
1074 int status, Exception e, HttpServletRequest request,
1075 HttpServletResponse response)
1076 throws IOException, ServletException;
1077
1078
1082 public void setPageDescription(
1083 String description, HttpServletRequest request);
1084
1085
1088 public void setPageKeywords(String keywords, HttpServletRequest request);
1089
1090
1093 public void setPageSubtitle(String subtitle, HttpServletRequest request);
1094
1095
1099 public void setPageTitle(String title, HttpServletRequest request);
1100
1101
1104 public void setPortalPort(HttpServletRequest request);
1105
1106 public void storePreferences(PortletPreferences portletPreferences)
1107 throws IOException, ValidatorException;
1108
1109 public String[] stripURLAnchor(String url, String separator);
1110
1111 public String transformCustomSQL(String sql);
1112
1113 public PortletMode updatePortletMode(
1114 String portletId, User user, Layout layout, PortletMode portletMode,
1115 HttpServletRequest request);
1116
1117 public WindowState updateWindowState(
1118 String portletId, User user, Layout layout, WindowState windowState,
1119 HttpServletRequest request);
1120
1121 }