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     * Provides the HTTP utility for the
026     * {@link com.liferay.portal.service.AddressServiceUtil} 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 AddressServiceSoap
048     * @see com.liferay.portal.security.auth.HttpPrincipal
049     * @see com.liferay.portal.service.AddressServiceUtil
050     * @generated
051     */
052    public class AddressServiceHttp {
053            public static com.liferay.portal.model.Address addAddress(
054                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK,
055                    java.lang.String street1, java.lang.String street2,
056                    java.lang.String street3, java.lang.String city, java.lang.String zip,
057                    long regionId, long countryId, int typeId, boolean mailing,
058                    boolean primary)
059                    throws com.liferay.portal.kernel.exception.PortalException,
060                            com.liferay.portal.kernel.exception.SystemException {
061                    try {
062                            MethodKey methodKey = new MethodKey(AddressServiceUtil.class,
063                                            "addAddress", _addAddressParameterTypes0);
064    
065                            MethodHandler methodHandler = new MethodHandler(methodKey,
066                                            className, classPK, street1, street2, street3, city, zip,
067                                            regionId, countryId, typeId, mailing, primary);
068    
069                            Object returnObj = null;
070    
071                            try {
072                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
073                            }
074                            catch (Exception e) {
075                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
076                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
077                                    }
078    
079                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
080                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
081                                    }
082    
083                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
084                            }
085    
086                            return (com.liferay.portal.model.Address)returnObj;
087                    }
088                    catch (com.liferay.portal.kernel.exception.SystemException se) {
089                            _log.error(se, se);
090    
091                            throw se;
092                    }
093            }
094    
095            public static com.liferay.portal.model.Address addAddress(
096                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK,
097                    java.lang.String street1, java.lang.String street2,
098                    java.lang.String street3, java.lang.String city, java.lang.String zip,
099                    long regionId, long countryId, int typeId, boolean mailing,
100                    boolean primary,
101                    com.liferay.portal.service.ServiceContext serviceContext)
102                    throws com.liferay.portal.kernel.exception.PortalException,
103                            com.liferay.portal.kernel.exception.SystemException {
104                    try {
105                            MethodKey methodKey = new MethodKey(AddressServiceUtil.class,
106                                            "addAddress", _addAddressParameterTypes1);
107    
108                            MethodHandler methodHandler = new MethodHandler(methodKey,
109                                            className, classPK, street1, street2, street3, city, zip,
110                                            regionId, countryId, typeId, mailing, primary,
111                                            serviceContext);
112    
113                            Object returnObj = null;
114    
115                            try {
116                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
117                            }
118                            catch (Exception e) {
119                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
120                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
121                                    }
122    
123                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
124                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
125                                    }
126    
127                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
128                            }
129    
130                            return (com.liferay.portal.model.Address)returnObj;
131                    }
132                    catch (com.liferay.portal.kernel.exception.SystemException se) {
133                            _log.error(se, se);
134    
135                            throw se;
136                    }
137            }
138    
139            public static void deleteAddress(HttpPrincipal httpPrincipal, long addressId)
140                    throws com.liferay.portal.kernel.exception.PortalException,
141                            com.liferay.portal.kernel.exception.SystemException {
142                    try {
143                            MethodKey methodKey = new MethodKey(AddressServiceUtil.class,
144                                            "deleteAddress", _deleteAddressParameterTypes2);
145    
146                            MethodHandler methodHandler = new MethodHandler(methodKey, addressId);
147    
148                            try {
149                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
150                            }
151                            catch (Exception e) {
152                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
153                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
154                                    }
155    
156                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
157                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
158                                    }
159    
160                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
161                            }
162                    }
163                    catch (com.liferay.portal.kernel.exception.SystemException se) {
164                            _log.error(se, se);
165    
166                            throw se;
167                    }
168            }
169    
170            public static com.liferay.portal.model.Address getAddress(
171                    HttpPrincipal httpPrincipal, long addressId)
172                    throws com.liferay.portal.kernel.exception.PortalException,
173                            com.liferay.portal.kernel.exception.SystemException {
174                    try {
175                            MethodKey methodKey = new MethodKey(AddressServiceUtil.class,
176                                            "getAddress", _getAddressParameterTypes3);
177    
178                            MethodHandler methodHandler = new MethodHandler(methodKey, addressId);
179    
180                            Object returnObj = null;
181    
182                            try {
183                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
184                            }
185                            catch (Exception e) {
186                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
187                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
188                                    }
189    
190                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
191                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
192                                    }
193    
194                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
195                            }
196    
197                            return (com.liferay.portal.model.Address)returnObj;
198                    }
199                    catch (com.liferay.portal.kernel.exception.SystemException se) {
200                            _log.error(se, se);
201    
202                            throw se;
203                    }
204            }
205    
206            public static java.util.List<com.liferay.portal.model.Address> getAddresses(
207                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK)
208                    throws com.liferay.portal.kernel.exception.PortalException,
209                            com.liferay.portal.kernel.exception.SystemException {
210                    try {
211                            MethodKey methodKey = new MethodKey(AddressServiceUtil.class,
212                                            "getAddresses", _getAddressesParameterTypes4);
213    
214                            MethodHandler methodHandler = new MethodHandler(methodKey,
215                                            className, classPK);
216    
217                            Object returnObj = null;
218    
219                            try {
220                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
221                            }
222                            catch (Exception e) {
223                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
224                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
225                                    }
226    
227                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
228                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
229                                    }
230    
231                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
232                            }
233    
234                            return (java.util.List<com.liferay.portal.model.Address>)returnObj;
235                    }
236                    catch (com.liferay.portal.kernel.exception.SystemException se) {
237                            _log.error(se, se);
238    
239                            throw se;
240                    }
241            }
242    
243            public static com.liferay.portal.model.Address updateAddress(
244                    HttpPrincipal httpPrincipal, long addressId, java.lang.String street1,
245                    java.lang.String street2, java.lang.String street3,
246                    java.lang.String city, java.lang.String zip, long regionId,
247                    long countryId, int typeId, boolean mailing, boolean primary)
248                    throws com.liferay.portal.kernel.exception.PortalException,
249                            com.liferay.portal.kernel.exception.SystemException {
250                    try {
251                            MethodKey methodKey = new MethodKey(AddressServiceUtil.class,
252                                            "updateAddress", _updateAddressParameterTypes5);
253    
254                            MethodHandler methodHandler = new MethodHandler(methodKey,
255                                            addressId, street1, street2, street3, city, zip, regionId,
256                                            countryId, typeId, mailing, primary);
257    
258                            Object returnObj = null;
259    
260                            try {
261                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
262                            }
263                            catch (Exception e) {
264                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
265                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
266                                    }
267    
268                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
269                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
270                                    }
271    
272                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
273                            }
274    
275                            return (com.liferay.portal.model.Address)returnObj;
276                    }
277                    catch (com.liferay.portal.kernel.exception.SystemException se) {
278                            _log.error(se, se);
279    
280                            throw se;
281                    }
282            }
283    
284            private static Log _log = LogFactoryUtil.getLog(AddressServiceHttp.class);
285            private static final Class<?>[] _addAddressParameterTypes0 = new Class[] {
286                            java.lang.String.class, long.class, java.lang.String.class,
287                            java.lang.String.class, java.lang.String.class,
288                            java.lang.String.class, java.lang.String.class, long.class,
289                            long.class, int.class, boolean.class, boolean.class
290                    };
291            private static final Class<?>[] _addAddressParameterTypes1 = new Class[] {
292                            java.lang.String.class, long.class, java.lang.String.class,
293                            java.lang.String.class, java.lang.String.class,
294                            java.lang.String.class, java.lang.String.class, long.class,
295                            long.class, int.class, boolean.class, boolean.class,
296                            com.liferay.portal.service.ServiceContext.class
297                    };
298            private static final Class<?>[] _deleteAddressParameterTypes2 = new Class[] {
299                            long.class
300                    };
301            private static final Class<?>[] _getAddressParameterTypes3 = new Class[] {
302                            long.class
303                    };
304            private static final Class<?>[] _getAddressesParameterTypes4 = new Class[] {
305                            java.lang.String.class, long.class
306                    };
307            private static final Class<?>[] _updateAddressParameterTypes5 = new Class[] {
308                            long.class, java.lang.String.class, java.lang.String.class,
309                            java.lang.String.class, java.lang.String.class,
310                            java.lang.String.class, long.class, long.class, int.class,
311                            boolean.class, boolean.class
312                    };
313    }