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.portal.service.http;
016    
017    import com.liferay.portal.kernel.log.Log;
018    import com.liferay.portal.kernel.log.LogFactoryUtil;
019    import com.liferay.portal.kernel.util.MethodHandler;
020    import com.liferay.portal.kernel.util.MethodKey;
021    import com.liferay.portal.security.auth.HttpPrincipal;
022    import com.liferay.portal.service.PortletPreferencesServiceUtil;
023    
024    /**
025     * Provides the HTTP utility for the
026     * {@link com.liferay.portal.service.PortletPreferencesServiceUtil} service utility. The
027     * static methods of this class calls the same methods of the service utility.
028     * However, the signatures are different because it requires an additional
029     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
030     *
031     * <p>
032     * The benefits of using the HTTP utility is that it is fast and allows for
033     * tunneling without the cost of serializing to text. The drawback is that it
034     * only works with Java.
035     * </p>
036     *
037     * <p>
038     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
039     * configure security.
040     * </p>
041     *
042     * <p>
043     * The HTTP utility is only generated for remote services.
044     * </p>
045     *
046     * @author Brian Wing Shun Chan
047     * @see PortletPreferencesServiceSoap
048     * @see com.liferay.portal.security.auth.HttpPrincipal
049     * @see com.liferay.portal.service.PortletPreferencesServiceUtil
050     * @generated
051     */
052    public class PortletPreferencesServiceHttp {
053            public static void deleteArchivedPreferences(HttpPrincipal httpPrincipal,
054                    long portletItemId)
055                    throws com.liferay.portal.kernel.exception.PortalException,
056                            com.liferay.portal.kernel.exception.SystemException {
057                    try {
058                            MethodKey methodKey = new MethodKey(PortletPreferencesServiceUtil.class,
059                                            "deleteArchivedPreferences",
060                                            _deleteArchivedPreferencesParameterTypes0);
061    
062                            MethodHandler methodHandler = new MethodHandler(methodKey,
063                                            portletItemId);
064    
065                            try {
066                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
067                            }
068                            catch (Exception e) {
069                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
070                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
071                                    }
072    
073                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
074                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
075                                    }
076    
077                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
078                            }
079                    }
080                    catch (com.liferay.portal.kernel.exception.SystemException se) {
081                            _log.error(se, se);
082    
083                            throw se;
084                    }
085            }
086    
087            public static void restoreArchivedPreferences(HttpPrincipal httpPrincipal,
088                    long groupId, com.liferay.portal.model.Layout layout,
089                    java.lang.String portletId, long portletItemId,
090                    javax.portlet.PortletPreferences preferences)
091                    throws com.liferay.portal.kernel.exception.PortalException,
092                            com.liferay.portal.kernel.exception.SystemException {
093                    try {
094                            MethodKey methodKey = new MethodKey(PortletPreferencesServiceUtil.class,
095                                            "restoreArchivedPreferences",
096                                            _restoreArchivedPreferencesParameterTypes1);
097    
098                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
099                                            layout, portletId, portletItemId, preferences);
100    
101                            try {
102                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
103                            }
104                            catch (Exception e) {
105                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
106                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
107                                    }
108    
109                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
110                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
111                                    }
112    
113                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
114                            }
115                    }
116                    catch (com.liferay.portal.kernel.exception.SystemException se) {
117                            _log.error(se, se);
118    
119                            throw se;
120                    }
121            }
122    
123            public static void restoreArchivedPreferences(HttpPrincipal httpPrincipal,
124                    long groupId, com.liferay.portal.model.Layout layout,
125                    java.lang.String portletId,
126                    com.liferay.portal.model.PortletItem portletItem,
127                    javax.portlet.PortletPreferences preferences)
128                    throws com.liferay.portal.kernel.exception.PortalException,
129                            com.liferay.portal.kernel.exception.SystemException {
130                    try {
131                            MethodKey methodKey = new MethodKey(PortletPreferencesServiceUtil.class,
132                                            "restoreArchivedPreferences",
133                                            _restoreArchivedPreferencesParameterTypes2);
134    
135                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
136                                            layout, portletId, portletItem, preferences);
137    
138                            try {
139                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
140                            }
141                            catch (Exception e) {
142                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
143                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
144                                    }
145    
146                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
147                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
148                                    }
149    
150                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
151                            }
152                    }
153                    catch (com.liferay.portal.kernel.exception.SystemException se) {
154                            _log.error(se, se);
155    
156                            throw se;
157                    }
158            }
159    
160            public static void restoreArchivedPreferences(HttpPrincipal httpPrincipal,
161                    long groupId, java.lang.String name,
162                    com.liferay.portal.model.Layout layout, java.lang.String portletId,
163                    javax.portlet.PortletPreferences preferences)
164                    throws com.liferay.portal.kernel.exception.PortalException,
165                            com.liferay.portal.kernel.exception.SystemException {
166                    try {
167                            MethodKey methodKey = new MethodKey(PortletPreferencesServiceUtil.class,
168                                            "restoreArchivedPreferences",
169                                            _restoreArchivedPreferencesParameterTypes3);
170    
171                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
172                                            name, layout, portletId, preferences);
173    
174                            try {
175                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
176                            }
177                            catch (Exception e) {
178                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
179                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
180                                    }
181    
182                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
183                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
184                                    }
185    
186                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
187                            }
188                    }
189                    catch (com.liferay.portal.kernel.exception.SystemException se) {
190                            _log.error(se, se);
191    
192                            throw se;
193                    }
194            }
195    
196            public static void updateArchivePreferences(HttpPrincipal httpPrincipal,
197                    long userId, long groupId, java.lang.String name,
198                    java.lang.String portletId, javax.portlet.PortletPreferences preferences)
199                    throws com.liferay.portal.kernel.exception.PortalException,
200                            com.liferay.portal.kernel.exception.SystemException {
201                    try {
202                            MethodKey methodKey = new MethodKey(PortletPreferencesServiceUtil.class,
203                                            "updateArchivePreferences",
204                                            _updateArchivePreferencesParameterTypes4);
205    
206                            MethodHandler methodHandler = new MethodHandler(methodKey, userId,
207                                            groupId, name, portletId, preferences);
208    
209                            try {
210                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
211                            }
212                            catch (Exception e) {
213                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
214                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
215                                    }
216    
217                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
218                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
219                                    }
220    
221                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
222                            }
223                    }
224                    catch (com.liferay.portal.kernel.exception.SystemException se) {
225                            _log.error(se, se);
226    
227                            throw se;
228                    }
229            }
230    
231            private static Log _log = LogFactoryUtil.getLog(PortletPreferencesServiceHttp.class);
232            private static final Class<?>[] _deleteArchivedPreferencesParameterTypes0 = new Class[] {
233                            long.class
234                    };
235            private static final Class<?>[] _restoreArchivedPreferencesParameterTypes1 = new Class[] {
236                            long.class, com.liferay.portal.model.Layout.class,
237                            java.lang.String.class, long.class,
238                            javax.portlet.PortletPreferences.class
239                    };
240            private static final Class<?>[] _restoreArchivedPreferencesParameterTypes2 = new Class[] {
241                            long.class, com.liferay.portal.model.Layout.class,
242                            java.lang.String.class, com.liferay.portal.model.PortletItem.class,
243                            javax.portlet.PortletPreferences.class
244                    };
245            private static final Class<?>[] _restoreArchivedPreferencesParameterTypes3 = new Class[] {
246                            long.class, java.lang.String.class,
247                            com.liferay.portal.model.Layout.class, java.lang.String.class,
248                            javax.portlet.PortletPreferences.class
249                    };
250            private static final Class<?>[] _updateArchivePreferencesParameterTypes4 = new Class[] {
251                            long.class, long.class, java.lang.String.class,
252                            java.lang.String.class, javax.portlet.PortletPreferences.class
253                    };
254    }