1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.service.http;
24  
25  import com.liferay.portal.kernel.log.Log;
26  import com.liferay.portal.kernel.log.LogFactoryUtil;
27  import com.liferay.portal.kernel.util.BooleanWrapper;
28  import com.liferay.portal.kernel.util.LongWrapper;
29  import com.liferay.portal.kernel.util.MethodWrapper;
30  import com.liferay.portal.kernel.util.NullWrapper;
31  import com.liferay.portal.security.auth.HttpPrincipal;
32  import com.liferay.portal.service.CountryServiceUtil;
33  
34  /**
35   * <a href="CountryServiceHttp.java.html"><b><i>View Source</i></b></a>
36   *
37   * <p>
38   * ServiceBuilder generated this class. Modifications in this class will be
39   * overwritten the next time is generated.
40   * </p>
41   *
42   * <p>
43   * This class provides a HTTP utility for the
44   * <code>com.liferay.portal.service.CountryServiceUtil</code> service
45   * utility. The static methods of this class calls the same methods of the
46   * service utility. However, the signatures are different because it requires an
47   * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code>
48   * parameter.
49   * </p>
50   *
51   * <p>
52   * The benefits of using the HTTP utility is that it is fast and allows for
53   * tunneling without the cost of serializing to text. The drawback is that it
54   * only works with Java.
55   * </p>
56   *
57   * <p>
58   * Set the property <code>tunnel.servlet.hosts.allowed</code> in
59   * portal.properties to configure security.
60   * </p>
61   *
62   * <p>
63   * The HTTP utility is only generated for remote services.
64   * </p>
65   *
66   * @author Brian Wing Shun Chan
67   *
68   * @see com.liferay.portal.security.auth.HttpPrincipal
69   * @see com.liferay.portal.service.CountryServiceUtil
70   * @see com.liferay.portal.service.http.CountryServiceSoap
71   *
72   */
73  public class CountryServiceHttp {
74      public static com.liferay.portal.model.Country addCountry(
75          HttpPrincipal httpPrincipal, java.lang.String name,
76          java.lang.String a2, java.lang.String a3, java.lang.String number,
77          java.lang.String idd, boolean active)
78          throws com.liferay.portal.PortalException,
79              com.liferay.portal.SystemException {
80          try {
81              Object paramObj0 = name;
82  
83              if (name == null) {
84                  paramObj0 = new NullWrapper("java.lang.String");
85              }
86  
87              Object paramObj1 = a2;
88  
89              if (a2 == null) {
90                  paramObj1 = new NullWrapper("java.lang.String");
91              }
92  
93              Object paramObj2 = a3;
94  
95              if (a3 == null) {
96                  paramObj2 = new NullWrapper("java.lang.String");
97              }
98  
99              Object paramObj3 = number;
100 
101             if (number == null) {
102                 paramObj3 = new NullWrapper("java.lang.String");
103             }
104 
105             Object paramObj4 = idd;
106 
107             if (idd == null) {
108                 paramObj4 = new NullWrapper("java.lang.String");
109             }
110 
111             Object paramObj5 = new BooleanWrapper(active);
112 
113             MethodWrapper methodWrapper = new MethodWrapper(CountryServiceUtil.class.getName(),
114                     "addCountry",
115                     new Object[] {
116                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
117                         paramObj5
118                     });
119 
120             Object returnObj = null;
121 
122             try {
123                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
124             }
125             catch (Exception e) {
126                 if (e instanceof com.liferay.portal.PortalException) {
127                     throw (com.liferay.portal.PortalException)e;
128                 }
129 
130                 if (e instanceof com.liferay.portal.SystemException) {
131                     throw (com.liferay.portal.SystemException)e;
132                 }
133 
134                 throw new com.liferay.portal.SystemException(e);
135             }
136 
137             return (com.liferay.portal.model.Country)returnObj;
138         }
139         catch (com.liferay.portal.SystemException se) {
140             _log.error(se, se);
141 
142             throw se;
143         }
144     }
145 
146     public static java.util.List<com.liferay.portal.model.Country> getCountries(
147         HttpPrincipal httpPrincipal) throws com.liferay.portal.SystemException {
148         try {
149             MethodWrapper methodWrapper = new MethodWrapper(CountryServiceUtil.class.getName(),
150                     "getCountries", new Object[0]);
151 
152             Object returnObj = null;
153 
154             try {
155                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
156             }
157             catch (Exception e) {
158                 if (e instanceof com.liferay.portal.SystemException) {
159                     throw (com.liferay.portal.SystemException)e;
160                 }
161 
162                 throw new com.liferay.portal.SystemException(e);
163             }
164 
165             return (java.util.List<com.liferay.portal.model.Country>)returnObj;
166         }
167         catch (com.liferay.portal.SystemException se) {
168             _log.error(se, se);
169 
170             throw se;
171         }
172     }
173 
174     public static java.util.List<com.liferay.portal.model.Country> getCountries(
175         HttpPrincipal httpPrincipal, boolean active)
176         throws com.liferay.portal.SystemException {
177         try {
178             Object paramObj0 = new BooleanWrapper(active);
179 
180             MethodWrapper methodWrapper = new MethodWrapper(CountryServiceUtil.class.getName(),
181                     "getCountries", new Object[] { paramObj0 });
182 
183             Object returnObj = null;
184 
185             try {
186                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
187             }
188             catch (Exception e) {
189                 if (e instanceof com.liferay.portal.SystemException) {
190                     throw (com.liferay.portal.SystemException)e;
191                 }
192 
193                 throw new com.liferay.portal.SystemException(e);
194             }
195 
196             return (java.util.List<com.liferay.portal.model.Country>)returnObj;
197         }
198         catch (com.liferay.portal.SystemException se) {
199             _log.error(se, se);
200 
201             throw se;
202         }
203     }
204 
205     public static com.liferay.portal.model.Country getCountry(
206         HttpPrincipal httpPrincipal, long countryId)
207         throws com.liferay.portal.PortalException,
208             com.liferay.portal.SystemException {
209         try {
210             Object paramObj0 = new LongWrapper(countryId);
211 
212             MethodWrapper methodWrapper = new MethodWrapper(CountryServiceUtil.class.getName(),
213                     "getCountry", new Object[] { paramObj0 });
214 
215             Object returnObj = null;
216 
217             try {
218                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
219             }
220             catch (Exception e) {
221                 if (e instanceof com.liferay.portal.PortalException) {
222                     throw (com.liferay.portal.PortalException)e;
223                 }
224 
225                 if (e instanceof com.liferay.portal.SystemException) {
226                     throw (com.liferay.portal.SystemException)e;
227                 }
228 
229                 throw new com.liferay.portal.SystemException(e);
230             }
231 
232             return (com.liferay.portal.model.Country)returnObj;
233         }
234         catch (com.liferay.portal.SystemException se) {
235             _log.error(se, se);
236 
237             throw se;
238         }
239     }
240 
241     public static com.liferay.portal.model.Country getCountryByA2(
242         HttpPrincipal httpPrincipal, java.lang.String a2)
243         throws com.liferay.portal.PortalException,
244             com.liferay.portal.SystemException {
245         try {
246             Object paramObj0 = a2;
247 
248             if (a2 == null) {
249                 paramObj0 = new NullWrapper("java.lang.String");
250             }
251 
252             MethodWrapper methodWrapper = new MethodWrapper(CountryServiceUtil.class.getName(),
253                     "getCountryByA2", new Object[] { paramObj0 });
254 
255             Object returnObj = null;
256 
257             try {
258                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
259             }
260             catch (Exception e) {
261                 if (e instanceof com.liferay.portal.PortalException) {
262                     throw (com.liferay.portal.PortalException)e;
263                 }
264 
265                 if (e instanceof com.liferay.portal.SystemException) {
266                     throw (com.liferay.portal.SystemException)e;
267                 }
268 
269                 throw new com.liferay.portal.SystemException(e);
270             }
271 
272             return (com.liferay.portal.model.Country)returnObj;
273         }
274         catch (com.liferay.portal.SystemException se) {
275             _log.error(se, se);
276 
277             throw se;
278         }
279     }
280 
281     public static com.liferay.portal.model.Country getCountryByA3(
282         HttpPrincipal httpPrincipal, java.lang.String a3)
283         throws com.liferay.portal.PortalException,
284             com.liferay.portal.SystemException {
285         try {
286             Object paramObj0 = a3;
287 
288             if (a3 == null) {
289                 paramObj0 = new NullWrapper("java.lang.String");
290             }
291 
292             MethodWrapper methodWrapper = new MethodWrapper(CountryServiceUtil.class.getName(),
293                     "getCountryByA3", new Object[] { paramObj0 });
294 
295             Object returnObj = null;
296 
297             try {
298                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
299             }
300             catch (Exception e) {
301                 if (e instanceof com.liferay.portal.PortalException) {
302                     throw (com.liferay.portal.PortalException)e;
303                 }
304 
305                 if (e instanceof com.liferay.portal.SystemException) {
306                     throw (com.liferay.portal.SystemException)e;
307                 }
308 
309                 throw new com.liferay.portal.SystemException(e);
310             }
311 
312             return (com.liferay.portal.model.Country)returnObj;
313         }
314         catch (com.liferay.portal.SystemException se) {
315             _log.error(se, se);
316 
317             throw se;
318         }
319     }
320 
321     public static com.liferay.portal.model.Country getCountryByName(
322         HttpPrincipal httpPrincipal, java.lang.String name)
323         throws com.liferay.portal.PortalException,
324             com.liferay.portal.SystemException {
325         try {
326             Object paramObj0 = name;
327 
328             if (name == null) {
329                 paramObj0 = new NullWrapper("java.lang.String");
330             }
331 
332             MethodWrapper methodWrapper = new MethodWrapper(CountryServiceUtil.class.getName(),
333                     "getCountryByName", new Object[] { paramObj0 });
334 
335             Object returnObj = null;
336 
337             try {
338                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
339             }
340             catch (Exception e) {
341                 if (e instanceof com.liferay.portal.PortalException) {
342                     throw (com.liferay.portal.PortalException)e;
343                 }
344 
345                 if (e instanceof com.liferay.portal.SystemException) {
346                     throw (com.liferay.portal.SystemException)e;
347                 }
348 
349                 throw new com.liferay.portal.SystemException(e);
350             }
351 
352             return (com.liferay.portal.model.Country)returnObj;
353         }
354         catch (com.liferay.portal.SystemException se) {
355             _log.error(se, se);
356 
357             throw se;
358         }
359     }
360 
361     private static Log _log = LogFactoryUtil.getLog(CountryServiceHttp.class);
362 }