001    /**
002     * Copyright (c) 2000-2010 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.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 java.util.List<com.liferay.portal.model.Country> getCountries(
095                    HttpPrincipal httpPrincipal)
096                    throws com.liferay.portal.kernel.exception.SystemException {
097                    try {
098                            MethodKey methodKey = new MethodKey(CountryServiceUtil.class.getName(),
099                                            "getCountries", _getCountriesParameterTypes1);
100    
101                            MethodHandler methodHandler = new MethodHandler(methodKey);
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 (java.util.List<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 java.util.List<com.liferay.portal.model.Country> getCountries(
126                    HttpPrincipal httpPrincipal, boolean active)
127                    throws com.liferay.portal.kernel.exception.SystemException {
128                    try {
129                            MethodKey methodKey = new MethodKey(CountryServiceUtil.class.getName(),
130                                            "getCountries", _getCountriesParameterTypes2);
131    
132                            MethodHandler methodHandler = new MethodHandler(methodKey, active);
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 (java.util.List<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 getCountry(
157                    HttpPrincipal httpPrincipal, long countryId)
158                    throws com.liferay.portal.kernel.exception.PortalException,
159                            com.liferay.portal.kernel.exception.SystemException {
160                    try {
161                            MethodKey methodKey = new MethodKey(CountryServiceUtil.class.getName(),
162                                            "getCountry", _getCountryParameterTypes3);
163    
164                            MethodHandler methodHandler = new MethodHandler(methodKey, countryId);
165    
166                            Object returnObj = null;
167    
168                            try {
169                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
170                            }
171                            catch (Exception e) {
172                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
173                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
174                                    }
175    
176                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
177                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
178                                    }
179    
180                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
181                            }
182    
183                            return (com.liferay.portal.model.Country)returnObj;
184                    }
185                    catch (com.liferay.portal.kernel.exception.SystemException se) {
186                            _log.error(se, se);
187    
188                            throw se;
189                    }
190            }
191    
192            public static com.liferay.portal.model.Country getCountryByA2(
193                    HttpPrincipal httpPrincipal, java.lang.String a2)
194                    throws com.liferay.portal.kernel.exception.PortalException,
195                            com.liferay.portal.kernel.exception.SystemException {
196                    try {
197                            MethodKey methodKey = new MethodKey(CountryServiceUtil.class.getName(),
198                                            "getCountryByA2", _getCountryByA2ParameterTypes4);
199    
200                            MethodHandler methodHandler = new MethodHandler(methodKey, a2);
201    
202                            Object returnObj = null;
203    
204                            try {
205                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
206                            }
207                            catch (Exception e) {
208                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
209                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
210                                    }
211    
212                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
213                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
214                                    }
215    
216                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
217                            }
218    
219                            return (com.liferay.portal.model.Country)returnObj;
220                    }
221                    catch (com.liferay.portal.kernel.exception.SystemException se) {
222                            _log.error(se, se);
223    
224                            throw se;
225                    }
226            }
227    
228            public static com.liferay.portal.model.Country getCountryByA3(
229                    HttpPrincipal httpPrincipal, java.lang.String a3)
230                    throws com.liferay.portal.kernel.exception.PortalException,
231                            com.liferay.portal.kernel.exception.SystemException {
232                    try {
233                            MethodKey methodKey = new MethodKey(CountryServiceUtil.class.getName(),
234                                            "getCountryByA3", _getCountryByA3ParameterTypes5);
235    
236                            MethodHandler methodHandler = new MethodHandler(methodKey, a3);
237    
238                            Object returnObj = null;
239    
240                            try {
241                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
242                            }
243                            catch (Exception e) {
244                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
245                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
246                                    }
247    
248                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
249                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
250                                    }
251    
252                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
253                            }
254    
255                            return (com.liferay.portal.model.Country)returnObj;
256                    }
257                    catch (com.liferay.portal.kernel.exception.SystemException se) {
258                            _log.error(se, se);
259    
260                            throw se;
261                    }
262            }
263    
264            public static com.liferay.portal.model.Country getCountryByName(
265                    HttpPrincipal httpPrincipal, java.lang.String name)
266                    throws com.liferay.portal.kernel.exception.PortalException,
267                            com.liferay.portal.kernel.exception.SystemException {
268                    try {
269                            MethodKey methodKey = new MethodKey(CountryServiceUtil.class.getName(),
270                                            "getCountryByName", _getCountryByNameParameterTypes6);
271    
272                            MethodHandler methodHandler = new MethodHandler(methodKey, name);
273    
274                            Object returnObj = null;
275    
276                            try {
277                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
278                            }
279                            catch (Exception e) {
280                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
281                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
282                                    }
283    
284                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
285                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
286                                    }
287    
288                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
289                            }
290    
291                            return (com.liferay.portal.model.Country)returnObj;
292                    }
293                    catch (com.liferay.portal.kernel.exception.SystemException se) {
294                            _log.error(se, se);
295    
296                            throw se;
297                    }
298            }
299    
300            private static Log _log = LogFactoryUtil.getLog(CountryServiceHttp.class);
301            private static final Class<?>[] _addCountryParameterTypes0 = new Class[] {
302                            java.lang.String.class, java.lang.String.class,
303                            java.lang.String.class, java.lang.String.class,
304                            java.lang.String.class, boolean.class
305                    };
306            private static final Class<?>[] _getCountriesParameterTypes1 = new Class[] {  };
307            private static final Class<?>[] _getCountriesParameterTypes2 = new Class[] {
308                            boolean.class
309                    };
310            private static final Class<?>[] _getCountryParameterTypes3 = new Class[] {
311                            long.class
312                    };
313            private static final Class<?>[] _getCountryByA2ParameterTypes4 = new Class[] {
314                            java.lang.String.class
315                    };
316            private static final Class<?>[] _getCountryByA3ParameterTypes5 = new Class[] {
317                            java.lang.String.class
318                    };
319            private static final Class<?>[] _getCountryByNameParameterTypes6 = new Class[] {
320                            java.lang.String.class
321                    };
322    }