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 com.liferay.portal.service.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 com.liferay.portal.security.auth.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 com.liferay.portal.security.auth.HttpPrincipal
051     * @see com.liferay.portal.service.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, int typeId, boolean mailing,
061                    boolean primary)
062                    throws com.liferay.portal.kernel.exception.PortalException {
063                    try {
064                            MethodKey methodKey = new MethodKey(AddressServiceUtil.class,
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                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
082                            }
083    
084                            return (com.liferay.portal.model.Address)returnObj;
085                    }
086                    catch (com.liferay.portal.kernel.exception.SystemException se) {
087                            _log.error(se, se);
088    
089                            throw se;
090                    }
091            }
092    
093            public static com.liferay.portal.model.Address addAddress(
094                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK,
095                    java.lang.String street1, java.lang.String street2,
096                    java.lang.String street3, java.lang.String city, java.lang.String zip,
097                    long regionId, long countryId, int typeId, boolean mailing,
098                    boolean primary,
099                    com.liferay.portal.service.ServiceContext serviceContext)
100                    throws com.liferay.portal.kernel.exception.PortalException {
101                    try {
102                            MethodKey methodKey = new MethodKey(AddressServiceUtil.class,
103                                            "addAddress", _addAddressParameterTypes1);
104    
105                            MethodHandler methodHandler = new MethodHandler(methodKey,
106                                            className, classPK, street1, street2, street3, city, zip,
107                                            regionId, countryId, typeId, mailing, primary,
108                                            serviceContext);
109    
110                            Object returnObj = null;
111    
112                            try {
113                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
114                            }
115                            catch (Exception e) {
116                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
117                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
118                                    }
119    
120                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
121                            }
122    
123                            return (com.liferay.portal.model.Address)returnObj;
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 void deleteAddress(HttpPrincipal httpPrincipal, long addressId)
133                    throws com.liferay.portal.kernel.exception.PortalException {
134                    try {
135                            MethodKey methodKey = new MethodKey(AddressServiceUtil.class,
136                                            "deleteAddress", _deleteAddressParameterTypes2);
137    
138                            MethodHandler methodHandler = new MethodHandler(methodKey, addressId);
139    
140                            try {
141                                    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                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
149                            }
150                    }
151                    catch (com.liferay.portal.kernel.exception.SystemException se) {
152                            _log.error(se, se);
153    
154                            throw se;
155                    }
156            }
157    
158            public static com.liferay.portal.model.Address getAddress(
159                    HttpPrincipal httpPrincipal, long addressId)
160                    throws com.liferay.portal.kernel.exception.PortalException {
161                    try {
162                            MethodKey methodKey = new MethodKey(AddressServiceUtil.class,
163                                            "getAddress", _getAddressParameterTypes3);
164    
165                            MethodHandler methodHandler = new MethodHandler(methodKey, addressId);
166    
167                            Object returnObj = null;
168    
169                            try {
170                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
171                            }
172                            catch (Exception e) {
173                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
174                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
175                                    }
176    
177                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
178                            }
179    
180                            return (com.liferay.portal.model.Address)returnObj;
181                    }
182                    catch (com.liferay.portal.kernel.exception.SystemException se) {
183                            _log.error(se, se);
184    
185                            throw se;
186                    }
187            }
188    
189            public static java.util.List<com.liferay.portal.model.Address> getAddresses(
190                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK)
191                    throws com.liferay.portal.kernel.exception.PortalException {
192                    try {
193                            MethodKey methodKey = new MethodKey(AddressServiceUtil.class,
194                                            "getAddresses", _getAddressesParameterTypes4);
195    
196                            MethodHandler methodHandler = new MethodHandler(methodKey,
197                                            className, classPK);
198    
199                            Object returnObj = null;
200    
201                            try {
202                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
203                            }
204                            catch (Exception e) {
205                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
206                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
207                                    }
208    
209                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
210                            }
211    
212                            return (java.util.List<com.liferay.portal.model.Address>)returnObj;
213                    }
214                    catch (com.liferay.portal.kernel.exception.SystemException se) {
215                            _log.error(se, se);
216    
217                            throw se;
218                    }
219            }
220    
221            public static com.liferay.portal.model.Address updateAddress(
222                    HttpPrincipal httpPrincipal, long addressId, java.lang.String street1,
223                    java.lang.String street2, java.lang.String street3,
224                    java.lang.String city, java.lang.String zip, long regionId,
225                    long countryId, int typeId, boolean mailing, boolean primary)
226                    throws com.liferay.portal.kernel.exception.PortalException {
227                    try {
228                            MethodKey methodKey = new MethodKey(AddressServiceUtil.class,
229                                            "updateAddress", _updateAddressParameterTypes5);
230    
231                            MethodHandler methodHandler = new MethodHandler(methodKey,
232                                            addressId, street1, street2, street3, city, zip, regionId,
233                                            countryId, typeId, mailing, primary);
234    
235                            Object returnObj = null;
236    
237                            try {
238                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
239                            }
240                            catch (Exception e) {
241                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
242                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
243                                    }
244    
245                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
246                            }
247    
248                            return (com.liferay.portal.model.Address)returnObj;
249                    }
250                    catch (com.liferay.portal.kernel.exception.SystemException se) {
251                            _log.error(se, se);
252    
253                            throw se;
254                    }
255            }
256    
257            private static Log _log = LogFactoryUtil.getLog(AddressServiceHttp.class);
258            private static final Class<?>[] _addAddressParameterTypes0 = new Class[] {
259                            java.lang.String.class, long.class, java.lang.String.class,
260                            java.lang.String.class, java.lang.String.class,
261                            java.lang.String.class, java.lang.String.class, long.class,
262                            long.class, int.class, boolean.class, boolean.class
263                    };
264            private static final Class<?>[] _addAddressParameterTypes1 = new Class[] {
265                            java.lang.String.class, long.class, java.lang.String.class,
266                            java.lang.String.class, java.lang.String.class,
267                            java.lang.String.class, java.lang.String.class, long.class,
268                            long.class, int.class, boolean.class, boolean.class,
269                            com.liferay.portal.service.ServiceContext.class
270                    };
271            private static final Class<?>[] _deleteAddressParameterTypes2 = new Class[] {
272                            long.class
273                    };
274            private static final Class<?>[] _getAddressParameterTypes3 = new Class[] {
275                            long.class
276                    };
277            private static final Class<?>[] _getAddressesParameterTypes4 = new Class[] {
278                            java.lang.String.class, long.class
279                    };
280            private static final Class<?>[] _updateAddressParameterTypes5 = new Class[] {
281                            long.class, java.lang.String.class, java.lang.String.class,
282                            java.lang.String.class, java.lang.String.class,
283                            java.lang.String.class, long.class, long.class, int.class,
284                            boolean.class, boolean.class
285                    };
286    }