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 PortalPreferences getPortalPreferences(HttpServletRequest request);
074    
075            public PortalPreferences getPortalPreferences(
076                    HttpSession session, long userId, boolean signedIn);
077    
078            /**
079             * @deprecated As of 6.2.0, replaced by {@link
080             *             #getPortalPreferences(HttpSession, long, boolean)}
081             */
082            @Deprecated
083            public PortalPreferences getPortalPreferences(
084                    HttpSession session, long companyId, long userId, boolean signedIn);
085    
086            public PortalPreferences getPortalPreferences(
087                    long userId, boolean signedIn);
088    
089            /**
090             * @deprecated As of 6.2.0, replaced by {@link #getPortalPreferences(long,
091             *             boolean)}
092             */
093            @Deprecated
094            public PortalPreferences getPortalPreferences(
095                    long companyId, long userId, boolean signedIn);
096    
097            public PortalPreferences getPortalPreferences(
098                    PortletRequest portletRequest);
099    
100            public PortletPreferences getPortletPreferences(
101                            HttpServletRequest request, String portletId)
102                    throws PortalException;
103    
104            public PortletPreferencesIds getPortletPreferencesIds(
105                            HttpServletRequest request, Layout selLayout, String portletId)
106                    throws PortalException;
107    
108            public PortletPreferencesIds getPortletPreferencesIds(
109                            HttpServletRequest request, String portletId)
110                    throws PortalException;
111    
112            public PortletPreferencesIds getPortletPreferencesIds(
113                            long scopeGroupId, long userId, Layout layout, String portletId,
114                            boolean modeEditGuest)
115                    throws PortalException;
116    
117            public PortletPreferencesIds getPortletPreferencesIds(
118                    long companyId, long siteGroupId, long plid, String portletId,
119                    String settingsScope);
120    
121            public PortletPreferences getPortletSetup(
122                            HttpServletRequest request, String portletId)
123                    throws PortalException;
124    
125            public PortletPreferences getPortletSetup(
126                            HttpServletRequest request, String portletId,
127                            String defaultPreferences)
128                    throws PortalException;
129    
130            public PortletPreferences getPortletSetup(
131                    Layout layout, String portletId, String defaultPreferences);
132    
133            public PortletPreferences getPortletSetup(
134                    long scopeGroupId, Layout layout, String portletId,
135                    String defaultPreferences);
136    
137            public PortletPreferences getPortletSetup(PortletRequest portletRequest)
138                    throws PortalException;
139    
140            public PortletPreferences getPortletSetup(
141                            PortletRequest portletRequest, String portletId)
142                    throws PortalException;
143    
144            public Map<Long, PortletPreferences> getPortletSetupMap(
145                    long companyId, long groupId, long ownerId, int ownerType,
146                    String portletId, boolean privateLayout);
147    
148            public PortletPreferences getPreferences(HttpServletRequest request);
149    
150            public PreferencesValidator getPreferencesValidator(Portlet portlet);
151    
152            public PortletPreferences getStrictLayoutPortletSetup(
153                    Layout layout, String portletId);
154    
155            public PortletPreferences getStrictPortletSetup(
156                    Layout layout, String portletId);
157    
158            public PortletPreferences strictFromXML(
159                    long companyId, long ownerId, int ownerType, long plid,
160                    String portletId, String xml);
161    
162            public String toXML(PortalPreferences portalPreferences);
163    
164            public String toXML(PortletPreferences portletPreferences);
165    
166    }