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.MethodHandler;
020    import com.liferay.portal.kernel.util.MethodKey;
021    import com.liferay.portal.security.auth.HttpPrincipal;
022    import com.liferay.portal.service.AddressServiceUtil;
023    
024    /**
025     * <p>
026     * This class provides a HTTP utility for the
027     * {@link com.liferay.portal.service.AddressServiceUtil} service utility. The
028     * static methods of this class calls the same methods of the service utility.
029     * However, the signatures are different because it requires an additional
030     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
031     * </p>
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       AddressServiceSoap
050     * @see       com.liferay.portal.security.auth.HttpPrincipal
051     * @see       com.liferay.portal.service.AddressServiceUtil
052     * @generated
053     */
054    public class AddressServiceHttp {
055            public static com.liferay.portal.model.Address addAddress(
056                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK,
057                    java.lang.String street1, java.lang.String street2,
058                    java.lang.String street3, java.lang.String city, java.lang.String zip,
059                    long regionId, long countryId, int typeId, boolean mailing,
060                    boolean primary)
061                    throws com.liferay.portal.kernel.exception.PortalException,
062                            com.liferay.portal.kernel.exception.SystemException {
063                    try {
064                            MethodKey methodKey = new MethodKey(AddressServiceUtil.class.getName(),
065                                            "addAddress", java.lang.String.class, long.class,
066                                            java.lang.String.class, java.lang.String.class,
067                                            java.lang.String.class, java.lang.String.class,
068                                            java.lang.String.class, long.class, long.class, int.class,
069                                            boolean.class, boolean.class);
070    
071                            MethodHandler methodHandler = new MethodHandler(methodKey,
072                                            className, classPK, street1, street2, street3, city, zip,
073                                            regionId, countryId, typeId, mailing, primary);
074    
075                            Object returnObj = null;
076    
077                            try {
078                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
079                            }
080                            catch (Exception e) {
081                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
082                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
083                                    }
084    
085                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
086                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
087                                    }
088    
089                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
090                            }
091    
092                            return (com.liferay.portal.model.Address)returnObj;
093                    }
094                    catch (com.liferay.portal.kernel.exception.SystemException se) {
095                            _log.error(se, se);
096    
097                            throw se;
098                    }
099            }
100    
101            public static void deleteAddress(HttpPrincipal httpPrincipal, long addressId)
102                    throws com.liferay.portal.kernel.exception.PortalException,
103                            com.liferay.portal.kernel.exception.SystemException {
104                    try {
105                            MethodKey methodKey = new MethodKey(AddressServiceUtil.class.getName(),
106                                            "deleteAddress", long.class);
107    
108                            MethodHandler methodHandler = new MethodHandler(methodKey, addressId);
109    
110                            try {
111                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
112                            }
113                            catch (Exception e) {
114                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
115                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
116                                    }
117    
118                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
119                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
120                                    }
121    
122                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
123                            }
124                    }
125                    catch (com.liferay.portal.kernel.exception.SystemException se) {
126                            _log.error(se, se);
127    
128                            throw se;
129                    }
130            }
131    
132            public static com.liferay.portal.model.Address getAddress(
133                    HttpPrincipal httpPrincipal, long addressId)
134                    throws com.liferay.portal.kernel.exception.PortalException,
135                            com.liferay.portal.kernel.exception.SystemException {
136                    try {
137                            MethodKey methodKey = new MethodKey(AddressServiceUtil.class.getName(),
138                                            "getAddress", long.class);
139    
140                            MethodHandler methodHandler = new MethodHandler(methodKey, addressId);
141    
142                            Object returnObj = null;
143    
144                            try {
145                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
146                            }
147                            catch (Exception e) {
148                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
149                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
150                                    }
151    
152                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
153                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
154                                    }
155    
156                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
157                            }
158    
159                            return (com.liferay.portal.model.Address)returnObj;
160                    }
161                    catch (com.liferay.portal.kernel.exception.SystemException se) {
162                            _log.error(se, se);
163    
164                            throw se;
165                    }
166            }
167    
168            public static java.util.List<com.liferay.portal.model.Address> getAddresses(
169                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK)
170                    throws com.liferay.portal.kernel.exception.PortalException,
171                            com.liferay.portal.kernel.exception.SystemException {
172                    try {
173                            MethodKey methodKey = new MethodKey(AddressServiceUtil.class.getName(),
174                                            "getAddresses", java.lang.String.class, long.class);
175    
176                            MethodHandler methodHandler = new MethodHandler(methodKey,
177                                            className, classPK);
178    
179                            Object returnObj = null;
180    
181                            try {
182                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
183                            }
184                            catch (Exception e) {
185                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
186                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
187                                    }
188    
189                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
190                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
191                                    }
192    
193                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
194                            }
195    
196                            return (java.util.List<com.liferay.portal.model.Address>)returnObj;
197                    }
198                    catch (com.liferay.portal.kernel.exception.SystemException se) {
199                            _log.error(se, se);
200    
201                            throw se;
202                    }
203            }
204    
205            public static com.liferay.portal.model.Address updateAddress(
206                    HttpPrincipal httpPrincipal, long addressId, java.lang.String street1,
207                    java.lang.String street2, java.lang.String street3,
208                    java.lang.String city, java.lang.String zip, long regionId,
209                    long countryId, int typeId, boolean mailing, boolean primary)
210                    throws com.liferay.portal.kernel.exception.PortalException,
211                            com.liferay.portal.kernel.exception.SystemException {
212                    try {
213                            MethodKey methodKey = new MethodKey(AddressServiceUtil.class.getName(),
214                                            "updateAddress", long.class, java.lang.String.class,
215                                            java.lang.String.class, java.lang.String.class,
216                                            java.lang.String.class, java.lang.String.class, long.class,
217                                            long.class, int.class, boolean.class, boolean.class);
218    
219                            MethodHandler methodHandler = new MethodHandler(methodKey,
220                                            addressId, street1, street2, street3, city, zip, regionId,
221                                            countryId, typeId, mailing, primary);
222    
223                            Object returnObj = null;
224    
225                            try {
226                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
227                            }
228                            catch (Exception e) {
229                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
230                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
231                                    }
232    
233                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
234                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
235                                    }
236    
237                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
238                            }
239    
240                            return (com.liferay.portal.model.Address)returnObj;
241                    }
242                    catch (com.liferay.portal.kernel.exception.SystemException se) {
243                            _log.error(se, se);
244    
245                            throw se;
246                    }
247            }
248    
249            private static Log _log = LogFactoryUtil.getLog(AddressServiceHttp.class);
250    }