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 com.liferay.portal.service.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 com.liferay.portal.security.auth.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 com.liferay.portal.security.auth.HttpPrincipal
051     * @see com.liferay.portal.service.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, int 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, int 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 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.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.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.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.model.EmailAddress updateEmailAddress(
216                    HttpPrincipal httpPrincipal, long emailAddressId,
217                    java.lang.String address, int 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.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                            int.class, boolean.class
252                    };
253            private static final Class<?>[] _addEmailAddressParameterTypes1 = new Class[] {
254                            java.lang.String.class, long.class, java.lang.String.class,
255                            int.class, boolean.class,
256                            com.liferay.portal.service.ServiceContext.class
257                    };
258            private static final Class<?>[] _deleteEmailAddressParameterTypes2 = new Class[] {
259                            long.class
260                    };
261            private static final Class<?>[] _getEmailAddressParameterTypes3 = new Class[] {
262                            long.class
263                    };
264            private static final Class<?>[] _getEmailAddressesParameterTypes4 = new Class[] {
265                            java.lang.String.class, long.class
266                    };
267            private static final Class<?>[] _updateEmailAddressParameterTypes5 = new Class[] {
268                            long.class, java.lang.String.class, int.class, boolean.class
269                    };
270    }