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