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