001    /**
002     * Copyright (c) 2000-2011 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 javax.portlet.PortletPreferences;
024    import javax.portlet.PortletRequest;
025    import javax.portlet.PreferencesValidator;
026    
027    import javax.servlet.http.HttpServletRequest;
028    import javax.servlet.http.HttpSession;
029    
030    /**
031     * @author Brian Wing Shun Chan
032     */
033    public interface PortletPreferencesFactory {
034    
035            public PortletPreferences fromDefaultXML(String xml) throws SystemException;
036    
037            public PortletPreferences fromXML(
038                            long companyId, long ownerId, int ownerType, long plid,
039                            String portletId, String xml)
040                    throws SystemException;
041    
042            public PortalPreferences fromXML(
043                            long companyId, long ownerId, int ownerType, String xml)
044                    throws SystemException;
045    
046            public PortletPreferences getLayoutPortletSetup(
047                            Layout layout, String portletId)
048                    throws SystemException;
049    
050            public PortalPreferences getPortalPreferences(HttpServletRequest request)
051                    throws SystemException;
052    
053            public PortalPreferences getPortalPreferences(
054                            HttpSession session, long companyId, long userId, boolean signedIn)
055                    throws SystemException;
056    
057            public PortalPreferences getPortalPreferences(
058                            long companyId, long userId, boolean signedIn)
059                    throws SystemException;
060    
061            public PortalPreferences getPortalPreferences(PortletRequest portletRequest)
062                    throws SystemException;
063    
064            public PortletPreferences getPortletPreferences(
065                            HttpServletRequest request, String portletId)
066                    throws PortalException, SystemException;
067    
068            public PortletPreferencesIds getPortletPreferencesIds(
069                            HttpServletRequest request, Layout selLayout, String portletId)
070                    throws PortalException, SystemException;
071    
072            public PortletPreferencesIds getPortletPreferencesIds(
073                            HttpServletRequest request, String portletId)
074                    throws PortalException, SystemException;
075    
076            public PortletPreferencesIds getPortletPreferencesIds(
077                            long scopeGroupId, long userId, Layout layout, String portletId,
078                            boolean modeEditGuest)
079                    throws PortalException, SystemException;
080    
081            public PortletPreferences getPortletSetup(
082                            HttpServletRequest request, String portletId)
083                    throws PortalException, SystemException;
084    
085            public PortletPreferences getPortletSetup(
086                            HttpServletRequest request, String portletId,
087                            String defaultPreferences)
088                    throws PortalException, SystemException;
089    
090            public PortletPreferences getPortletSetup(
091                            Layout layout, String portletId, String defaultPreferences)
092                    throws SystemException;
093    
094            public PortletPreferences getPortletSetup(
095                            long scopeGroupId, Layout layout, String portletId,
096                            String defaultPreferences)
097                    throws SystemException;
098    
099            public PortletPreferences getPortletSetup(PortletRequest portletRequest)
100                    throws PortalException, SystemException;
101    
102            public PortletPreferences getPortletSetup(
103                            PortletRequest portletRequest, String portletId)
104                    throws PortalException, SystemException;
105    
106            public PortletPreferences getPreferences(HttpServletRequest request);
107    
108            public PreferencesValidator getPreferencesValidator(Portlet portlet);
109    
110            public PortletPreferences getStrictLayoutPortletSetup(
111                            Layout layout, String portletId)
112                    throws SystemException;
113    
114            public String toXML(PortalPreferences portalPreferences);
115    
116            public String toXML(PortletPreferences portletPreferences);
117    
118    }