001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.exception.PortalException;
020    import com.liferay.portal.model.Layout;
021    import com.liferay.portal.model.Portlet;
022    import com.liferay.portal.model.PortletPreferencesIds;
023    import com.liferay.portal.theme.ThemeDisplay;
024    
025    import java.util.Map;
026    
027    import javax.portlet.PortletPreferences;
028    import javax.portlet.PortletRequest;
029    import javax.portlet.PreferencesValidator;
030    
031    import javax.servlet.http.HttpServletRequest;
032    import javax.servlet.http.HttpSession;
033    
034    /**
035     * @author Brian Wing Shun Chan
036     */
037    @ProviderType
038    public interface PortletPreferencesFactory {
039    
040            public void checkControlPanelPortletPreferences(
041                            ThemeDisplay themeDisplay, Portlet portlet)
042                    throws PortalException;
043    
044            public PortletPreferences fromDefaultXML(String xml);
045    
046            public PortalPreferences fromXML(long ownerId, int ownerType, String xml);
047    
048            public PortletPreferences fromXML(
049                    long companyId, long ownerId, int ownerType, long plid,
050                    String portletId, String xml);
051    
052            /**
053             * @deprecated As of 6.2.0, replaced by {@link #fromXML(long, int, String)}
054             */
055            @Deprecated
056            public PortalPreferences fromXML(
057                    long companyId, long ownerId, int ownerType, String xml);
058    
059            public PortletPreferences getExistingPortletSetup(
060                            Layout layout, String portletId)
061                    throws PortalException;
062    
063            public PortletPreferences getExistingPortletSetup(
064                            PortletRequest portletRequest)
065                    throws PortalException;
066    
067            public PortletPreferences getLayoutPortletSetup(
068                    Layout layout, String portletId);
069    
070            public PortletPreferences getLayoutPortletSetup(
071                    Layout layout, String portletId, String defaultPreferences);
072    
073            public PortletPreferences getLayoutPortletSetup(
074                    long companyId, long ownerId, int ownerType, long plid,
075                    String portletId, String defaultPreferences);
076    
077            public PortalPreferences getPortalPreferences(HttpServletRequest request);
078    
079            public PortalPreferences getPortalPreferences(
080                    HttpSession session, long userId, boolean signedIn);
081    
082            /**
083             * @deprecated As of 6.2.0, replaced by {@link
084             *             #getPortalPreferences(HttpSession, long, boolean)}
085             */
086            @Deprecated
087            public PortalPreferences getPortalPreferences(
088                    HttpSession session, long companyId, long userId, boolean signedIn);
089    
090            public PortalPreferences getPortalPreferences(
091                    long userId, boolean signedIn);
092    
093            /**
094             * @deprecated As of 6.2.0, replaced by {@link #getPortalPreferences(long,
095             *             boolean)}
096             */
097            @Deprecated
098            public PortalPreferences getPortalPreferences(
099                    long companyId, long userId, boolean signedIn);
100    
101            public PortalPreferences getPortalPreferences(
102                    PortletRequest portletRequest);
103    
104            public PortletPreferences getPortletPreferences(
105                            HttpServletRequest request, String portletId)
106                    throws PortalException;
107    
108            public PortletPreferencesIds getPortletPreferencesIds(
109                            HttpServletRequest request, Layout selLayout, String portletId)
110                    throws PortalException;
111    
112            public PortletPreferencesIds getPortletPreferencesIds(
113                            HttpServletRequest request, String portletId)
114                    throws PortalException;
115    
116            public PortletPreferencesIds getPortletPreferencesIds(
117                            long scopeGroupId, long userId, Layout layout, String portletId,
118                            boolean modeEditGuest)
119                    throws PortalException;
120    
121            public PortletPreferencesIds getPortletPreferencesIds(
122                    long companyId, long siteGroupId, long plid, String portletId,
123                    String settingsScope);
124    
125            public PortletPreferences getPortletSetup(
126                            HttpServletRequest request, String portletId)
127                    throws PortalException;
128    
129            public PortletPreferences getPortletSetup(
130                            HttpServletRequest request, String portletId,
131                            String defaultPreferences)
132                    throws PortalException;
133    
134            public PortletPreferences getPortletSetup(
135                    Layout layout, String portletId, String defaultPreferences);
136    
137            public PortletPreferences getPortletSetup(
138                    long scopeGroupId, Layout layout, String portletId,
139                    String defaultPreferences);
140    
141            public PortletPreferences getPortletSetup(PortletRequest portletRequest)
142                    throws PortalException;
143    
144            public PortletPreferences getPortletSetup(
145                            PortletRequest portletRequest, String portletId)
146                    throws PortalException;
147    
148            public Map<Long, PortletPreferences> getPortletSetupMap(
149                    long companyId, long groupId, long ownerId, int ownerType,
150                    String portletId, boolean privateLayout);
151    
152            public PortletPreferences getPreferences(HttpServletRequest request);
153    
154            public PreferencesValidator getPreferencesValidator(Portlet portlet);
155    
156            public PortletPreferences getStrictLayoutPortletSetup(
157                    Layout layout, String portletId);
158    
159            public PortletPreferences getStrictPortletSetup(
160                    Layout layout, String portletId);
161    
162            public PortletPreferences getStrictPortletSetup(
163                    long companyId, long groupId, String portletId);
164    
165            public PortletPreferences strictFromXML(
166                    long companyId, long ownerId, int ownerType, long plid,
167                    String portletId, String xml);
168    
169            public String toXML(PortalPreferences portalPreferences);
170    
171            public String toXML(PortletPreferences portletPreferences);
172    
173    }