001    /**
002     * Copyright (c) 2000-2010 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.BooleanWrapper;
020    import com.liferay.portal.kernel.util.IntegerWrapper;
021    import com.liferay.portal.kernel.util.LongWrapper;
022    import com.liferay.portal.kernel.util.MethodWrapper;
023    import com.liferay.portal.kernel.util.NullWrapper;
024    import com.liferay.portal.security.auth.HttpPrincipal;
025    import com.liferay.portal.service.EmailAddressServiceUtil;
026    
027    /**
028     * <p>
029     * This class provides a HTTP utility for the
030     * {@link com.liferay.portal.service.EmailAddressServiceUtil} service utility. The
031     * static methods of this class calls the same methods of the service utility.
032     * However, the signatures are different because it requires an additional
033     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
034     * </p>
035     *
036     * <p>
037     * The benefits of using the HTTP utility is that it is fast and allows for
038     * tunneling without the cost of serializing to text. The drawback is that it
039     * only works with Java.
040     * </p>
041     *
042     * <p>
043     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
044     * configure security.
045     * </p>
046     *
047     * <p>
048     * The HTTP utility is only generated for remote services.
049     * </p>
050     *
051     * @author    Brian Wing Shun Chan
052     * @see       EmailAddressServiceSoap
053     * @see       com.liferay.portal.security.auth.HttpPrincipal
054     * @see       com.liferay.portal.service.EmailAddressServiceUtil
055     * @generated
056     */
057    public class EmailAddressServiceHttp {
058            public static com.liferay.portal.model.EmailAddress addEmailAddress(
059                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK,
060                    java.lang.String address, int typeId, boolean primary)
061                    throws com.liferay.portal.kernel.exception.PortalException,
062                            com.liferay.portal.kernel.exception.SystemException {
063                    try {
064                            Object paramObj0 = className;
065    
066                            if (className == null) {
067                                    paramObj0 = new NullWrapper("java.lang.String");
068                            }
069    
070                            Object paramObj1 = new LongWrapper(classPK);
071    
072                            Object paramObj2 = address;
073    
074                            if (address == null) {
075                                    paramObj2 = new NullWrapper("java.lang.String");
076                            }
077    
078                            Object paramObj3 = new IntegerWrapper(typeId);
079    
080                            Object paramObj4 = new BooleanWrapper(primary);
081    
082                            MethodWrapper methodWrapper = new MethodWrapper(EmailAddressServiceUtil.class.getName(),
083                                            "addEmailAddress",
084                                            new Object[] {
085                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
086                                            });
087    
088                            Object returnObj = null;
089    
090                            try {
091                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
092                            }
093                            catch (Exception e) {
094                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
095                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
096                                    }
097    
098                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
099                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
100                                    }
101    
102                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
103                            }
104    
105                            return (com.liferay.portal.model.EmailAddress)returnObj;
106                    }
107                    catch (com.liferay.portal.kernel.exception.SystemException se) {
108                            _log.error(se, se);
109    
110                            throw se;
111                    }
112            }
113    
114            public static void deleteEmailAddress(HttpPrincipal httpPrincipal,
115                    long emailAddressId)
116                    throws com.liferay.portal.kernel.exception.PortalException,
117                            com.liferay.portal.kernel.exception.SystemException {
118                    try {
119                            Object paramObj0 = new LongWrapper(emailAddressId);
120    
121                            MethodWrapper methodWrapper = new MethodWrapper(EmailAddressServiceUtil.class.getName(),
122                                            "deleteEmailAddress", new Object[] { paramObj0 });
123    
124                            try {
125                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
126                            }
127                            catch (Exception e) {
128                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
129                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
130                                    }
131    
132                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
133                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
134                                    }
135    
136                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
137                            }
138                    }
139                    catch (com.liferay.portal.kernel.exception.SystemException se) {
140                            _log.error(se, se);
141    
142                            throw se;
143                    }
144            }
145    
146            public static com.liferay.portal.model.EmailAddress getEmailAddress(
147                    HttpPrincipal httpPrincipal, long emailAddressId)
148                    throws com.liferay.portal.kernel.exception.PortalException,
149                            com.liferay.portal.kernel.exception.SystemException {
150                    try {
151                            Object paramObj0 = new LongWrapper(emailAddressId);
152    
153                            MethodWrapper methodWrapper = new MethodWrapper(EmailAddressServiceUtil.class.getName(),
154                                            "getEmailAddress", new Object[] { paramObj0 });
155    
156                            Object returnObj = null;
157    
158                            try {
159                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
160                            }
161                            catch (Exception e) {
162                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
163                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
164                                    }
165    
166                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
167                                            throw (com.liferay.portal.kernel.exception.SystemException)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                            com.liferay.portal.kernel.exception.SystemException {
186                    try {
187                            Object paramObj0 = className;
188    
189                            if (className == null) {
190                                    paramObj0 = new NullWrapper("java.lang.String");
191                            }
192    
193                            Object paramObj1 = new LongWrapper(classPK);
194    
195                            MethodWrapper methodWrapper = new MethodWrapper(EmailAddressServiceUtil.class.getName(),
196                                            "getEmailAddresses", new Object[] { paramObj0, paramObj1 });
197    
198                            Object returnObj = null;
199    
200                            try {
201                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
202                            }
203                            catch (Exception e) {
204                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
205                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
206                                    }
207    
208                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
209                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
210                                    }
211    
212                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
213                            }
214    
215                            return (java.util.List<com.liferay.portal.model.EmailAddress>)returnObj;
216                    }
217                    catch (com.liferay.portal.kernel.exception.SystemException se) {
218                            _log.error(se, se);
219    
220                            throw se;
221                    }
222            }
223    
224            public static com.liferay.portal.model.EmailAddress updateEmailAddress(
225                    HttpPrincipal httpPrincipal, long emailAddressId,
226                    java.lang.String address, int typeId, boolean primary)
227                    throws com.liferay.portal.kernel.exception.PortalException,
228                            com.liferay.portal.kernel.exception.SystemException {
229                    try {
230                            Object paramObj0 = new LongWrapper(emailAddressId);
231    
232                            Object paramObj1 = address;
233    
234                            if (address == null) {
235                                    paramObj1 = new NullWrapper("java.lang.String");
236                            }
237    
238                            Object paramObj2 = new IntegerWrapper(typeId);
239    
240                            Object paramObj3 = new BooleanWrapper(primary);
241    
242                            MethodWrapper methodWrapper = new MethodWrapper(EmailAddressServiceUtil.class.getName(),
243                                            "updateEmailAddress",
244                                            new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
245    
246                            Object returnObj = null;
247    
248                            try {
249                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
250                            }
251                            catch (Exception e) {
252                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
253                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
254                                    }
255    
256                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
257                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
258                                    }
259    
260                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
261                            }
262    
263                            return (com.liferay.portal.model.EmailAddress)returnObj;
264                    }
265                    catch (com.liferay.portal.kernel.exception.SystemException se) {
266                            _log.error(se, se);
267    
268                            throw se;
269                    }
270            }
271    
272            private static Log _log = LogFactoryUtil.getLog(EmailAddressServiceHttp.class);
273    }