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