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.portal.kernel.portlet;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.exception.PortalException;
020    import com.liferay.portal.kernel.model.Layout;
021    import com.liferay.portal.kernel.model.Portlet;
022    import com.liferay.portal.kernel.model.PortletPreferencesIds;
023    import com.liferay.portal.kernel.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            public PortletPreferences getExistingPortletSetup(
053                            Layout layout, String portletId)
054                    throws PortalException;
055    
056            public PortletPreferences getExistingPortletSetup(
057                            PortletRequest portletRequest)
058                    throws PortalException;
059    
060            public PortletPreferences getLayoutPortletSetup(
061                    Layout layout, String portletId);
062    
063            public PortletPreferences getLayoutPortletSetup(
064                    Layout layout, String portletId, String defaultPreferences);
065    
066            public PortletPreferences getLayoutPortletSetup(
067                    long companyId, long ownerId, int ownerType, long plid,
068                    String portletId, String defaultPreferences);
069    
070            public PortalPreferences getPortalPreferences(HttpServletRequest request);
071    
072            public PortalPreferences getPortalPreferences(
073                    HttpSession session, long userId, boolean signedIn);
074    
075            public PortalPreferences getPortalPreferences(
076                    long userId, boolean signedIn);
077    
078            public PortalPreferences getPortalPreferences(
079                    PortletRequest portletRequest);
080    
081            public PortletPreferences getPortletPreferences(
082                            HttpServletRequest request, String portletId)
083                    throws PortalException;
084    
085            public PortletPreferencesIds getPortletPreferencesIds(
086                            HttpServletRequest request, Layout selLayout, String portletId)
087                    throws PortalException;
088    
089            public PortletPreferencesIds getPortletPreferencesIds(
090                            HttpServletRequest request, String portletId)
091                    throws PortalException;
092    
093            public PortletPreferencesIds getPortletPreferencesIds(
094                            long scopeGroupId, long userId, Layout layout, String portletId,
095                            boolean modeEditGuest)
096                    throws PortalException;
097    
098            public PortletPreferencesIds getPortletPreferencesIds(
099                    long companyId, long siteGroupId, long plid, String portletId,
100                    String settingsScope);
101    
102            public PortletPreferences getPortletSetup(
103                            HttpServletRequest request, String portletId)
104                    throws PortalException;
105    
106            public PortletPreferences getPortletSetup(
107                            HttpServletRequest request, String portletId,
108                            String defaultPreferences)
109                    throws PortalException;
110    
111            public PortletPreferences getPortletSetup(
112                    Layout layout, String portletId, String defaultPreferences);
113    
114            public PortletPreferences getPortletSetup(
115                    long scopeGroupId, Layout layout, String portletId,
116                    String defaultPreferences);
117    
118            public PortletPreferences getPortletSetup(PortletRequest portletRequest)
119                    throws PortalException;
120    
121            public PortletPreferences getPortletSetup(
122                            PortletRequest portletRequest, String portletId)
123                    throws PortalException;
124    
125            public Map<Long, PortletPreferences> getPortletSetupMap(
126                    long companyId, long groupId, long ownerId, int ownerType,
127                    String portletId, boolean privateLayout);
128    
129            public PortletPreferences getPreferences(HttpServletRequest request);
130    
131            public PreferencesValidator getPreferencesValidator(Portlet portlet);
132    
133            public PortletPreferences getStrictLayoutPortletSetup(
134                    Layout layout, String portletId);
135    
136            public PortletPreferences getStrictPortletSetup(
137                    Layout layout, String portletId);
138    
139            public PortletPreferences getStrictPortletSetup(
140                    long companyId, long groupId, String portletId);
141    
142            public PortletPreferences strictFromXML(
143                    long companyId, long ownerId, int ownerType, long plid,
144                    String portletId, String xml);
145    
146            public String toXML(PortalPreferences portalPreferences);
147    
148            public String toXML(PortletPreferences portletPreferences);
149    
150    }