1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.service.http;
16  
17  import com.liferay.portal.kernel.log.Log;
18  import com.liferay.portal.kernel.log.LogFactoryUtil;
19  import com.liferay.portal.kernel.util.MethodHandler;
20  import com.liferay.portal.kernel.util.MethodKey;
21  import com.liferay.portal.security.auth.HttpPrincipal;
22  import com.liferay.portal.service.CountryServiceUtil;
23  
24  /**
25   * <a href="CountryServiceHttp.java.html"><b><i>View Source</i></b></a>
26   *
27   * <p>
28   * ServiceBuilder generated this class. Modifications in this class will be
29   * overwritten the next time is generated.
30   * </p>
31   *
32   * <p>
33   * This class provides a HTTP utility for the
34   * {@link com.liferay.portal.service.CountryServiceUtil} service utility. The
35   * static methods of this class calls the same methods of the service utility.
36   * However, the signatures are different because it requires an additional
37   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
38   * </p>
39   *
40   * <p>
41   * The benefits of using the HTTP utility is that it is fast and allows for
42   * tunneling without the cost of serializing to text. The drawback is that it
43   * only works with Java.
44   * </p>
45   *
46   * <p>
47   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
48   * configure security.
49   * </p>
50   *
51   * <p>
52   * The HTTP utility is only generated for remote services.
53   * </p>
54   *
55   * @author    Brian Wing Shun Chan
56   * @see       CountryServiceSoap
57   * @see       com.liferay.portal.security.auth.HttpPrincipal
58   * @see       com.liferay.portal.service.CountryServiceUtil
59   * @generated
60   */
61  public class CountryServiceHttp {
62      public static com.liferay.portal.model.Country addCountry(
63          HttpPrincipal httpPrincipal, java.lang.String name,
64          java.lang.String a2, java.lang.String a3, java.lang.String number,
65          java.lang.String idd, boolean active)
66          throws com.liferay.portal.PortalException,
67              com.liferay.portal.SystemException {
68          try {
69              MethodKey methodKey = new MethodKey(CountryServiceUtil.class.getName(),
70                      "addCountry", _addCountryParameterTypes0);
71  
72              MethodHandler methodHandler = new MethodHandler(methodKey, name,
73                      a2, a3, number, idd, active);
74  
75              Object returnObj = null;
76  
77              try {
78                  returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
79              }
80              catch (Exception e) {
81                  if (e instanceof com.liferay.portal.PortalException) {
82                      throw (com.liferay.portal.PortalException)e;
83                  }
84  
85                  if (e instanceof com.liferay.portal.SystemException) {
86                      throw (com.liferay.portal.SystemException)e;
87                  }
88  
89                  throw new com.liferay.portal.SystemException(e);
90              }
91  
92              return (com.liferay.portal.model.Country)returnObj;
93          }
94          catch (com.liferay.portal.SystemException se) {
95              _log.error(se, se);
96  
97              throw se;
98          }
99      }
100 
101     public static java.util.List<com.liferay.portal.model.Country> getCountries(
102         HttpPrincipal httpPrincipal) throws com.liferay.portal.SystemException {
103         try {
104             MethodKey methodKey = new MethodKey(CountryServiceUtil.class.getName(),
105                     "getCountries", _getCountriesParameterTypes1);
106 
107             MethodHandler methodHandler = new MethodHandler(methodKey);
108 
109             Object returnObj = null;
110 
111             try {
112                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
113             }
114             catch (Exception e) {
115                 if (e instanceof com.liferay.portal.SystemException) {
116                     throw (com.liferay.portal.SystemException)e;
117                 }
118 
119                 throw new com.liferay.portal.SystemException(e);
120             }
121 
122             return (java.util.List<com.liferay.portal.model.Country>)returnObj;
123         }
124         catch (com.liferay.portal.SystemException se) {
125             _log.error(se, se);
126 
127             throw se;
128         }
129     }
130 
131     public static java.util.List<com.liferay.portal.model.Country> getCountries(
132         HttpPrincipal httpPrincipal, boolean active)
133         throws com.liferay.portal.SystemException {
134         try {
135             MethodKey methodKey = new MethodKey(CountryServiceUtil.class.getName(),
136                     "getCountries", _getCountriesParameterTypes2);
137 
138             MethodHandler methodHandler = new MethodHandler(methodKey, active);
139 
140             Object returnObj = null;
141 
142             try {
143                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
144             }
145             catch (Exception e) {
146                 if (e instanceof com.liferay.portal.SystemException) {
147                     throw (com.liferay.portal.SystemException)e;
148                 }
149 
150                 throw new com.liferay.portal.SystemException(e);
151             }
152 
153             return (java.util.List<com.liferay.portal.model.Country>)returnObj;
154         }
155         catch (com.liferay.portal.SystemException se) {
156             _log.error(se, se);
157 
158             throw se;
159         }
160     }
161 
162     public static com.liferay.portal.model.Country getCountry(
163         HttpPrincipal httpPrincipal, long countryId)
164         throws com.liferay.portal.PortalException,
165             com.liferay.portal.SystemException {
166         try {
167             MethodKey methodKey = new MethodKey(CountryServiceUtil.class.getName(),
168                     "getCountry", _getCountryParameterTypes3);
169 
170             MethodHandler methodHandler = new MethodHandler(methodKey, countryId);
171 
172             Object returnObj = null;
173 
174             try {
175                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
176             }
177             catch (Exception e) {
178                 if (e instanceof com.liferay.portal.PortalException) {
179                     throw (com.liferay.portal.PortalException)e;
180                 }
181 
182                 if (e instanceof com.liferay.portal.SystemException) {
183                     throw (com.liferay.portal.SystemException)e;
184                 }
185 
186                 throw new com.liferay.portal.SystemException(e);
187             }
188 
189             return (com.liferay.portal.model.Country)returnObj;
190         }
191         catch (com.liferay.portal.SystemException se) {
192             _log.error(se, se);
193 
194             throw se;
195         }
196     }
197 
198     public static com.liferay.portal.model.Country getCountryByA2(
199         HttpPrincipal httpPrincipal, java.lang.String a2)
200         throws com.liferay.portal.PortalException,
201             com.liferay.portal.SystemException {
202         try {
203             MethodKey methodKey = new MethodKey(CountryServiceUtil.class.getName(),
204                     "getCountryByA2", _getCountryByA2ParameterTypes4);
205 
206             MethodHandler methodHandler = new MethodHandler(methodKey, a2);
207 
208             Object returnObj = null;
209 
210             try {
211                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
212             }
213             catch (Exception e) {
214                 if (e instanceof com.liferay.portal.PortalException) {
215                     throw (com.liferay.portal.PortalException)e;
216                 }
217 
218                 if (e instanceof com.liferay.portal.SystemException) {
219                     throw (com.liferay.portal.SystemException)e;
220                 }
221 
222                 throw new com.liferay.portal.SystemException(e);
223             }
224 
225             return (com.liferay.portal.model.Country)returnObj;
226         }
227         catch (com.liferay.portal.SystemException se) {
228             _log.error(se, se);
229 
230             throw se;
231         }
232     }
233 
234     public static com.liferay.portal.model.Country getCountryByA3(
235         HttpPrincipal httpPrincipal, java.lang.String a3)
236         throws com.liferay.portal.PortalException,
237             com.liferay.portal.SystemException {
238         try {
239             MethodKey methodKey = new MethodKey(CountryServiceUtil.class.getName(),
240                     "getCountryByA3", _getCountryByA3ParameterTypes5);
241 
242             MethodHandler methodHandler = new MethodHandler(methodKey, a3);
243 
244             Object returnObj = null;
245 
246             try {
247                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
248             }
249             catch (Exception e) {
250                 if (e instanceof com.liferay.portal.PortalException) {
251                     throw (com.liferay.portal.PortalException)e;
252                 }
253 
254                 if (e instanceof com.liferay.portal.SystemException) {
255                     throw (com.liferay.portal.SystemException)e;
256                 }
257 
258                 throw new com.liferay.portal.SystemException(e);
259             }
260 
261             return (com.liferay.portal.model.Country)returnObj;
262         }
263         catch (com.liferay.portal.SystemException se) {
264             _log.error(se, se);
265 
266             throw se;
267         }
268     }
269 
270     public static com.liferay.portal.model.Country getCountryByName(
271         HttpPrincipal httpPrincipal, java.lang.String name)
272         throws com.liferay.portal.PortalException,
273             com.liferay.portal.SystemException {
274         try {
275             MethodKey methodKey = new MethodKey(CountryServiceUtil.class.getName(),
276                     "getCountryByName", _getCountryByNameParameterTypes6);
277 
278             MethodHandler methodHandler = new MethodHandler(methodKey, name);
279 
280             Object returnObj = null;
281 
282             try {
283                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
284             }
285             catch (Exception e) {
286                 if (e instanceof com.liferay.portal.PortalException) {
287                     throw (com.liferay.portal.PortalException)e;
288                 }
289 
290                 if (e instanceof com.liferay.portal.SystemException) {
291                     throw (com.liferay.portal.SystemException)e;
292                 }
293 
294                 throw new com.liferay.portal.SystemException(e);
295             }
296 
297             return (com.liferay.portal.model.Country)returnObj;
298         }
299         catch (com.liferay.portal.SystemException se) {
300             _log.error(se, se);
301 
302             throw se;
303         }
304     }
305 
306     private static Log _log = LogFactoryUtil.getLog(CountryServiceHttp.class);
307     private static final Class<?>[] _addCountryParameterTypes0 = new Class[] {
308             java.lang.String.class, java.lang.String.class,
309             java.lang.String.class, java.lang.String.class,
310             java.lang.String.class, boolean.class
311         };
312     private static final Class<?>[] _getCountriesParameterTypes1 = new Class[] {  };
313     private static final Class<?>[] _getCountriesParameterTypes2 = new Class[] {
314             boolean.class
315         };
316     private static final Class<?>[] _getCountryParameterTypes3 = new Class[] {
317             long.class
318         };
319     private static final Class<?>[] _getCountryByA2ParameterTypes4 = new Class[] {
320             java.lang.String.class
321         };
322     private static final Class<?>[] _getCountryByA3ParameterTypes5 = new Class[] {
323             java.lang.String.class
324         };
325     private static final Class<?>[] _getCountryByNameParameterTypes6 = new Class[] {
326             java.lang.String.class
327         };
328 }