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