001    /**
002     * Copyright (c) 2000-2013 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 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.EmailAddressServiceUtil;
023    
024    /**
025     * Provides the HTTP utility for the
026     * {@link com.liferay.portal.service.EmailAddressServiceUtil} service utility. The
027     * static methods of this class calls the same methods of the service utility.
028     * However, the signatures are different because it requires an additional
029     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
030     *
031     * <p>
032     * The benefits of using the HTTP utility is that it is fast and allows for
033     * tunneling without the cost of serializing to text. The drawback is that it
034     * only works with Java.
035     * </p>
036     *
037     * <p>
038     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
039     * configure security.
040     * </p>
041     *
042     * <p>
043     * The HTTP utility is only generated for remote services.
044     * </p>
045     *
046     * @author Brian Wing Shun Chan
047     * @see EmailAddressServiceSoap
048     * @see com.liferay.portal.security.auth.HttpPrincipal
049     * @see com.liferay.portal.service.EmailAddressServiceUtil
050     * @generated
051     */
052    public class EmailAddressServiceHttp {
053            public static com.liferay.portal.model.EmailAddress addEmailAddress(
054                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK,
055                    java.lang.String address, int typeId, boolean primary)
056                    throws com.liferay.portal.kernel.exception.PortalException,
057                            com.liferay.portal.kernel.exception.SystemException {
058                    try {
059                            MethodKey methodKey = new MethodKey(EmailAddressServiceUtil.class,
060                                            "addEmailAddress", _addEmailAddressParameterTypes0);
061    
062                            MethodHandler methodHandler = new MethodHandler(methodKey,
063                                            className, classPK, address, typeId, primary);
064    
065                            Object returnObj = null;
066    
067                            try {
068                                    returnObj = 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                            return (com.liferay.portal.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 com.liferay.portal.model.EmailAddress addEmailAddress(
092                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK,
093                    java.lang.String address, int typeId, boolean primary,
094                    com.liferay.portal.service.ServiceContext serviceContext)
095                    throws com.liferay.portal.kernel.exception.PortalException,
096                            com.liferay.portal.kernel.exception.SystemException {
097                    try {
098                            MethodKey methodKey = new MethodKey(EmailAddressServiceUtil.class,
099                                            "addEmailAddress", _addEmailAddressParameterTypes1);
100    
101                            MethodHandler methodHandler = new MethodHandler(methodKey,
102                                            className, classPK, address, typeId, primary, serviceContext);
103    
104                            Object returnObj = null;
105    
106                            try {
107                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
108                            }
109                            catch (Exception e) {
110                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
111                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
112                                    }
113    
114                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
115                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
116                                    }
117    
118                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
119                            }
120    
121                            return (com.liferay.portal.model.EmailAddress)returnObj;
122                    }
123                    catch (com.liferay.portal.kernel.exception.SystemException se) {
124                            _log.error(se, se);
125    
126                            throw se;
127                    }
128            }
129    
130            public static void deleteEmailAddress(HttpPrincipal httpPrincipal,
131                    long emailAddressId)
132                    throws com.liferay.portal.kernel.exception.PortalException,
133                            com.liferay.portal.kernel.exception.SystemException {
134                    try {
135                            MethodKey methodKey = new MethodKey(EmailAddressServiceUtil.class,
136                                            "deleteEmailAddress", _deleteEmailAddressParameterTypes2);
137    
138                            MethodHandler methodHandler = new MethodHandler(methodKey,
139                                            emailAddressId);
140    
141                            try {
142                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
143                            }
144                            catch (Exception e) {
145                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
146                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
147                                    }
148    
149                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
150                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
151                                    }
152    
153                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
154                            }
155                    }
156                    catch (com.liferay.portal.kernel.exception.SystemException se) {
157                            _log.error(se, se);
158    
159                            throw se;
160                    }
161            }
162    
163            public static com.liferay.portal.model.EmailAddress getEmailAddress(
164                    HttpPrincipal httpPrincipal, long emailAddressId)
165                    throws com.liferay.portal.kernel.exception.PortalException,
166                            com.liferay.portal.kernel.exception.SystemException {
167                    try {
168                            MethodKey methodKey = new MethodKey(EmailAddressServiceUtil.class,
169                                            "getEmailAddress", _getEmailAddressParameterTypes3);
170    
171                            MethodHandler methodHandler = new MethodHandler(methodKey,
172                                            emailAddressId);
173    
174                            Object returnObj = null;
175    
176                            try {
177                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
178                            }
179                            catch (Exception e) {
180                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
181                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
182                                    }
183    
184                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
185                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
186                                    }
187    
188                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
189                            }
190    
191                            return (com.liferay.portal.model.EmailAddress)returnObj;
192                    }
193                    catch (com.liferay.portal.kernel.exception.SystemException se) {
194                            _log.error(se, se);
195    
196                            throw se;
197                    }
198            }
199    
200            public static java.util.List<com.liferay.portal.model.EmailAddress> getEmailAddresses(
201                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK)
202                    throws com.liferay.portal.kernel.exception.PortalException,
203                            com.liferay.portal.kernel.exception.SystemException {
204                    try {
205                            MethodKey methodKey = new MethodKey(EmailAddressServiceUtil.class,
206                                            "getEmailAddresses", _getEmailAddressesParameterTypes4);
207    
208                            MethodHandler methodHandler = new MethodHandler(methodKey,
209                                            className, classPK);
210    
211                            Object returnObj = null;
212    
213                            try {
214                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
215                            }
216                            catch (Exception e) {
217                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
218                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
219                                    }
220    
221                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
222                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
223                                    }
224    
225                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
226                            }
227    
228                            return (java.util.List<com.liferay.portal.model.EmailAddress>)returnObj;
229                    }
230                    catch (com.liferay.portal.kernel.exception.SystemException se) {
231                            _log.error(se, se);
232    
233                            throw se;
234                    }
235            }
236    
237            public static com.liferay.portal.model.EmailAddress updateEmailAddress(
238                    HttpPrincipal httpPrincipal, long emailAddressId,
239                    java.lang.String address, int typeId, boolean primary)
240                    throws com.liferay.portal.kernel.exception.PortalException,
241                            com.liferay.portal.kernel.exception.SystemException {
242                    try {
243                            MethodKey methodKey = new MethodKey(EmailAddressServiceUtil.class,
244                                            "updateEmailAddress", _updateEmailAddressParameterTypes5);
245    
246                            MethodHandler methodHandler = new MethodHandler(methodKey,
247                                            emailAddressId, address, typeId, primary);
248    
249                            Object returnObj = null;
250    
251                            try {
252                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
253                            }
254                            catch (Exception e) {
255                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
256                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
257                                    }
258    
259                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
260                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
261                                    }
262    
263                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
264                            }
265    
266                            return (com.liferay.portal.model.EmailAddress)returnObj;
267                    }
268                    catch (com.liferay.portal.kernel.exception.SystemException se) {
269                            _log.error(se, se);
270    
271                            throw se;
272                    }
273            }
274    
275            private static Log _log = LogFactoryUtil.getLog(EmailAddressServiceHttp.class);
276            private static final Class<?>[] _addEmailAddressParameterTypes0 = new Class[] {
277                            java.lang.String.class, long.class, java.lang.String.class,
278                            int.class, boolean.class
279                    };
280            private static final Class<?>[] _addEmailAddressParameterTypes1 = new Class[] {
281                            java.lang.String.class, long.class, java.lang.String.class,
282                            int.class, boolean.class,
283                            com.liferay.portal.service.ServiceContext.class
284                    };
285            private static final Class<?>[] _deleteEmailAddressParameterTypes2 = new Class[] {
286                            long.class
287                    };
288            private static final Class<?>[] _getEmailAddressParameterTypes3 = new Class[] {
289                            long.class
290                    };
291            private static final Class<?>[] _getEmailAddressesParameterTypes4 = new Class[] {
292                            java.lang.String.class, long.class
293                    };
294            private static final Class<?>[] _updateEmailAddressParameterTypes5 = new Class[] {
295                            long.class, java.lang.String.class, int.class, boolean.class
296                    };
297    }