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                    com.liferay.portal.service.ServiceContext serviceContext)
060                    throws com.liferay.portal.kernel.exception.PortalException {
061                    try {
062                            MethodKey methodKey = new MethodKey(EmailAddressServiceUtil.class,
063                                            "addEmailAddress", _addEmailAddressParameterTypes0);
064    
065                            MethodHandler methodHandler = new MethodHandler(methodKey,
066                                            className, classPK, address, typeId, primary, serviceContext);
067    
068                            Object returnObj = null;
069    
070                            try {
071                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
072                            }
073                            catch (Exception e) {
074                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
075                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
076                                    }
077    
078                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
079                            }
080    
081                            return (com.liferay.portal.model.EmailAddress)returnObj;
082                    }
083                    catch (com.liferay.portal.kernel.exception.SystemException se) {
084                            _log.error(se, se);
085    
086                            throw se;
087                    }
088            }
089    
090            public static void deleteEmailAddress(HttpPrincipal httpPrincipal,
091                    long emailAddressId)
092                    throws com.liferay.portal.kernel.exception.PortalException {
093                    try {
094                            MethodKey methodKey = new MethodKey(EmailAddressServiceUtil.class,
095                                            "deleteEmailAddress", _deleteEmailAddressParameterTypes1);
096    
097                            MethodHandler methodHandler = new MethodHandler(methodKey,
098                                            emailAddressId);
099    
100                            try {
101                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
102                            }
103                            catch (Exception e) {
104                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
105                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
106                                    }
107    
108                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
109                            }
110                    }
111                    catch (com.liferay.portal.kernel.exception.SystemException se) {
112                            _log.error(se, se);
113    
114                            throw se;
115                    }
116            }
117    
118            public static com.liferay.portal.model.EmailAddress fetchEmailAddress(
119                    HttpPrincipal httpPrincipal, long emailAddressId)
120                    throws com.liferay.portal.kernel.exception.PortalException {
121                    try {
122                            MethodKey methodKey = new MethodKey(EmailAddressServiceUtil.class,
123                                            "fetchEmailAddress", _fetchEmailAddressParameterTypes2);
124    
125                            MethodHandler methodHandler = new MethodHandler(methodKey,
126                                            emailAddressId);
127    
128                            Object returnObj = null;
129    
130                            try {
131                                    returnObj = 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                            return (com.liferay.portal.model.EmailAddress)returnObj;
142                    }
143                    catch (com.liferay.portal.kernel.exception.SystemException se) {
144                            _log.error(se, se);
145    
146                            throw se;
147                    }
148            }
149    
150            public static com.liferay.portal.model.EmailAddress getEmailAddress(
151                    HttpPrincipal httpPrincipal, long emailAddressId)
152                    throws com.liferay.portal.kernel.exception.PortalException {
153                    try {
154                            MethodKey methodKey = new MethodKey(EmailAddressServiceUtil.class,
155                                            "getEmailAddress", _getEmailAddressParameterTypes3);
156    
157                            MethodHandler methodHandler = new MethodHandler(methodKey,
158                                            emailAddressId);
159    
160                            Object returnObj = null;
161    
162                            try {
163                                    returnObj = 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                            return (com.liferay.portal.model.EmailAddress)returnObj;
174                    }
175                    catch (com.liferay.portal.kernel.exception.SystemException se) {
176                            _log.error(se, se);
177    
178                            throw se;
179                    }
180            }
181    
182            public static java.util.List<com.liferay.portal.model.EmailAddress> getEmailAddresses(
183                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK)
184                    throws com.liferay.portal.kernel.exception.PortalException {
185                    try {
186                            MethodKey methodKey = new MethodKey(EmailAddressServiceUtil.class,
187                                            "getEmailAddresses", _getEmailAddressesParameterTypes4);
188    
189                            MethodHandler methodHandler = new MethodHandler(methodKey,
190                                            className, classPK);
191    
192                            Object returnObj = null;
193    
194                            try {
195                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
196                            }
197                            catch (Exception e) {
198                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
199                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
200                                    }
201    
202                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
203                            }
204    
205                            return (java.util.List<com.liferay.portal.model.EmailAddress>)returnObj;
206                    }
207                    catch (com.liferay.portal.kernel.exception.SystemException se) {
208                            _log.error(se, se);
209    
210                            throw se;
211                    }
212            }
213    
214            public static com.liferay.portal.model.EmailAddress updateEmailAddress(
215                    HttpPrincipal httpPrincipal, long emailAddressId,
216                    java.lang.String address, long typeId, boolean primary)
217                    throws com.liferay.portal.kernel.exception.PortalException {
218                    try {
219                            MethodKey methodKey = new MethodKey(EmailAddressServiceUtil.class,
220                                            "updateEmailAddress", _updateEmailAddressParameterTypes5);
221    
222                            MethodHandler methodHandler = new MethodHandler(methodKey,
223                                            emailAddressId, address, typeId, primary);
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 (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            private static Log _log = LogFactoryUtil.getLog(EmailAddressServiceHttp.class);
248            private static final Class<?>[] _addEmailAddressParameterTypes0 = new Class[] {
249                            java.lang.String.class, long.class, java.lang.String.class,
250                            long.class, boolean.class,
251                            com.liferay.portal.service.ServiceContext.class
252                    };
253            private static final Class<?>[] _deleteEmailAddressParameterTypes1 = new Class[] {
254                            long.class
255                    };
256            private static final Class<?>[] _fetchEmailAddressParameterTypes2 = new Class[] {
257                            long.class
258                    };
259            private static final Class<?>[] _getEmailAddressParameterTypes3 = new Class[] {
260                            long.class
261                    };
262            private static final Class<?>[] _getEmailAddressesParameterTypes4 = new Class[] {
263                            java.lang.String.class, long.class
264                    };
265            private static final Class<?>[] _updateEmailAddressParameterTypes5 = new Class[] {
266                            long.class, java.lang.String.class, long.class, boolean.class
267                    };
268    }