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 com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.model.Layout;
020    import com.liferay.portal.model.Portlet;
021    import com.liferay.portal.model.PortletPreferencesIds;
022    
023    import java.util.Map;
024    
025    import javax.portlet.PortletPreferences;
026    import javax.portlet.PortletRequest;
027    import javax.portlet.PreferencesValidator;
028    
029    import javax.servlet.http.HttpServletRequest;
030    import javax.servlet.http.HttpSession;
031    
032    /**
033     * @author Brian Wing Shun Chan
034     */
035    public interface PortletPreferencesFactory {
036    
037            public PortletPreferences fromDefaultXML(String xml) throws SystemException;
038    
039            public PortalPreferences fromXML(long ownerId, int ownerType, String xml)
040                    throws SystemException;
041    
042            public PortletPreferences fromXML(
043                            long companyId, long ownerId, int ownerType, long plid,
044                            String portletId, String xml)
045                    throws SystemException;
046    
047            /**
048             * @deprecated As of 6.2.0, replaced by {@link #fromXML(long, int, String)}
049             */
050            public PortalPreferences fromXML(
051                            long companyId, long ownerId, int ownerType, String xml)
052                    throws SystemException;
053    
054            public PortletPreferences getLayoutPortletSetup(
055                            Layout layout, String portletId)
056                    throws SystemException;
057    
058            public PortalPreferences getPortalPreferences(HttpServletRequest request)
059                    throws SystemException;
060    
061            public PortalPreferences getPortalPreferences(
062                            HttpSession session, long userId, boolean signedIn)
063                    throws SystemException;
064    
065            /**
066             * @deprecated As of 6.2.0, replaced by {@link
067             *             #getPortalPreferences(HttpSession, long, boolean)}
068             */
069            public PortalPreferences getPortalPreferences(
070                            HttpSession session, long companyId, long userId, boolean signedIn)
071                    throws SystemException;
072    
073            public PortalPreferences getPortalPreferences(long userId, boolean signedIn)
074                    throws SystemException;
075    
076            /**
077             * @deprecated As of 6.2.0, replaced by {@link #getPortalPreferences(long,
078             *             boolean)}
079             */
080            public PortalPreferences getPortalPreferences(
081                            long companyId, long userId, boolean signedIn)
082                    throws SystemException;
083    
084            public PortalPreferences getPortalPreferences(PortletRequest portletRequest)
085                    throws SystemException;
086    
087            public PortletPreferences getPortletPreferences(
088                            HttpServletRequest request, String portletId)
089                    throws PortalException, SystemException;
090    
091            public PortletPreferencesIds getPortletPreferencesIds(
092                            HttpServletRequest request, Layout selLayout, String portletId)
093                    throws PortalException, SystemException;
094    
095            public PortletPreferencesIds getPortletPreferencesIds(
096                            HttpServletRequest request, String portletId)
097                    throws PortalException, SystemException;
098    
099            public PortletPreferencesIds getPortletPreferencesIds(
100                            long scopeGroupId, long userId, Layout layout, String portletId,
101                            boolean modeEditGuest)
102                    throws PortalException, SystemException;
103    
104            public PortletPreferences getPortletSetup(
105                            HttpServletRequest request, String portletId)
106                    throws PortalException, SystemException;
107    
108            public PortletPreferences getPortletSetup(
109                            HttpServletRequest request, String portletId,
110                            String defaultPreferences)
111                    throws PortalException, SystemException;
112    
113            public PortletPreferences getPortletSetup(
114                            Layout layout, String portletId, String defaultPreferences)
115                    throws SystemException;
116    
117            public PortletPreferences getPortletSetup(
118                            long scopeGroupId, Layout layout, String portletId,
119                            String defaultPreferences)
120                    throws SystemException;
121    
122            public PortletPreferences getPortletSetup(PortletRequest portletRequest)
123                    throws PortalException, SystemException;
124    
125            public PortletPreferences getPortletSetup(
126                            PortletRequest portletRequest, String portletId)
127                    throws PortalException, SystemException;
128    
129            public Map<Long, PortletPreferences> getPortletSetupMap(
130                            long companyId, long groupId, long ownerId, int ownerType,
131                            String portletId, boolean privateLayout)
132                    throws SystemException;
133    
134            public PortletPreferences getPreferences(HttpServletRequest request);
135    
136            public PreferencesValidator getPreferencesValidator(Portlet portlet);
137    
138            public PortletPreferences getStrictLayoutPortletSetup(
139                            Layout layout, String portletId)
140                    throws SystemException;
141    
142            public PortletPreferences getStrictPortletSetup(
143                            Layout layout, String portletId)
144                    throws SystemException;
145    
146            public String toXML(PortalPreferences portalPreferences);
147    
148            public String toXML(PortletPreferences portletPreferences);
149    
150    }