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     * Provides the HTTP utility for the
026     * {@link com.liferay.portal.service.RegionServiceUtil} service utility. The
027     * static methods of this class calls the same methods of the service utility.
028     * However, the signatures are different because it requires an additional
029     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
030     *
031     * <p>
032     * The benefits of using the HTTP utility is that it is fast and allows for
033     * tunneling without the cost of serializing to text. The drawback is that it
034     * only works with Java.
035     * </p>
036     *
037     * <p>
038     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
039     * configure security.
040     * </p>
041     *
042     * <p>
043     * The HTTP utility is only generated for remote services.
044     * </p>
045     *
046     * @author Brian Wing Shun Chan
047     * @see RegionServiceSoap
048     * @see com.liferay.portal.security.auth.HttpPrincipal
049     * @see com.liferay.portal.service.RegionServiceUtil
050     * @generated
051     */
052    public class RegionServiceHttp {
053            public static com.liferay.portal.model.Region addRegion(
054                    HttpPrincipal httpPrincipal, long countryId,
055                    java.lang.String regionCode, java.lang.String name, boolean active)
056                    throws com.liferay.portal.kernel.exception.PortalException,
057                            com.liferay.portal.kernel.exception.SystemException {
058                    try {
059                            MethodKey methodKey = new MethodKey(RegionServiceUtil.class,
060                                            "addRegion", _addRegionParameterTypes0);
061    
062                            MethodHandler methodHandler = new MethodHandler(methodKey,
063                                            countryId, regionCode, name, active);
064    
065                            Object returnObj = null;
066    
067                            try {
068                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
069                            }
070                            catch (Exception e) {
071                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
072                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
073                                    }
074    
075                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
076                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
077                                    }
078    
079                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
080                            }
081    
082                            return (com.liferay.portal.model.Region)returnObj;
083                    }
084                    catch (com.liferay.portal.kernel.exception.SystemException se) {
085                            _log.error(se, se);
086    
087                            throw se;
088                    }
089            }
090    
091            public static com.liferay.portal.model.Region fetchRegion(
092                    HttpPrincipal httpPrincipal, long countryId, java.lang.String regionCode)
093                    throws com.liferay.portal.kernel.exception.SystemException {
094                    try {
095                            MethodKey methodKey = new MethodKey(RegionServiceUtil.class,
096                                            "fetchRegion", _fetchRegionParameterTypes1);
097    
098                            MethodHandler methodHandler = new MethodHandler(methodKey,
099                                            countryId, regionCode);
100    
101                            Object returnObj = null;
102    
103                            try {
104                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
105                            }
106                            catch (Exception e) {
107                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
108                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
109                                    }
110    
111                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
112                            }
113    
114                            return (com.liferay.portal.model.Region)returnObj;
115                    }
116                    catch (com.liferay.portal.kernel.exception.SystemException se) {
117                            _log.error(se, se);
118    
119                            throw se;
120                    }
121            }
122    
123            public static com.liferay.portal.model.Region getRegion(
124                    HttpPrincipal httpPrincipal, long regionId)
125                    throws com.liferay.portal.kernel.exception.PortalException,
126                            com.liferay.portal.kernel.exception.SystemException {
127                    try {
128                            MethodKey methodKey = new MethodKey(RegionServiceUtil.class,
129                                            "getRegion", _getRegionParameterTypes2);
130    
131                            MethodHandler methodHandler = new MethodHandler(methodKey, regionId);
132    
133                            Object returnObj = null;
134    
135                            try {
136                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
137                            }
138                            catch (Exception e) {
139                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
140                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
141                                    }
142    
143                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
144                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
145                                    }
146    
147                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
148                            }
149    
150                            return (com.liferay.portal.model.Region)returnObj;
151                    }
152                    catch (com.liferay.portal.kernel.exception.SystemException se) {
153                            _log.error(se, se);
154    
155                            throw se;
156                    }
157            }
158    
159            public static com.liferay.portal.model.Region getRegion(
160                    HttpPrincipal httpPrincipal, long countryId, java.lang.String regionCode)
161                    throws com.liferay.portal.kernel.exception.PortalException,
162                            com.liferay.portal.kernel.exception.SystemException {
163                    try {
164                            MethodKey methodKey = new MethodKey(RegionServiceUtil.class,
165                                            "getRegion", _getRegionParameterTypes3);
166    
167                            MethodHandler methodHandler = new MethodHandler(methodKey,
168                                            countryId, regionCode);
169    
170                            Object returnObj = null;
171    
172                            try {
173                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
174                            }
175                            catch (Exception e) {
176                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
177                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
178                                    }
179    
180                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
181                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
182                                    }
183    
184                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
185                            }
186    
187                            return (com.liferay.portal.model.Region)returnObj;
188                    }
189                    catch (com.liferay.portal.kernel.exception.SystemException se) {
190                            _log.error(se, se);
191    
192                            throw se;
193                    }
194            }
195    
196            public static java.util.List<com.liferay.portal.model.Region> getRegions(
197                    HttpPrincipal httpPrincipal)
198                    throws com.liferay.portal.kernel.exception.SystemException {
199                    try {
200                            MethodKey methodKey = new MethodKey(RegionServiceUtil.class,
201                                            "getRegions", _getRegionsParameterTypes4);
202    
203                            MethodHandler methodHandler = new MethodHandler(methodKey);
204    
205                            Object returnObj = null;
206    
207                            try {
208                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
209                            }
210                            catch (Exception e) {
211                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
212                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
213                                    }
214    
215                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
216                            }
217    
218                            return (java.util.List<com.liferay.portal.model.Region>)returnObj;
219                    }
220                    catch (com.liferay.portal.kernel.exception.SystemException se) {
221                            _log.error(se, se);
222    
223                            throw se;
224                    }
225            }
226    
227            public static java.util.List<com.liferay.portal.model.Region> getRegions(
228                    HttpPrincipal httpPrincipal, boolean active)
229                    throws com.liferay.portal.kernel.exception.SystemException {
230                    try {
231                            MethodKey methodKey = new MethodKey(RegionServiceUtil.class,
232                                            "getRegions", _getRegionsParameterTypes5);
233    
234                            MethodHandler methodHandler = new MethodHandler(methodKey, active);
235    
236                            Object returnObj = null;
237    
238                            try {
239                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
240                            }
241                            catch (Exception e) {
242                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
243                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
244                                    }
245    
246                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
247                            }
248    
249                            return (java.util.List<com.liferay.portal.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.model.Region> getRegions(
259                    HttpPrincipal httpPrincipal, long countryId)
260                    throws com.liferay.portal.kernel.exception.SystemException {
261                    try {
262                            MethodKey methodKey = new MethodKey(RegionServiceUtil.class,
263                                            "getRegions", _getRegionsParameterTypes6);
264    
265                            MethodHandler methodHandler = new MethodHandler(methodKey, countryId);
266    
267                            Object returnObj = null;
268    
269                            try {
270                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
271                            }
272                            catch (Exception e) {
273                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
274                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
275                                    }
276    
277                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
278                            }
279    
280                            return (java.util.List<com.liferay.portal.model.Region>)returnObj;
281                    }
282                    catch (com.liferay.portal.kernel.exception.SystemException se) {
283                            _log.error(se, se);
284    
285                            throw se;
286                    }
287            }
288    
289            public static java.util.List<com.liferay.portal.model.Region> getRegions(
290                    HttpPrincipal httpPrincipal, long countryId, boolean active)
291                    throws com.liferay.portal.kernel.exception.SystemException {
292                    try {
293                            MethodKey methodKey = new MethodKey(RegionServiceUtil.class,
294                                            "getRegions", _getRegionsParameterTypes7);
295    
296                            MethodHandler methodHandler = new MethodHandler(methodKey,
297                                            countryId, active);
298    
299                            Object returnObj = null;
300    
301                            try {
302                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
303                            }
304                            catch (Exception e) {
305                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
306                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
307                                    }
308    
309                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
310                            }
311    
312                            return (java.util.List<com.liferay.portal.model.Region>)returnObj;
313                    }
314                    catch (com.liferay.portal.kernel.exception.SystemException se) {
315                            _log.error(se, se);
316    
317                            throw se;
318                    }
319            }
320    
321            private static Log _log = LogFactoryUtil.getLog(RegionServiceHttp.class);
322            private static final Class<?>[] _addRegionParameterTypes0 = new Class[] {
323                            long.class, java.lang.String.class, java.lang.String.class,
324                            boolean.class
325                    };
326            private static final Class<?>[] _fetchRegionParameterTypes1 = new Class[] {
327                            long.class, java.lang.String.class
328                    };
329            private static final Class<?>[] _getRegionParameterTypes2 = new Class[] {
330                            long.class
331                    };
332            private static final Class<?>[] _getRegionParameterTypes3 = new Class[] {
333                            long.class, java.lang.String.class
334                    };
335            private static final Class<?>[] _getRegionsParameterTypes4 = new Class[] {  };
336            private static final Class<?>[] _getRegionsParameterTypes5 = new Class[] {
337                            boolean.class
338                    };
339            private static final Class<?>[] _getRegionsParameterTypes6 = new Class[] {
340                            long.class
341                    };
342            private static final Class<?>[] _getRegionsParameterTypes7 = new Class[] {
343                            long.class, boolean.class
344                    };
345    }