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.CountryServiceUtil;
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 CountryServiceUtil} 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 CountryServiceSoap
051     * @see HttpPrincipal
052     * @see CountryServiceUtil
053     * @generated
054     */
055    @ProviderType
056    public class CountryServiceHttp {
057            public static com.liferay.portal.kernel.model.Country addCountry(
058                    HttpPrincipal httpPrincipal, java.lang.String name,
059                    java.lang.String a2, java.lang.String a3, java.lang.String number,
060                    java.lang.String idd, boolean active)
061                    throws com.liferay.portal.kernel.exception.PortalException {
062                    try {
063                            MethodKey methodKey = new MethodKey(CountryServiceUtil.class,
064                                            "addCountry", _addCountryParameterTypes0);
065    
066                            MethodHandler methodHandler = new MethodHandler(methodKey, name,
067                                            a2, a3, number, idd, active);
068    
069                            Object returnObj = null;
070    
071                            try {
072                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
073                            }
074                            catch (Exception e) {
075                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
076                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
077                                    }
078    
079                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
080                            }
081    
082                            return (com.liferay.portal.kernel.model.Country)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.kernel.model.Country fetchCountry(
092                    HttpPrincipal httpPrincipal, long countryId) {
093                    try {
094                            MethodKey methodKey = new MethodKey(CountryServiceUtil.class,
095                                            "fetchCountry", _fetchCountryParameterTypes1);
096    
097                            MethodHandler methodHandler = new MethodHandler(methodKey, countryId);
098    
099                            Object returnObj = null;
100    
101                            try {
102                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
103                            }
104                            catch (Exception e) {
105                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
106                            }
107    
108                            return (com.liferay.portal.kernel.model.Country)returnObj;
109                    }
110                    catch (com.liferay.portal.kernel.exception.SystemException se) {
111                            _log.error(se, se);
112    
113                            throw se;
114                    }
115            }
116    
117            public static com.liferay.portal.kernel.model.Country fetchCountryByA2(
118                    HttpPrincipal httpPrincipal, java.lang.String a2) {
119                    try {
120                            MethodKey methodKey = new MethodKey(CountryServiceUtil.class,
121                                            "fetchCountryByA2", _fetchCountryByA2ParameterTypes2);
122    
123                            MethodHandler methodHandler = new MethodHandler(methodKey, a2);
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.Country)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.Country fetchCountryByA3(
144                    HttpPrincipal httpPrincipal, java.lang.String a3) {
145                    try {
146                            MethodKey methodKey = new MethodKey(CountryServiceUtil.class,
147                                            "fetchCountryByA3", _fetchCountryByA3ParameterTypes3);
148    
149                            MethodHandler methodHandler = new MethodHandler(methodKey, a3);
150    
151                            Object returnObj = null;
152    
153                            try {
154                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
155                            }
156                            catch (Exception e) {
157                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
158                            }
159    
160                            return (com.liferay.portal.kernel.model.Country)returnObj;
161                    }
162                    catch (com.liferay.portal.kernel.exception.SystemException se) {
163                            _log.error(se, se);
164    
165                            throw se;
166                    }
167            }
168    
169            public static java.util.List<com.liferay.portal.kernel.model.Country> getCountries(
170                    HttpPrincipal httpPrincipal) {
171                    try {
172                            MethodKey methodKey = new MethodKey(CountryServiceUtil.class,
173                                            "getCountries", _getCountriesParameterTypes4);
174    
175                            MethodHandler methodHandler = new MethodHandler(methodKey);
176    
177                            Object returnObj = null;
178    
179                            try {
180                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
181                            }
182                            catch (Exception e) {
183                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
184                            }
185    
186                            return (java.util.List<com.liferay.portal.kernel.model.Country>)returnObj;
187                    }
188                    catch (com.liferay.portal.kernel.exception.SystemException se) {
189                            _log.error(se, se);
190    
191                            throw se;
192                    }
193            }
194    
195            public static java.util.List<com.liferay.portal.kernel.model.Country> getCountries(
196                    HttpPrincipal httpPrincipal, boolean active) {
197                    try {
198                            MethodKey methodKey = new MethodKey(CountryServiceUtil.class,
199                                            "getCountries", _getCountriesParameterTypes5);
200    
201                            MethodHandler methodHandler = new MethodHandler(methodKey, active);
202    
203                            Object returnObj = null;
204    
205                            try {
206                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
207                            }
208                            catch (Exception e) {
209                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
210                            }
211    
212                            return (java.util.List<com.liferay.portal.kernel.model.Country>)returnObj;
213                    }
214                    catch (com.liferay.portal.kernel.exception.SystemException se) {
215                            _log.error(se, se);
216    
217                            throw se;
218                    }
219            }
220    
221            public static com.liferay.portal.kernel.model.Country getCountry(
222                    HttpPrincipal httpPrincipal, long countryId)
223                    throws com.liferay.portal.kernel.exception.PortalException {
224                    try {
225                            MethodKey methodKey = new MethodKey(CountryServiceUtil.class,
226                                            "getCountry", _getCountryParameterTypes6);
227    
228                            MethodHandler methodHandler = new MethodHandler(methodKey, countryId);
229    
230                            Object returnObj = null;
231    
232                            try {
233                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
234                            }
235                            catch (Exception e) {
236                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
237                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
238                                    }
239    
240                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
241                            }
242    
243                            return (com.liferay.portal.kernel.model.Country)returnObj;
244                    }
245                    catch (com.liferay.portal.kernel.exception.SystemException se) {
246                            _log.error(se, se);
247    
248                            throw se;
249                    }
250            }
251    
252            public static com.liferay.portal.kernel.model.Country getCountryByA2(
253                    HttpPrincipal httpPrincipal, java.lang.String a2)
254                    throws com.liferay.portal.kernel.exception.PortalException {
255                    try {
256                            MethodKey methodKey = new MethodKey(CountryServiceUtil.class,
257                                            "getCountryByA2", _getCountryByA2ParameterTypes7);
258    
259                            MethodHandler methodHandler = new MethodHandler(methodKey, a2);
260    
261                            Object returnObj = null;
262    
263                            try {
264                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
265                            }
266                            catch (Exception e) {
267                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
268                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
269                                    }
270    
271                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
272                            }
273    
274                            return (com.liferay.portal.kernel.model.Country)returnObj;
275                    }
276                    catch (com.liferay.portal.kernel.exception.SystemException se) {
277                            _log.error(se, se);
278    
279                            throw se;
280                    }
281            }
282    
283            public static com.liferay.portal.kernel.model.Country getCountryByA3(
284                    HttpPrincipal httpPrincipal, java.lang.String a3)
285                    throws com.liferay.portal.kernel.exception.PortalException {
286                    try {
287                            MethodKey methodKey = new MethodKey(CountryServiceUtil.class,
288                                            "getCountryByA3", _getCountryByA3ParameterTypes8);
289    
290                            MethodHandler methodHandler = new MethodHandler(methodKey, a3);
291    
292                            Object returnObj = null;
293    
294                            try {
295                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
296                            }
297                            catch (Exception e) {
298                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
299                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
300                                    }
301    
302                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
303                            }
304    
305                            return (com.liferay.portal.kernel.model.Country)returnObj;
306                    }
307                    catch (com.liferay.portal.kernel.exception.SystemException se) {
308                            _log.error(se, se);
309    
310                            throw se;
311                    }
312            }
313    
314            public static com.liferay.portal.kernel.model.Country getCountryByName(
315                    HttpPrincipal httpPrincipal, java.lang.String name)
316                    throws com.liferay.portal.kernel.exception.PortalException {
317                    try {
318                            MethodKey methodKey = new MethodKey(CountryServiceUtil.class,
319                                            "getCountryByName", _getCountryByNameParameterTypes9);
320    
321                            MethodHandler methodHandler = new MethodHandler(methodKey, name);
322    
323                            Object returnObj = null;
324    
325                            try {
326                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
327                            }
328                            catch (Exception e) {
329                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
330                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
331                                    }
332    
333                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
334                            }
335    
336                            return (com.liferay.portal.kernel.model.Country)returnObj;
337                    }
338                    catch (com.liferay.portal.kernel.exception.SystemException se) {
339                            _log.error(se, se);
340    
341                            throw se;
342                    }
343            }
344    
345            private static Log _log = LogFactoryUtil.getLog(CountryServiceHttp.class);
346            private static final Class<?>[] _addCountryParameterTypes0 = new Class[] {
347                            java.lang.String.class, java.lang.String.class,
348                            java.lang.String.class, java.lang.String.class,
349                            java.lang.String.class, boolean.class
350                    };
351            private static final Class<?>[] _fetchCountryParameterTypes1 = new Class[] {
352                            long.class
353                    };
354            private static final Class<?>[] _fetchCountryByA2ParameterTypes2 = new Class[] {
355                            java.lang.String.class
356                    };
357            private static final Class<?>[] _fetchCountryByA3ParameterTypes3 = new Class[] {
358                            java.lang.String.class
359                    };
360            private static final Class<?>[] _getCountriesParameterTypes4 = new Class[] {  };
361            private static final Class<?>[] _getCountriesParameterTypes5 = new Class[] {
362                            boolean.class
363                    };
364            private static final Class<?>[] _getCountryParameterTypes6 = new Class[] {
365                            long.class
366                    };
367            private static final Class<?>[] _getCountryByA2ParameterTypes7 = new Class[] {
368                            java.lang.String.class
369                    };
370            private static final Class<?>[] _getCountryByA3ParameterTypes8 = new Class[] {
371                            java.lang.String.class
372                    };
373            private static final Class<?>[] _getCountryByNameParameterTypes9 = new Class[] {
374                            java.lang.String.class
375                    };
376    }