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