001    /**
002     * Copyright (c) 2000-2010 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", java.lang.String.class,
064                                            java.lang.String.class, java.lang.String.class,
065                                            java.lang.String.class, java.lang.String.class,
066                                            boolean.class);
067    
068                            MethodHandler methodHandler = new MethodHandler(methodKey, name,
069                                            a2, a3, number, idd, active);
070    
071                            Object returnObj = null;
072    
073                            try {
074                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
075                            }
076                            catch (Exception e) {
077                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
078                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
079                                    }
080    
081                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
082                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
083                                    }
084    
085                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
086                            }
087    
088                            return (com.liferay.portal.model.Country)returnObj;
089                    }
090                    catch (com.liferay.portal.kernel.exception.SystemException se) {
091                            _log.error(se, se);
092    
093                            throw se;
094                    }
095            }
096    
097            public static java.util.List<com.liferay.portal.model.Country> getCountries(
098                    HttpPrincipal httpPrincipal)
099                    throws com.liferay.portal.kernel.exception.SystemException {
100                    try {
101                            MethodKey methodKey = new MethodKey(CountryServiceUtil.class.getName(),
102                                            "getCountries");
103    
104                            MethodHandler methodHandler = new MethodHandler(methodKey);
105    
106                            Object returnObj = null;
107    
108                            try {
109                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
110                            }
111                            catch (Exception e) {
112                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
113                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
114                                    }
115    
116                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
117                            }
118    
119                            return (java.util.List<com.liferay.portal.model.Country>)returnObj;
120                    }
121                    catch (com.liferay.portal.kernel.exception.SystemException se) {
122                            _log.error(se, se);
123    
124                            throw se;
125                    }
126            }
127    
128            public static java.util.List<com.liferay.portal.model.Country> getCountries(
129                    HttpPrincipal httpPrincipal, boolean active)
130                    throws com.liferay.portal.kernel.exception.SystemException {
131                    try {
132                            MethodKey methodKey = new MethodKey(CountryServiceUtil.class.getName(),
133                                            "getCountries", boolean.class);
134    
135                            MethodHandler methodHandler = new MethodHandler(methodKey, active);
136    
137                            Object returnObj = null;
138    
139                            try {
140                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
141                            }
142                            catch (Exception e) {
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 (java.util.List<com.liferay.portal.model.Country>)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.Country getCountry(
160                    HttpPrincipal httpPrincipal, long countryId)
161                    throws com.liferay.portal.kernel.exception.PortalException,
162                            com.liferay.portal.kernel.exception.SystemException {
163                    try {
164                            MethodKey methodKey = new MethodKey(CountryServiceUtil.class.getName(),
165                                            "getCountry", long.class);
166    
167                            MethodHandler methodHandler = new MethodHandler(methodKey, countryId);
168    
169                            Object returnObj = null;
170    
171                            try {
172                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
173                            }
174                            catch (Exception e) {
175                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
176                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
177                                    }
178    
179                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
180                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
181                                    }
182    
183                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
184                            }
185    
186                            return (com.liferay.portal.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 com.liferay.portal.model.Country getCountryByA2(
196                    HttpPrincipal httpPrincipal, java.lang.String a2)
197                    throws com.liferay.portal.kernel.exception.PortalException,
198                            com.liferay.portal.kernel.exception.SystemException {
199                    try {
200                            MethodKey methodKey = new MethodKey(CountryServiceUtil.class.getName(),
201                                            "getCountryByA2", java.lang.String.class);
202    
203                            MethodHandler methodHandler = new MethodHandler(methodKey, a2);
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.PortalException) {
212                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
213                                    }
214    
215                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
216                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
217                                    }
218    
219                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
220                            }
221    
222                            return (com.liferay.portal.model.Country)returnObj;
223                    }
224                    catch (com.liferay.portal.kernel.exception.SystemException se) {
225                            _log.error(se, se);
226    
227                            throw se;
228                    }
229            }
230    
231            public static com.liferay.portal.model.Country getCountryByA3(
232                    HttpPrincipal httpPrincipal, java.lang.String a3)
233                    throws com.liferay.portal.kernel.exception.PortalException,
234                            com.liferay.portal.kernel.exception.SystemException {
235                    try {
236                            MethodKey methodKey = new MethodKey(CountryServiceUtil.class.getName(),
237                                            "getCountryByA3", java.lang.String.class);
238    
239                            MethodHandler methodHandler = new MethodHandler(methodKey, a3);
240    
241                            Object returnObj = null;
242    
243                            try {
244                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
245                            }
246                            catch (Exception e) {
247                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
248                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
249                                    }
250    
251                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
252                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
253                                    }
254    
255                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
256                            }
257    
258                            return (com.liferay.portal.model.Country)returnObj;
259                    }
260                    catch (com.liferay.portal.kernel.exception.SystemException se) {
261                            _log.error(se, se);
262    
263                            throw se;
264                    }
265            }
266    
267            public static com.liferay.portal.model.Country getCountryByName(
268                    HttpPrincipal httpPrincipal, java.lang.String name)
269                    throws com.liferay.portal.kernel.exception.PortalException,
270                            com.liferay.portal.kernel.exception.SystemException {
271                    try {
272                            MethodKey methodKey = new MethodKey(CountryServiceUtil.class.getName(),
273                                            "getCountryByName", java.lang.String.class);
274    
275                            MethodHandler methodHandler = new MethodHandler(methodKey, name);
276    
277                            Object returnObj = null;
278    
279                            try {
280                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
281                            }
282                            catch (Exception e) {
283                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
284                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
285                                    }
286    
287                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
288                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
289                                    }
290    
291                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
292                            }
293    
294                            return (com.liferay.portal.model.Country)returnObj;
295                    }
296                    catch (com.liferay.portal.kernel.exception.SystemException se) {
297                            _log.error(se, se);
298    
299                            throw se;
300                    }
301            }
302    
303            private static Log _log = LogFactoryUtil.getLog(CountryServiceHttp.class);
304    }