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.util.MethodHandler;
022    import com.liferay.portal.kernel.util.MethodKey;
023    import com.liferay.portal.security.auth.HttpPrincipal;
024    import com.liferay.portal.service.PortletPreferencesServiceUtil;
025    
026    /**
027     * Provides the HTTP utility for the
028     * {@link PortletPreferencesServiceUtil} service utility. The
029     * static methods of this class calls the same methods of the service utility.
030     * However, the signatures are different because it requires an additional
031     * {@link HttpPrincipal} parameter.
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 HttpPrincipal
051     * @see PortletPreferencesServiceUtil
052     * @generated
053     */
054    @ProviderType
055    public class PortletPreferencesServiceHttp {
056            public static void deleteArchivedPreferences(HttpPrincipal httpPrincipal,
057                    long portletItemId)
058                    throws com.liferay.portal.kernel.exception.PortalException {
059                    try {
060                            MethodKey methodKey = new MethodKey(PortletPreferencesServiceUtil.class,
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                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
076                            }
077                    }
078                    catch (com.liferay.portal.kernel.exception.SystemException se) {
079                            _log.error(se, se);
080    
081                            throw se;
082                    }
083            }
084    
085            public static void restoreArchivedPreferences(HttpPrincipal httpPrincipal,
086                    long groupId, com.liferay.portal.model.Layout layout,
087                    java.lang.String portletId, long portletItemId,
088                    javax.portlet.PortletPreferences preferences)
089                    throws com.liferay.portal.kernel.exception.PortalException {
090                    try {
091                            MethodKey methodKey = new MethodKey(PortletPreferencesServiceUtil.class,
092                                            "restoreArchivedPreferences",
093                                            _restoreArchivedPreferencesParameterTypes1);
094    
095                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
096                                            layout, portletId, portletItemId, preferences);
097    
098                            try {
099                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
100                            }
101                            catch (Exception e) {
102                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
103                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
104                                    }
105    
106                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
107                            }
108                    }
109                    catch (com.liferay.portal.kernel.exception.SystemException se) {
110                            _log.error(se, se);
111    
112                            throw se;
113                    }
114            }
115    
116            public static void restoreArchivedPreferences(HttpPrincipal httpPrincipal,
117                    long groupId, com.liferay.portal.model.Layout layout,
118                    java.lang.String portletId,
119                    com.liferay.portal.model.PortletItem portletItem,
120                    javax.portlet.PortletPreferences preferences)
121                    throws com.liferay.portal.kernel.exception.PortalException {
122                    try {
123                            MethodKey methodKey = new MethodKey(PortletPreferencesServiceUtil.class,
124                                            "restoreArchivedPreferences",
125                                            _restoreArchivedPreferencesParameterTypes2);
126    
127                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
128                                            layout, portletId, portletItem, preferences);
129    
130                            try {
131                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
132                            }
133                            catch (Exception e) {
134                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
135                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
136                                    }
137    
138                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
139                            }
140                    }
141                    catch (com.liferay.portal.kernel.exception.SystemException se) {
142                            _log.error(se, se);
143    
144                            throw se;
145                    }
146            }
147    
148            public static void restoreArchivedPreferences(HttpPrincipal httpPrincipal,
149                    long groupId, java.lang.String name,
150                    com.liferay.portal.model.Layout layout, java.lang.String portletId,
151                    javax.portlet.PortletPreferences preferences)
152                    throws com.liferay.portal.kernel.exception.PortalException {
153                    try {
154                            MethodKey methodKey = new MethodKey(PortletPreferencesServiceUtil.class,
155                                            "restoreArchivedPreferences",
156                                            _restoreArchivedPreferencesParameterTypes3);
157    
158                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
159                                            name, layout, portletId, preferences);
160    
161                            try {
162                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
163                            }
164                            catch (Exception e) {
165                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
166                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
167                                    }
168    
169                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
170                            }
171                    }
172                    catch (com.liferay.portal.kernel.exception.SystemException se) {
173                            _log.error(se, se);
174    
175                            throw se;
176                    }
177            }
178    
179            public static void updateArchivePreferences(HttpPrincipal httpPrincipal,
180                    long userId, long groupId, java.lang.String name,
181                    java.lang.String portletId, javax.portlet.PortletPreferences preferences)
182                    throws com.liferay.portal.kernel.exception.PortalException {
183                    try {
184                            MethodKey methodKey = new MethodKey(PortletPreferencesServiceUtil.class,
185                                            "updateArchivePreferences",
186                                            _updateArchivePreferencesParameterTypes4);
187    
188                            MethodHandler methodHandler = new MethodHandler(methodKey, userId,
189                                            groupId, name, portletId, preferences);
190    
191                            try {
192                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
193                            }
194                            catch (Exception e) {
195                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
196                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
197                                    }
198    
199                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
200                            }
201                    }
202                    catch (com.liferay.portal.kernel.exception.SystemException se) {
203                            _log.error(se, se);
204    
205                            throw se;
206                    }
207            }
208    
209            private static Log _log = LogFactoryUtil.getLog(PortletPreferencesServiceHttp.class);
210            private static final Class<?>[] _deleteArchivedPreferencesParameterTypes0 = new Class[] {
211                            long.class
212                    };
213            private static final Class<?>[] _restoreArchivedPreferencesParameterTypes1 = new Class[] {
214                            long.class, com.liferay.portal.model.Layout.class,
215                            java.lang.String.class, long.class,
216                            javax.portlet.PortletPreferences.class
217                    };
218            private static final Class<?>[] _restoreArchivedPreferencesParameterTypes2 = new Class[] {
219                            long.class, com.liferay.portal.model.Layout.class,
220                            java.lang.String.class, com.liferay.portal.model.PortletItem.class,
221                            javax.portlet.PortletPreferences.class
222                    };
223            private static final Class<?>[] _restoreArchivedPreferencesParameterTypes3 = new Class[] {
224                            long.class, java.lang.String.class,
225                            com.liferay.portal.model.Layout.class, java.lang.String.class,
226                            javax.portlet.PortletPreferences.class
227                    };
228            private static final Class<?>[] _updateArchivePreferencesParameterTypes4 = new Class[] {
229                            long.class, long.class, java.lang.String.class,
230                            java.lang.String.class, javax.portlet.PortletPreferences.class
231                    };
232    }