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