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