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.security.auth.HttpPrincipal;
022    import com.liferay.portal.kernel.service.AddressServiceUtil;
023    import com.liferay.portal.kernel.service.http.TunnelUtil;
024    import com.liferay.portal.kernel.util.MethodHandler;
025    import com.liferay.portal.kernel.util.MethodKey;
026    
027    /**
028     * Provides the HTTP utility for the
029     * {@link AddressServiceUtil} service utility. The
030     * static methods of this class calls the same methods of the service utility.
031     * However, the signatures are different because it requires an additional
032     * {@link HttpPrincipal} parameter.
033     *
034     * <p>
035     * The benefits of using the HTTP utility is that it is fast and allows for
036     * tunneling without the cost of serializing to text. The drawback is that it
037     * only works with Java.
038     * </p>
039     *
040     * <p>
041     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
042     * configure security.
043     * </p>
044     *
045     * <p>
046     * The HTTP utility is only generated for remote services.
047     * </p>
048     *
049     * @author Brian Wing Shun Chan
050     * @see AddressServiceSoap
051     * @see HttpPrincipal
052     * @see AddressServiceUtil
053     * @generated
054     */
055    @ProviderType
056    public class AddressServiceHttp {
057            public static com.liferay.portal.kernel.model.Address addAddress(
058                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK,
059                    java.lang.String street1, java.lang.String street2,
060                    java.lang.String street3, java.lang.String city, java.lang.String zip,
061                    long regionId, long countryId, long typeId, boolean mailing,
062                    boolean primary,
063                    com.liferay.portal.kernel.service.ServiceContext serviceContext)
064                    throws com.liferay.portal.kernel.exception.PortalException {
065                    try {
066                            MethodKey methodKey = new MethodKey(AddressServiceUtil.class,
067                                            "addAddress", _addAddressParameterTypes0);
068    
069                            MethodHandler methodHandler = new MethodHandler(methodKey,
070                                            className, classPK, street1, street2, street3, city, zip,
071                                            regionId, countryId, typeId, mailing, primary,
072                                            serviceContext);
073    
074                            Object returnObj = null;
075    
076                            try {
077                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
078                            }
079                            catch (Exception e) {
080                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
081                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
082                                    }
083    
084                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
085                            }
086    
087                            return (com.liferay.portal.kernel.model.Address)returnObj;
088                    }
089                    catch (com.liferay.portal.kernel.exception.SystemException se) {
090                            _log.error(se, se);
091    
092                            throw se;
093                    }
094            }
095    
096            public static void deleteAddress(HttpPrincipal httpPrincipal, long addressId)
097                    throws com.liferay.portal.kernel.exception.PortalException {
098                    try {
099                            MethodKey methodKey = new MethodKey(AddressServiceUtil.class,
100                                            "deleteAddress", _deleteAddressParameterTypes1);
101    
102                            MethodHandler methodHandler = new MethodHandler(methodKey, addressId);
103    
104                            try {
105                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
106                            }
107                            catch (Exception e) {
108                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
109                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
110                                    }
111    
112                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
113                            }
114                    }
115                    catch (com.liferay.portal.kernel.exception.SystemException se) {
116                            _log.error(se, se);
117    
118                            throw se;
119                    }
120            }
121    
122            public static com.liferay.portal.kernel.model.Address getAddress(
123                    HttpPrincipal httpPrincipal, long addressId)
124                    throws com.liferay.portal.kernel.exception.PortalException {
125                    try {
126                            MethodKey methodKey = new MethodKey(AddressServiceUtil.class,
127                                            "getAddress", _getAddressParameterTypes2);
128    
129                            MethodHandler methodHandler = new MethodHandler(methodKey, addressId);
130    
131                            Object returnObj = null;
132    
133                            try {
134                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
135                            }
136                            catch (Exception e) {
137                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
138                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
139                                    }
140    
141                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
142                            }
143    
144                            return (com.liferay.portal.kernel.model.Address)returnObj;
145                    }
146                    catch (com.liferay.portal.kernel.exception.SystemException se) {
147                            _log.error(se, se);
148    
149                            throw se;
150                    }
151            }
152    
153            public static java.util.List<com.liferay.portal.kernel.model.Address> getAddresses(
154                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK)
155                    throws com.liferay.portal.kernel.exception.PortalException {
156                    try {
157                            MethodKey methodKey = new MethodKey(AddressServiceUtil.class,
158                                            "getAddresses", _getAddressesParameterTypes3);
159    
160                            MethodHandler methodHandler = new MethodHandler(methodKey,
161                                            className, classPK);
162    
163                            Object returnObj = null;
164    
165                            try {
166                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
167                            }
168                            catch (Exception e) {
169                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
170                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
171                                    }
172    
173                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
174                            }
175    
176                            return (java.util.List<com.liferay.portal.kernel.model.Address>)returnObj;
177                    }
178                    catch (com.liferay.portal.kernel.exception.SystemException se) {
179                            _log.error(se, se);
180    
181                            throw se;
182                    }
183            }
184    
185            public static com.liferay.portal.kernel.model.Address updateAddress(
186                    HttpPrincipal httpPrincipal, long addressId, java.lang.String street1,
187                    java.lang.String street2, java.lang.String street3,
188                    java.lang.String city, java.lang.String zip, long regionId,
189                    long countryId, long typeId, boolean mailing, boolean primary)
190                    throws com.liferay.portal.kernel.exception.PortalException {
191                    try {
192                            MethodKey methodKey = new MethodKey(AddressServiceUtil.class,
193                                            "updateAddress", _updateAddressParameterTypes4);
194    
195                            MethodHandler methodHandler = new MethodHandler(methodKey,
196                                            addressId, street1, street2, street3, city, zip, regionId,
197                                            countryId, typeId, mailing, primary);
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 (com.liferay.portal.kernel.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            private static Log _log = LogFactoryUtil.getLog(AddressServiceHttp.class);
222            private static final Class<?>[] _addAddressParameterTypes0 = new Class[] {
223                            java.lang.String.class, long.class, java.lang.String.class,
224                            java.lang.String.class, java.lang.String.class,
225                            java.lang.String.class, java.lang.String.class, long.class,
226                            long.class, long.class, boolean.class, boolean.class,
227                            com.liferay.portal.kernel.service.ServiceContext.class
228                    };
229            private static final Class<?>[] _deleteAddressParameterTypes1 = new Class[] {
230                            long.class
231                    };
232            private static final Class<?>[] _getAddressParameterTypes2 = new Class[] {
233                            long.class
234                    };
235            private static final Class<?>[] _getAddressesParameterTypes3 = new Class[] {
236                            java.lang.String.class, long.class
237                    };
238            private static final Class<?>[] _updateAddressParameterTypes4 = new Class[] {
239                            long.class, java.lang.String.class, java.lang.String.class,
240                            java.lang.String.class, java.lang.String.class,
241                            java.lang.String.class, long.class, long.class, long.class,
242                            boolean.class, boolean.class
243                    };
244    }