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