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.EmailAddressServiceUtil;
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 EmailAddressServiceUtil} 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 EmailAddressServiceSoap
051     * @see HttpPrincipal
052     * @see EmailAddressServiceUtil
053     * @generated
054     */
055    @ProviderType
056    public class EmailAddressServiceHttp {
057            public static com.liferay.portal.kernel.model.EmailAddress addEmailAddress(
058                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK,
059                    java.lang.String address, long typeId, boolean primary,
060                    com.liferay.portal.kernel.service.ServiceContext serviceContext)
061                    throws com.liferay.portal.kernel.exception.PortalException {
062                    try {
063                            MethodKey methodKey = new MethodKey(EmailAddressServiceUtil.class,
064                                            "addEmailAddress", _addEmailAddressParameterTypes0);
065    
066                            MethodHandler methodHandler = new MethodHandler(methodKey,
067                                            className, classPK, address, typeId, primary, serviceContext);
068    
069                            Object returnObj = null;
070    
071                            try {
072                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
073                            }
074                            catch (Exception e) {
075                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
076                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
077                                    }
078    
079                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
080                            }
081    
082                            return (com.liferay.portal.kernel.model.EmailAddress)returnObj;
083                    }
084                    catch (com.liferay.portal.kernel.exception.SystemException se) {
085                            _log.error(se, se);
086    
087                            throw se;
088                    }
089            }
090    
091            public static void deleteEmailAddress(HttpPrincipal httpPrincipal,
092                    long emailAddressId)
093                    throws com.liferay.portal.kernel.exception.PortalException {
094                    try {
095                            MethodKey methodKey = new MethodKey(EmailAddressServiceUtil.class,
096                                            "deleteEmailAddress", _deleteEmailAddressParameterTypes1);
097    
098                            MethodHandler methodHandler = new MethodHandler(methodKey,
099                                            emailAddressId);
100    
101                            try {
102                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
103                            }
104                            catch (Exception e) {
105                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
106                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
107                                    }
108    
109                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
110                            }
111                    }
112                    catch (com.liferay.portal.kernel.exception.SystemException se) {
113                            _log.error(se, se);
114    
115                            throw se;
116                    }
117            }
118    
119            public static com.liferay.portal.kernel.model.EmailAddress fetchEmailAddress(
120                    HttpPrincipal httpPrincipal, long emailAddressId)
121                    throws com.liferay.portal.kernel.exception.PortalException {
122                    try {
123                            MethodKey methodKey = new MethodKey(EmailAddressServiceUtil.class,
124                                            "fetchEmailAddress", _fetchEmailAddressParameterTypes2);
125    
126                            MethodHandler methodHandler = new MethodHandler(methodKey,
127                                            emailAddressId);
128    
129                            Object returnObj = null;
130    
131                            try {
132                                    returnObj = 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                            return (com.liferay.portal.kernel.model.EmailAddress)returnObj;
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.kernel.model.EmailAddress getEmailAddress(
152                    HttpPrincipal httpPrincipal, long emailAddressId)
153                    throws com.liferay.portal.kernel.exception.PortalException {
154                    try {
155                            MethodKey methodKey = new MethodKey(EmailAddressServiceUtil.class,
156                                            "getEmailAddress", _getEmailAddressParameterTypes3);
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.kernel.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 java.util.List<com.liferay.portal.kernel.model.EmailAddress> getEmailAddresses(
184                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK)
185                    throws com.liferay.portal.kernel.exception.PortalException {
186                    try {
187                            MethodKey methodKey = new MethodKey(EmailAddressServiceUtil.class,
188                                            "getEmailAddresses", _getEmailAddressesParameterTypes4);
189    
190                            MethodHandler methodHandler = new MethodHandler(methodKey,
191                                            className, classPK);
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 (java.util.List<com.liferay.portal.kernel.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 com.liferay.portal.kernel.model.EmailAddress updateEmailAddress(
216                    HttpPrincipal httpPrincipal, long emailAddressId,
217                    java.lang.String address, long typeId, boolean primary)
218                    throws com.liferay.portal.kernel.exception.PortalException {
219                    try {
220                            MethodKey methodKey = new MethodKey(EmailAddressServiceUtil.class,
221                                            "updateEmailAddress", _updateEmailAddressParameterTypes5);
222    
223                            MethodHandler methodHandler = new MethodHandler(methodKey,
224                                            emailAddressId, address, typeId, primary);
225    
226                            Object returnObj = null;
227    
228                            try {
229                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
230                            }
231                            catch (Exception e) {
232                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
233                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
234                                    }
235    
236                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
237                            }
238    
239                            return (com.liferay.portal.kernel.model.EmailAddress)returnObj;
240                    }
241                    catch (com.liferay.portal.kernel.exception.SystemException se) {
242                            _log.error(se, se);
243    
244                            throw se;
245                    }
246            }
247    
248            private static Log _log = LogFactoryUtil.getLog(EmailAddressServiceHttp.class);
249            private static final Class<?>[] _addEmailAddressParameterTypes0 = new Class[] {
250                            java.lang.String.class, long.class, java.lang.String.class,
251                            long.class, boolean.class,
252                            com.liferay.portal.kernel.service.ServiceContext.class
253                    };
254            private static final Class<?>[] _deleteEmailAddressParameterTypes1 = new Class[] {
255                            long.class
256                    };
257            private static final Class<?>[] _fetchEmailAddressParameterTypes2 = new Class[] {
258                            long.class
259                    };
260            private static final Class<?>[] _getEmailAddressParameterTypes3 = new Class[] {
261                            long.class
262                    };
263            private static final Class<?>[] _getEmailAddressesParameterTypes4 = new Class[] {
264                            java.lang.String.class, long.class
265                    };
266            private static final Class<?>[] _updateEmailAddressParameterTypes5 = new Class[] {
267                            long.class, java.lang.String.class, long.class, boolean.class
268                    };
269    }