1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
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.BooleanWrapper;
20  import com.liferay.portal.kernel.util.LongWrapper;
21  import com.liferay.portal.kernel.util.MethodWrapper;
22  import com.liferay.portal.kernel.util.NullWrapper;
23  import com.liferay.portal.security.auth.HttpPrincipal;
24  import com.liferay.portal.service.CountryServiceUtil;
25  
26  /**
27   * <a href="CountryServiceHttp.java.html"><b><i>View Source</i></b></a>
28   *
29   * <p>
30   * ServiceBuilder generated this class. Modifications in this class will be
31   * overwritten the next time is generated.
32   * </p>
33   *
34   * <p>
35   * This class provides a HTTP utility for the
36   * {@link com.liferay.portal.service.CountryServiceUtil} service utility. The
37   * static methods of this class calls the same methods of the service utility.
38   * However, the signatures are different because it requires an additional
39   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
40   * </p>
41   *
42   * <p>
43   * The benefits of using the HTTP utility is that it is fast and allows for
44   * tunneling without the cost of serializing to text. The drawback is that it
45   * only works with Java.
46   * </p>
47   *
48   * <p>
49   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
50   * configure security.
51   * </p>
52   *
53   * <p>
54   * The HTTP utility is only generated for remote services.
55   * </p>
56   *
57   * @author    Brian Wing Shun Chan
58   * @see       CountryServiceSoap
59   * @see       com.liferay.portal.security.auth.HttpPrincipal
60   * @see       com.liferay.portal.service.CountryServiceUtil
61   * @generated
62   */
63  public class CountryServiceHttp {
64      public static com.liferay.portal.model.Country addCountry(
65          HttpPrincipal httpPrincipal, java.lang.String name,
66          java.lang.String a2, java.lang.String a3, java.lang.String number,
67          java.lang.String idd, boolean active)
68          throws com.liferay.portal.kernel.exception.PortalException,
69              com.liferay.portal.kernel.exception.SystemException {
70          try {
71              Object paramObj0 = name;
72  
73              if (name == null) {
74                  paramObj0 = new NullWrapper("java.lang.String");
75              }
76  
77              Object paramObj1 = a2;
78  
79              if (a2 == null) {
80                  paramObj1 = new NullWrapper("java.lang.String");
81              }
82  
83              Object paramObj2 = a3;
84  
85              if (a3 == null) {
86                  paramObj2 = new NullWrapper("java.lang.String");
87              }
88  
89              Object paramObj3 = number;
90  
91              if (number == null) {
92                  paramObj3 = new NullWrapper("java.lang.String");
93              }
94  
95              Object paramObj4 = idd;
96  
97              if (idd == null) {
98                  paramObj4 = new NullWrapper("java.lang.String");
99              }
100 
101             Object paramObj5 = new BooleanWrapper(active);
102 
103             MethodWrapper methodWrapper = new MethodWrapper(CountryServiceUtil.class.getName(),
104                     "addCountry",
105                     new Object[] {
106                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
107                         paramObj5
108                     });
109 
110             Object returnObj = null;
111 
112             try {
113                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
114             }
115             catch (Exception e) {
116                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
117                     throw (com.liferay.portal.kernel.exception.PortalException)e;
118                 }
119 
120                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
121                     throw (com.liferay.portal.kernel.exception.SystemException)e;
122                 }
123 
124                 throw new com.liferay.portal.kernel.exception.SystemException(e);
125             }
126 
127             return (com.liferay.portal.model.Country)returnObj;
128         }
129         catch (com.liferay.portal.kernel.exception.SystemException se) {
130             _log.error(se, se);
131 
132             throw se;
133         }
134     }
135 
136     public static java.util.List<com.liferay.portal.model.Country> getCountries(
137         HttpPrincipal httpPrincipal)
138         throws com.liferay.portal.kernel.exception.SystemException {
139         try {
140             MethodWrapper methodWrapper = new MethodWrapper(CountryServiceUtil.class.getName(),
141                     "getCountries", new Object[0]);
142 
143             Object returnObj = null;
144 
145             try {
146                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
147             }
148             catch (Exception e) {
149                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
150                     throw (com.liferay.portal.kernel.exception.SystemException)e;
151                 }
152 
153                 throw new com.liferay.portal.kernel.exception.SystemException(e);
154             }
155 
156             return (java.util.List<com.liferay.portal.model.Country>)returnObj;
157         }
158         catch (com.liferay.portal.kernel.exception.SystemException se) {
159             _log.error(se, se);
160 
161             throw se;
162         }
163     }
164 
165     public static java.util.List<com.liferay.portal.model.Country> getCountries(
166         HttpPrincipal httpPrincipal, boolean active)
167         throws com.liferay.portal.kernel.exception.SystemException {
168         try {
169             Object paramObj0 = new BooleanWrapper(active);
170 
171             MethodWrapper methodWrapper = new MethodWrapper(CountryServiceUtil.class.getName(),
172                     "getCountries", new Object[] { paramObj0 });
173 
174             Object returnObj = null;
175 
176             try {
177                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
178             }
179             catch (Exception e) {
180                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
181                     throw (com.liferay.portal.kernel.exception.SystemException)e;
182                 }
183 
184                 throw new com.liferay.portal.kernel.exception.SystemException(e);
185             }
186 
187             return (java.util.List<com.liferay.portal.model.Country>)returnObj;
188         }
189         catch (com.liferay.portal.kernel.exception.SystemException se) {
190             _log.error(se, se);
191 
192             throw se;
193         }
194     }
195 
196     public static com.liferay.portal.model.Country getCountry(
197         HttpPrincipal httpPrincipal, long countryId)
198         throws com.liferay.portal.kernel.exception.PortalException,
199             com.liferay.portal.kernel.exception.SystemException {
200         try {
201             Object paramObj0 = new LongWrapper(countryId);
202 
203             MethodWrapper methodWrapper = new MethodWrapper(CountryServiceUtil.class.getName(),
204                     "getCountry", new Object[] { paramObj0 });
205 
206             Object returnObj = null;
207 
208             try {
209                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
210             }
211             catch (Exception e) {
212                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
213                     throw (com.liferay.portal.kernel.exception.PortalException)e;
214                 }
215 
216                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
217                     throw (com.liferay.portal.kernel.exception.SystemException)e;
218                 }
219 
220                 throw new com.liferay.portal.kernel.exception.SystemException(e);
221             }
222 
223             return (com.liferay.portal.model.Country)returnObj;
224         }
225         catch (com.liferay.portal.kernel.exception.SystemException se) {
226             _log.error(se, se);
227 
228             throw se;
229         }
230     }
231 
232     public static com.liferay.portal.model.Country getCountryByA2(
233         HttpPrincipal httpPrincipal, java.lang.String a2)
234         throws com.liferay.portal.kernel.exception.PortalException,
235             com.liferay.portal.kernel.exception.SystemException {
236         try {
237             Object paramObj0 = a2;
238 
239             if (a2 == null) {
240                 paramObj0 = new NullWrapper("java.lang.String");
241             }
242 
243             MethodWrapper methodWrapper = new MethodWrapper(CountryServiceUtil.class.getName(),
244                     "getCountryByA2", new Object[] { paramObj0 });
245 
246             Object returnObj = null;
247 
248             try {
249                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
250             }
251             catch (Exception e) {
252                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
253                     throw (com.liferay.portal.kernel.exception.PortalException)e;
254                 }
255 
256                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
257                     throw (com.liferay.portal.kernel.exception.SystemException)e;
258                 }
259 
260                 throw new com.liferay.portal.kernel.exception.SystemException(e);
261             }
262 
263             return (com.liferay.portal.model.Country)returnObj;
264         }
265         catch (com.liferay.portal.kernel.exception.SystemException se) {
266             _log.error(se, se);
267 
268             throw se;
269         }
270     }
271 
272     public static com.liferay.portal.model.Country getCountryByA3(
273         HttpPrincipal httpPrincipal, java.lang.String a3)
274         throws com.liferay.portal.kernel.exception.PortalException,
275             com.liferay.portal.kernel.exception.SystemException {
276         try {
277             Object paramObj0 = a3;
278 
279             if (a3 == null) {
280                 paramObj0 = new NullWrapper("java.lang.String");
281             }
282 
283             MethodWrapper methodWrapper = new MethodWrapper(CountryServiceUtil.class.getName(),
284                     "getCountryByA3", new Object[] { paramObj0 });
285 
286             Object returnObj = null;
287 
288             try {
289                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
290             }
291             catch (Exception e) {
292                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
293                     throw (com.liferay.portal.kernel.exception.PortalException)e;
294                 }
295 
296                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
297                     throw (com.liferay.portal.kernel.exception.SystemException)e;
298                 }
299 
300                 throw new com.liferay.portal.kernel.exception.SystemException(e);
301             }
302 
303             return (com.liferay.portal.model.Country)returnObj;
304         }
305         catch (com.liferay.portal.kernel.exception.SystemException se) {
306             _log.error(se, se);
307 
308             throw se;
309         }
310     }
311 
312     public static com.liferay.portal.model.Country getCountryByName(
313         HttpPrincipal httpPrincipal, java.lang.String name)
314         throws com.liferay.portal.kernel.exception.PortalException,
315             com.liferay.portal.kernel.exception.SystemException {
316         try {
317             Object paramObj0 = name;
318 
319             if (name == null) {
320                 paramObj0 = new NullWrapper("java.lang.String");
321             }
322 
323             MethodWrapper methodWrapper = new MethodWrapper(CountryServiceUtil.class.getName(),
324                     "getCountryByName", new Object[] { paramObj0 });
325 
326             Object returnObj = null;
327 
328             try {
329                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
330             }
331             catch (Exception e) {
332                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
333                     throw (com.liferay.portal.kernel.exception.PortalException)e;
334                 }
335 
336                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
337                     throw (com.liferay.portal.kernel.exception.SystemException)e;
338                 }
339 
340                 throw new com.liferay.portal.kernel.exception.SystemException(e);
341             }
342 
343             return (com.liferay.portal.model.Country)returnObj;
344         }
345         catch (com.liferay.portal.kernel.exception.SystemException se) {
346             _log.error(se, se);
347 
348             throw se;
349         }
350     }
351 
352     private static Log _log = LogFactoryUtil.getLog(CountryServiceHttp.class);
353 }