001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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, java.lang.String name, java.lang.String portletId,
091                    javax.portlet.PortletPreferences preferences)
092                    throws com.liferay.portal.kernel.exception.PortalException,
093                            com.liferay.portal.kernel.exception.SystemException {
094                    try {
095                            MethodKey methodKey = new MethodKey(PortletPreferencesServiceUtil.class.getName(),
096                                            "restoreArchivedPreferences",
097                                            _restoreArchivedPreferencesParameterTypes1);
098    
099                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
100                                            name, portletId, preferences);
101    
102                            try {
103                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
104                            }
105                            catch (Exception e) {
106                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
107                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
108                                    }
109    
110                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
111                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
112                                    }
113    
114                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
115                            }
116                    }
117                    catch (com.liferay.portal.kernel.exception.SystemException se) {
118                            _log.error(se, se);
119    
120                            throw se;
121                    }
122            }
123    
124            public static void updateArchivePreferences(HttpPrincipal httpPrincipal,
125                    long userId, long groupId, java.lang.String name,
126                    java.lang.String portletId, javax.portlet.PortletPreferences preferences)
127                    throws com.liferay.portal.kernel.exception.PortalException,
128                            com.liferay.portal.kernel.exception.SystemException {
129                    try {
130                            MethodKey methodKey = new MethodKey(PortletPreferencesServiceUtil.class.getName(),
131                                            "updateArchivePreferences",
132                                            _updateArchivePreferencesParameterTypes2);
133    
134                            MethodHandler methodHandler = new MethodHandler(methodKey, userId,
135                                            groupId, name, portletId, preferences);
136    
137                            try {
138                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
139                            }
140                            catch (Exception e) {
141                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
142                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
143                                    }
144    
145                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
146                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
147                                    }
148    
149                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
150                            }
151                    }
152                    catch (com.liferay.portal.kernel.exception.SystemException se) {
153                            _log.error(se, se);
154    
155                            throw se;
156                    }
157            }
158    
159            private static Log _log = LogFactoryUtil.getLog(PortletPreferencesServiceHttp.class);
160            private static final Class<?>[] _deleteArchivedPreferencesParameterTypes0 = new Class[] {
161                            long.class
162                    };
163            private static final Class<?>[] _restoreArchivedPreferencesParameterTypes1 = new Class[] {
164                            long.class, java.lang.String.class, java.lang.String.class,
165                            javax.portlet.PortletPreferences.class
166                    };
167            private static final Class<?>[] _updateArchivePreferencesParameterTypes2 = new Class[] {
168                            long.class, long.class, java.lang.String.class,
169                            java.lang.String.class, javax.portlet.PortletPreferences.class
170                    };
171    }