1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portlet;
21  
22  import com.liferay.portal.PortalException;
23  import com.liferay.portal.SystemException;
24  import com.liferay.portal.model.Layout;
25  import com.liferay.portal.model.Portlet;
26  import com.liferay.portal.model.PortletPreferencesIds;
27  
28  import javax.portlet.PortletPreferences;
29  import javax.portlet.PortletRequest;
30  import javax.portlet.PreferencesValidator;
31  
32  import javax.servlet.http.HttpServletRequest;
33  
34  /**
35   * <a href="PortletPreferencesFactoryUtil.java.html"><b><i>View Source</i></b>
36   * </a>
37   *
38   * @author Brian Wing Shun Chan
39   *
40   */
41  public class PortletPreferencesFactoryUtil {
42  
43      public static PortletPreferences getLayoutPortletSetup(
44              Layout layout, String portletId)
45          throws SystemException {
46  
47          return getPortletPreferencesFactory().getLayoutPortletSetup(
48              layout, portletId);
49      }
50  
51      public static PortalPreferences getPortalPreferences(
52              HttpServletRequest request)
53          throws SystemException {
54  
55          return getPortletPreferencesFactory().getPortalPreferences(request);
56      }
57  
58      public static PortalPreferences getPortalPreferences(
59              PortletRequest portletRequest)
60          throws SystemException {
61  
62          return getPortletPreferencesFactory().getPortalPreferences(
63              portletRequest);
64      }
65  
66      public static PortletPreferences getPortletPreferences(
67              HttpServletRequest request, String portletId)
68          throws PortalException, SystemException {
69  
70          return getPortletPreferencesFactory().getPortletPreferences(
71              request, portletId);
72      }
73  
74      public static PortletPreferencesFactory getPortletPreferencesFactory() {
75          return _portletPreferencesFactory;
76      }
77  
78      public static PortletPreferencesIds getPortletPreferencesIds(
79              HttpServletRequest request, String portletId)
80          throws PortalException, SystemException {
81  
82          return getPortletPreferencesFactory().getPortletPreferencesIds(
83              request, portletId);
84      }
85  
86      public static PortletPreferencesIds getPortletPreferencesIds(
87              HttpServletRequest request, Layout selLayout, String portletId)
88          throws PortalException, SystemException {
89  
90          return getPortletPreferencesFactory().getPortletPreferencesIds(
91              request, selLayout, portletId);
92      }
93  
94      public static PortletPreferences getPortletSetup(
95              Layout layout, String portletId, String defaultPreferences)
96          throws SystemException {
97  
98          return getPortletPreferencesFactory().getPortletSetup(
99              layout, portletId, defaultPreferences);
100     }
101 
102     public static PortletPreferences getPortletSetup(
103             HttpServletRequest request, String portletId)
104         throws SystemException {
105 
106         return getPortletPreferencesFactory().getPortletSetup(
107             request, portletId);
108     }
109 
110     public static PortletPreferences getPortletSetup(
111             HttpServletRequest request, String portletId,
112             String defaultPreferences)
113         throws SystemException {
114 
115         return getPortletPreferencesFactory().getPortletSetup(
116             request, portletId, defaultPreferences);
117     }
118 
119     public static PortletPreferences getPortletSetup(
120             PortletRequest portletRequest)
121         throws SystemException {
122 
123         return getPortletPreferencesFactory().getPortletSetup(portletRequest);
124     }
125 
126     public static PortletPreferences getPortletSetup(
127             PortletRequest portletRequest, String portletId)
128         throws SystemException {
129 
130         return getPortletPreferencesFactory().getPortletSetup(
131             portletRequest, portletId);
132     }
133 
134     public static PortletPreferences getPreferences(
135         HttpServletRequest request) {
136 
137         return getPortletPreferencesFactory().getPreferences(request);
138     }
139 
140     public static PreferencesValidator getPreferencesValidator(
141         Portlet portlet) {
142 
143         return getPortletPreferencesFactory().getPreferencesValidator(portlet);
144     }
145 
146     public void setPortletPreferencesFactory(
147         PortletPreferencesFactory portletPreferencesFactory) {
148 
149         _portletPreferencesFactory = portletPreferencesFactory;
150     }
151 
152     private static PortletPreferencesFactory _portletPreferencesFactory;
153 
154 }