001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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.kernel.exception.SystemException;
021    import com.liferay.portal.model.Layout;
022    import com.liferay.portal.model.Portlet;
023    import com.liferay.portal.model.PortletPreferencesIds;
024    import com.liferay.portal.theme.ThemeDisplay;
025    
026    import java.util.Map;
027    
028    import javax.portlet.PortletPreferences;
029    import javax.portlet.PortletRequest;
030    import javax.portlet.PreferencesValidator;
031    
032    import javax.servlet.http.HttpServletRequest;
033    import javax.servlet.http.HttpSession;
034    
035    /**
036     * @author Brian Wing Shun Chan
037     */
038    @ProviderType
039    public interface PortletPreferencesFactory {
040    
041            public void checkControlPanelPortletPreferences(
042                            ThemeDisplay themeDisplay, Portlet portlet)
043                    throws PortalException, SystemException;
044    
045            public PortletPreferences fromDefaultXML(String xml) throws SystemException;
046    
047            public PortalPreferences fromXML(long ownerId, int ownerType, String xml)
048                    throws SystemException;
049    
050            public PortletPreferences fromXML(
051                            long companyId, long ownerId, int ownerType, long plid,
052                            String portletId, String xml)
053                    throws SystemException;
054    
055            /**
056             * @deprecated As of 6.2.0, replaced by {@link #fromXML(long, int, String)}
057             */
058            public PortalPreferences fromXML(
059                            long companyId, long ownerId, int ownerType, String xml)
060                    throws SystemException;
061    
062            public PortletPreferences getLayoutPortletSetup(
063                            Layout layout, String portletId)
064                    throws SystemException;
065    
066            public PortletPreferences getLayoutPortletSetup(
067                            Layout layout, String portletId, String defaultPreferences)
068                    throws SystemException;
069    
070            public PortalPreferences getPortalPreferences(HttpServletRequest request)
071                    throws SystemException;
072    
073            public PortalPreferences getPortalPreferences(
074                            HttpSession session, long userId, boolean signedIn)
075                    throws SystemException;
076    
077            /**
078             * @deprecated As of 6.2.0, replaced by {@link
079             *             #getPortalPreferences(HttpSession, long, boolean)}
080             */
081            public PortalPreferences getPortalPreferences(
082                            HttpSession session, long companyId, long userId, boolean signedIn)
083                    throws SystemException;
084    
085            public PortalPreferences getPortalPreferences(long userId, boolean signedIn)
086                    throws SystemException;
087    
088            /**
089             * @deprecated As of 6.2.0, replaced by {@link #getPortalPreferences(long,
090             *             boolean)}
091             */
092            public PortalPreferences getPortalPreferences(
093                            long companyId, long userId, boolean signedIn)
094                    throws SystemException;
095    
096            public PortalPreferences getPortalPreferences(PortletRequest portletRequest)
097                    throws SystemException;
098    
099            public PortletPreferences getPortletPreferences(
100                            HttpServletRequest request, String portletId)
101                    throws PortalException, SystemException;
102    
103            public PortletPreferencesIds getPortletPreferencesIds(
104                            HttpServletRequest request, Layout selLayout, String portletId)
105                    throws PortalException, SystemException;
106    
107            public PortletPreferencesIds getPortletPreferencesIds(
108                            HttpServletRequest request, String portletId)
109                    throws PortalException, SystemException;
110    
111            public PortletPreferencesIds getPortletPreferencesIds(
112                            long scopeGroupId, long userId, Layout layout, String portletId,
113                            boolean modeEditGuest)
114                    throws PortalException, SystemException;
115    
116            public PortletPreferences getPortletSetup(
117                            HttpServletRequest request, String portletId)
118                    throws PortalException, SystemException;
119    
120            public PortletPreferences getPortletSetup(
121                            HttpServletRequest request, String portletId,
122                            String defaultPreferences)
123                    throws PortalException, SystemException;
124    
125            public PortletPreferences getPortletSetup(
126                            Layout layout, String portletId, String defaultPreferences)
127                    throws SystemException;
128    
129            public PortletPreferences getPortletSetup(
130                            long scopeGroupId, Layout layout, String portletId,
131                            String defaultPreferences)
132                    throws SystemException;
133    
134            public PortletPreferences getPortletSetup(PortletRequest portletRequest)
135                    throws PortalException, SystemException;
136    
137            public PortletPreferences getPortletSetup(
138                            PortletRequest portletRequest, String portletId)
139                    throws PortalException, SystemException;
140    
141            public Map<Long, PortletPreferences> getPortletSetupMap(
142                            long companyId, long groupId, long ownerId, int ownerType,
143                            String portletId, boolean privateLayout)
144                    throws SystemException;
145    
146            public PortletPreferences getPreferences(HttpServletRequest request);
147    
148            public PreferencesValidator getPreferencesValidator(Portlet portlet);
149    
150            public PortletPreferences getStrictLayoutPortletSetup(
151                            Layout layout, String portletId)
152                    throws SystemException;
153    
154            public PortletPreferences getStrictPortletSetup(
155                            Layout layout, String portletId)
156                    throws SystemException;
157    
158            public PortletPreferences strictFromXML(
159                            long companyId, long ownerId, int ownerType, long plid,
160                            String portletId, String xml)
161                    throws SystemException;
162    
163            public String toXML(PortalPreferences portalPreferences);
164    
165            public String toXML(PortletPreferences portletPreferences);
166    
167    }