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