001    /**
002     * Copyright (c) 2000-2012 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.CountryServiceUtil;
023    
024    /**
025     * <p>
026     * This class provides a HTTP utility for the
027     * {@link com.liferay.portal.service.CountryServiceUtil} 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       CountryServiceSoap
050     * @see       com.liferay.portal.security.auth.HttpPrincipal
051     * @see       com.liferay.portal.service.CountryServiceUtil
052     * @generated
053     */
054    public class CountryServiceHttp {
055            public static com.liferay.portal.model.Country addCountry(
056                    HttpPrincipal httpPrincipal, java.lang.String name,
057                    java.lang.String a2, java.lang.String a3, java.lang.String number,
058                    java.lang.String idd, boolean active)
059                    throws com.liferay.portal.kernel.exception.PortalException,
060                            com.liferay.portal.kernel.exception.SystemException {
061                    try {
062                            MethodKey methodKey = new MethodKey(CountryServiceUtil.class.getName(),
063                                            "addCountry", _addCountryParameterTypes0);
064    
065                            MethodHandler methodHandler = new MethodHandler(methodKey, name,
066                                            a2, a3, number, idd, 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                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
079                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
080                                    }
081    
082                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
083                            }
084    
085                            return (com.liferay.portal.model.Country)returnObj;
086                    }
087                    catch (com.liferay.portal.kernel.exception.SystemException se) {
088                            _log.error(se, se);
089    
090                            throw se;
091                    }
092            }
093    
094            public static com.liferay.portal.model.Country fetchCountry(
095                    HttpPrincipal httpPrincipal, long countryId)
096                    throws com.liferay.portal.kernel.exception.SystemException {
097                    try {
098                            MethodKey methodKey = new MethodKey(CountryServiceUtil.class.getName(),
099                                            "fetchCountry", _fetchCountryParameterTypes1);
100    
101                            MethodHandler methodHandler = new MethodHandler(methodKey, countryId);
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.Country)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.Country fetchCountryByA2(
126                    HttpPrincipal httpPrincipal, java.lang.String a2)
127                    throws com.liferay.portal.kernel.exception.SystemException {
128                    try {
129                            MethodKey methodKey = new MethodKey(CountryServiceUtil.class.getName(),
130                                            "fetchCountryByA2", _fetchCountryByA2ParameterTypes2);
131    
132                            MethodHandler methodHandler = new MethodHandler(methodKey, a2);
133    
134                            Object returnObj = null;
135    
136                            try {
137                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
138                            }
139                            catch (Exception e) {
140                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
141                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
142                                    }
143    
144                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
145                            }
146    
147                            return (com.liferay.portal.model.Country)returnObj;
148                    }
149                    catch (com.liferay.portal.kernel.exception.SystemException se) {
150                            _log.error(se, se);
151    
152                            throw se;
153                    }
154            }
155    
156            public static com.liferay.portal.model.Country fetchCountryByA3(
157                    HttpPrincipal httpPrincipal, java.lang.String a3)
158                    throws com.liferay.portal.kernel.exception.SystemException {
159                    try {
160                            MethodKey methodKey = new MethodKey(CountryServiceUtil.class.getName(),
161                                            "fetchCountryByA3", _fetchCountryByA3ParameterTypes3);
162    
163                            MethodHandler methodHandler = new MethodHandler(methodKey, a3);
164    
165                            Object returnObj = null;
166    
167                            try {
168                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
169                            }
170                            catch (Exception e) {
171                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
172                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
173                                    }
174    
175                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
176                            }
177    
178                            return (com.liferay.portal.model.Country)returnObj;
179                    }
180                    catch (com.liferay.portal.kernel.exception.SystemException se) {
181                            _log.error(se, se);
182    
183                            throw se;
184                    }
185            }
186    
187            public static java.util.List<com.liferay.portal.model.Country> getCountries(
188                    HttpPrincipal httpPrincipal)
189                    throws com.liferay.portal.kernel.exception.SystemException {
190                    try {
191                            MethodKey methodKey = new MethodKey(CountryServiceUtil.class.getName(),
192                                            "getCountries", _getCountriesParameterTypes4);
193    
194                            MethodHandler methodHandler = new MethodHandler(methodKey);
195    
196                            Object returnObj = null;
197    
198                            try {
199                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
200                            }
201                            catch (Exception e) {
202                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
203                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
204                                    }
205    
206                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
207                            }
208    
209                            return (java.util.List<com.liferay.portal.model.Country>)returnObj;
210                    }
211                    catch (com.liferay.portal.kernel.exception.SystemException se) {
212                            _log.error(se, se);
213    
214                            throw se;
215                    }
216            }
217    
218            public static java.util.List<com.liferay.portal.model.Country> getCountries(
219                    HttpPrincipal httpPrincipal, boolean active)
220                    throws com.liferay.portal.kernel.exception.SystemException {
221                    try {
222                            MethodKey methodKey = new MethodKey(CountryServiceUtil.class.getName(),
223                                            "getCountries", _getCountriesParameterTypes5);
224    
225                            MethodHandler methodHandler = new MethodHandler(methodKey, active);
226    
227                            Object returnObj = null;
228    
229                            try {
230                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
231                            }
232                            catch (Exception e) {
233                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
234                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
235                                    }
236    
237                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
238                            }
239    
240                            return (java.util.List<com.liferay.portal.model.Country>)returnObj;
241                    }
242                    catch (com.liferay.portal.kernel.exception.SystemException se) {
243                            _log.error(se, se);
244    
245                            throw se;
246                    }
247            }
248    
249            public static com.liferay.portal.model.Country getCountry(
250                    HttpPrincipal httpPrincipal, long countryId)
251                    throws com.liferay.portal.kernel.exception.PortalException,
252                            com.liferay.portal.kernel.exception.SystemException {
253                    try {
254                            MethodKey methodKey = new MethodKey(CountryServiceUtil.class.getName(),
255                                            "getCountry", _getCountryParameterTypes6);
256    
257                            MethodHandler methodHandler = new MethodHandler(methodKey, countryId);
258    
259                            Object returnObj = null;
260    
261                            try {
262                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
263                            }
264                            catch (Exception e) {
265                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
266                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
267                                    }
268    
269                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
270                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
271                                    }
272    
273                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
274                            }
275    
276                            return (com.liferay.portal.model.Country)returnObj;
277                    }
278                    catch (com.liferay.portal.kernel.exception.SystemException se) {
279                            _log.error(se, se);
280    
281                            throw se;
282                    }
283            }
284    
285            public static com.liferay.portal.model.Country getCountryByA2(
286                    HttpPrincipal httpPrincipal, java.lang.String a2)
287                    throws com.liferay.portal.kernel.exception.PortalException,
288                            com.liferay.portal.kernel.exception.SystemException {
289                    try {
290                            MethodKey methodKey = new MethodKey(CountryServiceUtil.class.getName(),
291                                            "getCountryByA2", _getCountryByA2ParameterTypes7);
292    
293                            MethodHandler methodHandler = new MethodHandler(methodKey, a2);
294    
295                            Object returnObj = null;
296    
297                            try {
298                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
299                            }
300                            catch (Exception e) {
301                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
302                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
303                                    }
304    
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 (com.liferay.portal.model.Country)returnObj;
313                    }
314                    catch (com.liferay.portal.kernel.exception.SystemException se) {
315                            _log.error(se, se);
316    
317                            throw se;
318                    }
319            }
320    
321            public static com.liferay.portal.model.Country getCountryByA3(
322                    HttpPrincipal httpPrincipal, java.lang.String a3)
323                    throws com.liferay.portal.kernel.exception.PortalException,
324                            com.liferay.portal.kernel.exception.SystemException {
325                    try {
326                            MethodKey methodKey = new MethodKey(CountryServiceUtil.class.getName(),
327                                            "getCountryByA3", _getCountryByA3ParameterTypes8);
328    
329                            MethodHandler methodHandler = new MethodHandler(methodKey, a3);
330    
331                            Object returnObj = null;
332    
333                            try {
334                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
335                            }
336                            catch (Exception e) {
337                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
338                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
339                                    }
340    
341                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
342                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
343                                    }
344    
345                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
346                            }
347    
348                            return (com.liferay.portal.model.Country)returnObj;
349                    }
350                    catch (com.liferay.portal.kernel.exception.SystemException se) {
351                            _log.error(se, se);
352    
353                            throw se;
354                    }
355            }
356    
357            public static com.liferay.portal.model.Country getCountryByName(
358                    HttpPrincipal httpPrincipal, java.lang.String name)
359                    throws com.liferay.portal.kernel.exception.PortalException,
360                            com.liferay.portal.kernel.exception.SystemException {
361                    try {
362                            MethodKey methodKey = new MethodKey(CountryServiceUtil.class.getName(),
363                                            "getCountryByName", _getCountryByNameParameterTypes9);
364    
365                            MethodHandler methodHandler = new MethodHandler(methodKey, name);
366    
367                            Object returnObj = null;
368    
369                            try {
370                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
371                            }
372                            catch (Exception e) {
373                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
374                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
375                                    }
376    
377                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
378                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
379                                    }
380    
381                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
382                            }
383    
384                            return (com.liferay.portal.model.Country)returnObj;
385                    }
386                    catch (com.liferay.portal.kernel.exception.SystemException se) {
387                            _log.error(se, se);
388    
389                            throw se;
390                    }
391            }
392    
393            private static Log _log = LogFactoryUtil.getLog(CountryServiceHttp.class);
394            private static final Class<?>[] _addCountryParameterTypes0 = new Class[] {
395                            java.lang.String.class, java.lang.String.class,
396                            java.lang.String.class, java.lang.String.class,
397                            java.lang.String.class, boolean.class
398                    };
399            private static final Class<?>[] _fetchCountryParameterTypes1 = new Class[] {
400                            long.class
401                    };
402            private static final Class<?>[] _fetchCountryByA2ParameterTypes2 = new Class[] {
403                            java.lang.String.class
404                    };
405            private static final Class<?>[] _fetchCountryByA3ParameterTypes3 = new Class[] {
406                            java.lang.String.class
407                    };
408            private static final Class<?>[] _getCountriesParameterTypes4 = new Class[] {  };
409            private static final Class<?>[] _getCountriesParameterTypes5 = new Class[] {
410                            boolean.class
411                    };
412            private static final Class<?>[] _getCountryParameterTypes6 = new Class[] {
413                            long.class
414                    };
415            private static final Class<?>[] _getCountryByA2ParameterTypes7 = new Class[] {
416                            java.lang.String.class
417                    };
418            private static final Class<?>[] _getCountryByA3ParameterTypes8 = new Class[] {
419                            java.lang.String.class
420                    };
421            private static final Class<?>[] _getCountryByNameParameterTypes9 = new Class[] {
422                            java.lang.String.class
423                    };
424    }