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.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", _addAddressParameterTypes0);
066    
067                            MethodHandler methodHandler = new MethodHandler(methodKey,
068                                            className, classPK, street1, street2, street3, city, zip,
069                                            regionId, countryId, typeId, mailing, primary);
070    
071                            Object returnObj = null;
072    
073                            try {
074                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
075                            }
076                            catch (Exception e) {
077                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
078                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
079                                    }
080    
081                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
082                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
083                                    }
084    
085                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
086                            }
087    
088                            return (com.liferay.portal.model.Address)returnObj;
089                    }
090                    catch (com.liferay.portal.kernel.exception.SystemException se) {
091                            _log.error(se, se);
092    
093                            throw se;
094                    }
095            }
096    
097            public static void deleteAddress(HttpPrincipal httpPrincipal, long addressId)
098                    throws com.liferay.portal.kernel.exception.PortalException,
099                            com.liferay.portal.kernel.exception.SystemException {
100                    try {
101                            MethodKey methodKey = new MethodKey(AddressServiceUtil.class.getName(),
102                                            "deleteAddress", _deleteAddressParameterTypes1);
103    
104                            MethodHandler methodHandler = new MethodHandler(methodKey, addressId);
105    
106                            try {
107                                    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                    catch (com.liferay.portal.kernel.exception.SystemException se) {
122                            _log.error(se, se);
123    
124                            throw se;
125                    }
126            }
127    
128            public static com.liferay.portal.model.Address getAddress(
129                    HttpPrincipal httpPrincipal, long addressId)
130                    throws com.liferay.portal.kernel.exception.PortalException,
131                            com.liferay.portal.kernel.exception.SystemException {
132                    try {
133                            MethodKey methodKey = new MethodKey(AddressServiceUtil.class.getName(),
134                                            "getAddress", _getAddressParameterTypes2);
135    
136                            MethodHandler methodHandler = new MethodHandler(methodKey, addressId);
137    
138                            Object returnObj = null;
139    
140                            try {
141                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
142                            }
143                            catch (Exception e) {
144                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
145                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
146                                    }
147    
148                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
149                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
150                                    }
151    
152                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
153                            }
154    
155                            return (com.liferay.portal.model.Address)returnObj;
156                    }
157                    catch (com.liferay.portal.kernel.exception.SystemException se) {
158                            _log.error(se, se);
159    
160                            throw se;
161                    }
162            }
163    
164            public static java.util.List<com.liferay.portal.model.Address> getAddresses(
165                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK)
166                    throws com.liferay.portal.kernel.exception.PortalException,
167                            com.liferay.portal.kernel.exception.SystemException {
168                    try {
169                            MethodKey methodKey = new MethodKey(AddressServiceUtil.class.getName(),
170                                            "getAddresses", _getAddressesParameterTypes3);
171    
172                            MethodHandler methodHandler = new MethodHandler(methodKey,
173                                            className, classPK);
174    
175                            Object returnObj = null;
176    
177                            try {
178                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
179                            }
180                            catch (Exception e) {
181                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
182                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
183                                    }
184    
185                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
186                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
187                                    }
188    
189                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
190                            }
191    
192                            return (java.util.List<com.liferay.portal.model.Address>)returnObj;
193                    }
194                    catch (com.liferay.portal.kernel.exception.SystemException se) {
195                            _log.error(se, se);
196    
197                            throw se;
198                    }
199            }
200    
201            public static com.liferay.portal.model.Address updateAddress(
202                    HttpPrincipal httpPrincipal, long addressId, java.lang.String street1,
203                    java.lang.String street2, java.lang.String street3,
204                    java.lang.String city, java.lang.String zip, long regionId,
205                    long countryId, int typeId, boolean mailing, boolean primary)
206                    throws com.liferay.portal.kernel.exception.PortalException,
207                            com.liferay.portal.kernel.exception.SystemException {
208                    try {
209                            MethodKey methodKey = new MethodKey(AddressServiceUtil.class.getName(),
210                                            "updateAddress", _updateAddressParameterTypes4);
211    
212                            MethodHandler methodHandler = new MethodHandler(methodKey,
213                                            addressId, street1, street2, street3, city, zip, regionId,
214                                            countryId, typeId, mailing, primary);
215    
216                            Object returnObj = null;
217    
218                            try {
219                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
220                            }
221                            catch (Exception e) {
222                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
223                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
224                                    }
225    
226                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
227                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
228                                    }
229    
230                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
231                            }
232    
233                            return (com.liferay.portal.model.Address)returnObj;
234                    }
235                    catch (com.liferay.portal.kernel.exception.SystemException se) {
236                            _log.error(se, se);
237    
238                            throw se;
239                    }
240            }
241    
242            private static Log _log = LogFactoryUtil.getLog(AddressServiceHttp.class);
243            private static final Class<?>[] _addAddressParameterTypes0 = new Class[] {
244                            java.lang.String.class, long.class, java.lang.String.class,
245                            java.lang.String.class, java.lang.String.class,
246                            java.lang.String.class, java.lang.String.class, long.class,
247                            long.class, int.class, boolean.class, boolean.class
248                    };
249            private static final Class<?>[] _deleteAddressParameterTypes1 = new Class[] {
250                            long.class
251                    };
252            private static final Class<?>[] _getAddressParameterTypes2 = new Class[] {
253                            long.class
254                    };
255            private static final Class<?>[] _getAddressesParameterTypes3 = new Class[] {
256                            java.lang.String.class, long.class
257                    };
258            private static final Class<?>[] _updateAddressParameterTypes4 = new Class[] {
259                            long.class, java.lang.String.class, java.lang.String.class,
260                            java.lang.String.class, java.lang.String.class,
261                            java.lang.String.class, long.class, long.class, int.class,
262                            boolean.class, boolean.class
263                    };
264    }