001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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 regionId)
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, regionId);
099    
100                            Object returnObj = null;
101    
102                            try {
103                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
104                            }
105                            catch (Exception e) {
106                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
107                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
108                                    }
109    
110                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
111                            }
112    
113                            return (com.liferay.portal.model.Region)returnObj;
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.model.Region fetchRegion(
123                    HttpPrincipal httpPrincipal, long countryId, java.lang.String regionCode)
124                    throws com.liferay.portal.kernel.exception.SystemException {
125                    try {
126                            MethodKey methodKey = new MethodKey(RegionServiceUtil.class,
127                                            "fetchRegion", _fetchRegionParameterTypes2);
128    
129                            MethodHandler methodHandler = new MethodHandler(methodKey,
130                                            countryId, regionCode);
131    
132                            Object returnObj = null;
133    
134                            try {
135                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
136                            }
137                            catch (Exception e) {
138                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
139                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
140                                    }
141    
142                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
143                            }
144    
145                            return (com.liferay.portal.model.Region)returnObj;
146                    }
147                    catch (com.liferay.portal.kernel.exception.SystemException se) {
148                            _log.error(se, se);
149    
150                            throw se;
151                    }
152            }
153    
154            public static com.liferay.portal.model.Region getRegion(
155                    HttpPrincipal httpPrincipal, long regionId)
156                    throws com.liferay.portal.kernel.exception.PortalException,
157                            com.liferay.portal.kernel.exception.SystemException {
158                    try {
159                            MethodKey methodKey = new MethodKey(RegionServiceUtil.class,
160                                            "getRegion", _getRegionParameterTypes3);
161    
162                            MethodHandler methodHandler = new MethodHandler(methodKey, regionId);
163    
164                            Object returnObj = null;
165    
166                            try {
167                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
168                            }
169                            catch (Exception e) {
170                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
171                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
172                                    }
173    
174                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
175                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
176                                    }
177    
178                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
179                            }
180    
181                            return (com.liferay.portal.model.Region)returnObj;
182                    }
183                    catch (com.liferay.portal.kernel.exception.SystemException se) {
184                            _log.error(se, se);
185    
186                            throw se;
187                    }
188            }
189    
190            public static com.liferay.portal.model.Region getRegion(
191                    HttpPrincipal httpPrincipal, long countryId, java.lang.String regionCode)
192                    throws com.liferay.portal.kernel.exception.PortalException,
193                            com.liferay.portal.kernel.exception.SystemException {
194                    try {
195                            MethodKey methodKey = new MethodKey(RegionServiceUtil.class,
196                                            "getRegion", _getRegionParameterTypes4);
197    
198                            MethodHandler methodHandler = new MethodHandler(methodKey,
199                                            countryId, regionCode);
200    
201                            Object returnObj = null;
202    
203                            try {
204                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
205                            }
206                            catch (Exception e) {
207                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
208                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
209                                    }
210    
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 (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)
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);
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, boolean active)
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, active);
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)
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, countryId);
297    
298                            Object returnObj = null;
299    
300                            try {
301                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
302                            }
303                            catch (Exception e) {
304                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
305                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
306                                    }
307    
308                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
309                            }
310    
311                            return (java.util.List<com.liferay.portal.model.Region>)returnObj;
312                    }
313                    catch (com.liferay.portal.kernel.exception.SystemException se) {
314                            _log.error(se, se);
315    
316                            throw se;
317                    }
318            }
319    
320            public static java.util.List<com.liferay.portal.model.Region> getRegions(
321                    HttpPrincipal httpPrincipal, long countryId, boolean active)
322                    throws com.liferay.portal.kernel.exception.SystemException {
323                    try {
324                            MethodKey methodKey = new MethodKey(RegionServiceUtil.class,
325                                            "getRegions", _getRegionsParameterTypes8);
326    
327                            MethodHandler methodHandler = new MethodHandler(methodKey,
328                                            countryId, active);
329    
330                            Object returnObj = null;
331    
332                            try {
333                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
334                            }
335                            catch (Exception e) {
336                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
337                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
338                                    }
339    
340                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
341                            }
342    
343                            return (java.util.List<com.liferay.portal.model.Region>)returnObj;
344                    }
345                    catch (com.liferay.portal.kernel.exception.SystemException se) {
346                            _log.error(se, se);
347    
348                            throw se;
349                    }
350            }
351    
352            private static Log _log = LogFactoryUtil.getLog(RegionServiceHttp.class);
353            private static final Class<?>[] _addRegionParameterTypes0 = new Class[] {
354                            long.class, java.lang.String.class, java.lang.String.class,
355                            boolean.class
356                    };
357            private static final Class<?>[] _fetchRegionParameterTypes1 = new Class[] {
358                            long.class
359                    };
360            private static final Class<?>[] _fetchRegionParameterTypes2 = new Class[] {
361                            long.class, java.lang.String.class
362                    };
363            private static final Class<?>[] _getRegionParameterTypes3 = new Class[] {
364                            long.class
365                    };
366            private static final Class<?>[] _getRegionParameterTypes4 = new Class[] {
367                            long.class, java.lang.String.class
368                    };
369            private static final Class<?>[] _getRegionsParameterTypes5 = new Class[] {  };
370            private static final Class<?>[] _getRegionsParameterTypes6 = new Class[] {
371                            boolean.class
372                    };
373            private static final Class<?>[] _getRegionsParameterTypes7 = new Class[] {
374                            long.class
375                    };
376            private static final Class<?>[] _getRegionsParameterTypes8 = new Class[] {
377                            long.class, boolean.class
378                    };
379    }