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 PortletPreferences fromXML(
040                            long companyId, long ownerId, int ownerType, long plid,
041                            String portletId, String xml)
042                    throws SystemException;
043    
044            public PortalPreferences fromXML(
045                            long companyId, long ownerId, int ownerType, String xml)
046                    throws SystemException;
047    
048            public PortletPreferences getLayoutPortletSetup(
049                            Layout layout, String portletId)
050                    throws SystemException;
051    
052            public PortalPreferences getPortalPreferences(HttpServletRequest request)
053                    throws SystemException;
054    
055            public PortalPreferences getPortalPreferences(
056                            HttpSession session, long companyId, long userId, boolean signedIn)
057                    throws SystemException;
058    
059            public PortalPreferences getPortalPreferences(
060                            long companyId, long userId, boolean signedIn)
061                    throws SystemException;
062    
063            public PortalPreferences getPortalPreferences(PortletRequest portletRequest)
064                    throws SystemException;
065    
066            public PortletPreferences getPortletPreferences(
067                            HttpServletRequest request, String portletId)
068                    throws PortalException, SystemException;
069    
070            public PortletPreferencesIds getPortletPreferencesIds(
071                            HttpServletRequest request, Layout selLayout, String portletId)
072                    throws PortalException, SystemException;
073    
074            public PortletPreferencesIds getPortletPreferencesIds(
075                            HttpServletRequest request, String portletId)
076                    throws PortalException, SystemException;
077    
078            public PortletPreferencesIds getPortletPreferencesIds(
079                            long scopeGroupId, long userId, Layout layout, String portletId,
080                            boolean modeEditGuest)
081                    throws PortalException, SystemException;
082    
083            public PortletPreferences getPortletSetup(
084                            HttpServletRequest request, String portletId)
085                    throws PortalException, SystemException;
086    
087            public PortletPreferences getPortletSetup(
088                            HttpServletRequest request, String portletId,
089                            String defaultPreferences)
090                    throws PortalException, SystemException;
091    
092            public PortletPreferences getPortletSetup(
093                            Layout layout, String portletId, String defaultPreferences)
094                    throws SystemException;
095    
096            public PortletPreferences getPortletSetup(
097                            long scopeGroupId, Layout layout, String portletId,
098                            String defaultPreferences)
099                    throws SystemException;
100    
101            public PortletPreferences getPortletSetup(PortletRequest portletRequest)
102                    throws PortalException, SystemException;
103    
104            public PortletPreferences getPortletSetup(
105                            PortletRequest portletRequest, String portletId)
106                    throws PortalException, SystemException;
107    
108            public Map<Long, PortletPreferences> getPortletSetupMap(
109                            long companyId, long groupId, long ownerId, int ownerType,
110                            String portletId, boolean privateLayout)
111                    throws SystemException;
112    
113            public PortletPreferences getPreferences(HttpServletRequest request);
114    
115            public PreferencesValidator getPreferencesValidator(Portlet portlet);
116    
117            public PortletPreferences getStrictLayoutPortletSetup(
118                            Layout layout, String portletId)
119                    throws SystemException;
120    
121            public PortletPreferences getStrictPortletSetup(
122                            Layout layout, String portletId)
123                    throws SystemException;
124    
125            public String toXML(PortalPreferences portalPreferences);
126    
127            public String toXML(PortletPreferences portletPreferences);
128    
129    }