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.EmailAddressServiceUtil;
025    
026    /**
027     * Provides the HTTP utility for the
028     * {@link EmailAddressServiceUtil} 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 EmailAddressServiceSoap
050     * @see HttpPrincipal
051     * @see EmailAddressServiceUtil
052     * @generated
053     */
054    @ProviderType
055    public class EmailAddressServiceHttp {
056            public static com.liferay.portal.model.EmailAddress addEmailAddress(
057                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK,
058                    java.lang.String address, long typeId, boolean primary)
059                    throws com.liferay.portal.kernel.exception.PortalException {
060                    try {
061                            MethodKey methodKey = new MethodKey(EmailAddressServiceUtil.class,
062                                            "addEmailAddress", _addEmailAddressParameterTypes0);
063    
064                            MethodHandler methodHandler = new MethodHandler(methodKey,
065                                            className, classPK, address, typeId, primary);
066    
067                            Object returnObj = null;
068    
069                            try {
070                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
071                            }
072                            catch (Exception e) {
073                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
074                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
075                                    }
076    
077                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
078                            }
079    
080                            return (com.liferay.portal.model.EmailAddress)returnObj;
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 com.liferay.portal.model.EmailAddress addEmailAddress(
090                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK,
091                    java.lang.String address, long typeId, boolean primary,
092                    com.liferay.portal.service.ServiceContext serviceContext)
093                    throws com.liferay.portal.kernel.exception.PortalException {
094                    try {
095                            MethodKey methodKey = new MethodKey(EmailAddressServiceUtil.class,
096                                            "addEmailAddress", _addEmailAddressParameterTypes1);
097    
098                            MethodHandler methodHandler = new MethodHandler(methodKey,
099                                            className, classPK, address, typeId, primary, serviceContext);
100    
101                            Object returnObj = null;
102    
103                            try {
104                                    returnObj = 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                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
112                            }
113    
114                            return (com.liferay.portal.model.EmailAddress)returnObj;
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 deleteEmailAddress(HttpPrincipal httpPrincipal,
124                    long emailAddressId)
125                    throws com.liferay.portal.kernel.exception.PortalException {
126                    try {
127                            MethodKey methodKey = new MethodKey(EmailAddressServiceUtil.class,
128                                            "deleteEmailAddress", _deleteEmailAddressParameterTypes2);
129    
130                            MethodHandler methodHandler = new MethodHandler(methodKey,
131                                            emailAddressId);
132    
133                            try {
134                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
135                            }
136                            catch (Exception e) {
137                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
138                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
139                                    }
140    
141                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
142                            }
143                    }
144                    catch (com.liferay.portal.kernel.exception.SystemException se) {
145                            _log.error(se, se);
146    
147                            throw se;
148                    }
149            }
150    
151            public static com.liferay.portal.model.EmailAddress fetchEmailAddress(
152                    HttpPrincipal httpPrincipal, long emailAddressId)
153                    throws com.liferay.portal.kernel.exception.PortalException {
154                    try {
155                            MethodKey methodKey = new MethodKey(EmailAddressServiceUtil.class,
156                                            "fetchEmailAddress", _fetchEmailAddressParameterTypes3);
157    
158                            MethodHandler methodHandler = new MethodHandler(methodKey,
159                                            emailAddressId);
160    
161                            Object returnObj = null;
162    
163                            try {
164                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
165                            }
166                            catch (Exception e) {
167                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
168                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
169                                    }
170    
171                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
172                            }
173    
174                            return (com.liferay.portal.model.EmailAddress)returnObj;
175                    }
176                    catch (com.liferay.portal.kernel.exception.SystemException se) {
177                            _log.error(se, se);
178    
179                            throw se;
180                    }
181            }
182    
183            public static com.liferay.portal.model.EmailAddress getEmailAddress(
184                    HttpPrincipal httpPrincipal, long emailAddressId)
185                    throws com.liferay.portal.kernel.exception.PortalException {
186                    try {
187                            MethodKey methodKey = new MethodKey(EmailAddressServiceUtil.class,
188                                            "getEmailAddress", _getEmailAddressParameterTypes4);
189    
190                            MethodHandler methodHandler = new MethodHandler(methodKey,
191                                            emailAddressId);
192    
193                            Object returnObj = null;
194    
195                            try {
196                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
197                            }
198                            catch (Exception e) {
199                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
200                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
201                                    }
202    
203                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
204                            }
205    
206                            return (com.liferay.portal.model.EmailAddress)returnObj;
207                    }
208                    catch (com.liferay.portal.kernel.exception.SystemException se) {
209                            _log.error(se, se);
210    
211                            throw se;
212                    }
213            }
214    
215            public static java.util.List<com.liferay.portal.model.EmailAddress> getEmailAddresses(
216                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK)
217                    throws com.liferay.portal.kernel.exception.PortalException {
218                    try {
219                            MethodKey methodKey = new MethodKey(EmailAddressServiceUtil.class,
220                                            "getEmailAddresses", _getEmailAddressesParameterTypes5);
221    
222                            MethodHandler methodHandler = new MethodHandler(methodKey,
223                                            className, classPK);
224    
225                            Object returnObj = null;
226    
227                            try {
228                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
229                            }
230                            catch (Exception e) {
231                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
232                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
233                                    }
234    
235                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
236                            }
237    
238                            return (java.util.List<com.liferay.portal.model.EmailAddress>)returnObj;
239                    }
240                    catch (com.liferay.portal.kernel.exception.SystemException se) {
241                            _log.error(se, se);
242    
243                            throw se;
244                    }
245            }
246    
247            public static com.liferay.portal.model.EmailAddress updateEmailAddress(
248                    HttpPrincipal httpPrincipal, long emailAddressId,
249                    java.lang.String address, long typeId, boolean primary)
250                    throws com.liferay.portal.kernel.exception.PortalException {
251                    try {
252                            MethodKey methodKey = new MethodKey(EmailAddressServiceUtil.class,
253                                            "updateEmailAddress", _updateEmailAddressParameterTypes6);
254    
255                            MethodHandler methodHandler = new MethodHandler(methodKey,
256                                            emailAddressId, address, typeId, primary);
257    
258                            Object returnObj = null;
259    
260                            try {
261                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
262                            }
263                            catch (Exception e) {
264                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
265                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
266                                    }
267    
268                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
269                            }
270    
271                            return (com.liferay.portal.model.EmailAddress)returnObj;
272                    }
273                    catch (com.liferay.portal.kernel.exception.SystemException se) {
274                            _log.error(se, se);
275    
276                            throw se;
277                    }
278            }
279    
280            private static Log _log = LogFactoryUtil.getLog(EmailAddressServiceHttp.class);
281            private static final Class<?>[] _addEmailAddressParameterTypes0 = new Class[] {
282                            java.lang.String.class, long.class, java.lang.String.class,
283                            long.class, boolean.class
284                    };
285            private static final Class<?>[] _addEmailAddressParameterTypes1 = new Class[] {
286                            java.lang.String.class, long.class, java.lang.String.class,
287                            long.class, boolean.class,
288                            com.liferay.portal.service.ServiceContext.class
289                    };
290            private static final Class<?>[] _deleteEmailAddressParameterTypes2 = new Class[] {
291                            long.class
292                    };
293            private static final Class<?>[] _fetchEmailAddressParameterTypes3 = new Class[] {
294                            long.class
295                    };
296            private static final Class<?>[] _getEmailAddressParameterTypes4 = new Class[] {
297                            long.class
298                    };
299            private static final Class<?>[] _getEmailAddressesParameterTypes5 = new Class[] {
300                            java.lang.String.class, long.class
301                    };
302            private static final Class<?>[] _updateEmailAddressParameterTypes6 = new Class[] {
303                            long.class, java.lang.String.class, long.class, boolean.class
304                    };
305    }