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.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.PortalException,
69              com.liferay.portal.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.PortalException) {
117                     throw (com.liferay.portal.PortalException)e;
118                 }
119 
120                 if (e instanceof com.liferay.portal.SystemException) {
121                     throw (com.liferay.portal.SystemException)e;
122                 }
123 
124                 throw new com.liferay.portal.SystemException(e);
125             }
126 
127             return (com.liferay.portal.model.Country)returnObj;
128         }
129         catch (com.liferay.portal.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) throws com.liferay.portal.SystemException {
138         try {
139             MethodWrapper methodWrapper = new MethodWrapper(CountryServiceUtil.class.getName(),
140                     "getCountries", new Object[0]);
141 
142             Object returnObj = null;
143 
144             try {
145                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
146             }
147             catch (Exception e) {
148                 if (e instanceof com.liferay.portal.SystemException) {
149                     throw (com.liferay.portal.SystemException)e;
150                 }
151 
152                 throw new com.liferay.portal.SystemException(e);
153             }
154 
155             return (java.util.List<com.liferay.portal.model.Country>)returnObj;
156         }
157         catch (com.liferay.portal.SystemException se) {
158             _log.error(se, se);
159 
160             throw se;
161         }
162     }
163 
164     public static java.util.List<com.liferay.portal.model.Country> getCountries(
165         HttpPrincipal httpPrincipal, boolean active)
166         throws com.liferay.portal.SystemException {
167         try {
168             Object paramObj0 = new BooleanWrapper(active);
169 
170             MethodWrapper methodWrapper = new MethodWrapper(CountryServiceUtil.class.getName(),
171                     "getCountries", new Object[] { paramObj0 });
172 
173             Object returnObj = null;
174 
175             try {
176                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
177             }
178             catch (Exception e) {
179                 if (e instanceof com.liferay.portal.SystemException) {
180                     throw (com.liferay.portal.SystemException)e;
181                 }
182 
183                 throw new com.liferay.portal.SystemException(e);
184             }
185 
186             return (java.util.List<com.liferay.portal.model.Country>)returnObj;
187         }
188         catch (com.liferay.portal.SystemException se) {
189             _log.error(se, se);
190 
191             throw se;
192         }
193     }
194 
195     public static com.liferay.portal.model.Country getCountry(
196         HttpPrincipal httpPrincipal, long countryId)
197         throws com.liferay.portal.PortalException,
198             com.liferay.portal.SystemException {
199         try {
200             Object paramObj0 = new LongWrapper(countryId);
201 
202             MethodWrapper methodWrapper = new MethodWrapper(CountryServiceUtil.class.getName(),
203                     "getCountry", new Object[] { paramObj0 });
204 
205             Object returnObj = null;
206 
207             try {
208                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
209             }
210             catch (Exception e) {
211                 if (e instanceof com.liferay.portal.PortalException) {
212                     throw (com.liferay.portal.PortalException)e;
213                 }
214 
215                 if (e instanceof com.liferay.portal.SystemException) {
216                     throw (com.liferay.portal.SystemException)e;
217                 }
218 
219                 throw new com.liferay.portal.SystemException(e);
220             }
221 
222             return (com.liferay.portal.model.Country)returnObj;
223         }
224         catch (com.liferay.portal.SystemException se) {
225             _log.error(se, se);
226 
227             throw se;
228         }
229     }
230 
231     public static com.liferay.portal.model.Country getCountryByA2(
232         HttpPrincipal httpPrincipal, java.lang.String a2)
233         throws com.liferay.portal.PortalException,
234             com.liferay.portal.SystemException {
235         try {
236             Object paramObj0 = a2;
237 
238             if (a2 == null) {
239                 paramObj0 = new NullWrapper("java.lang.String");
240             }
241 
242             MethodWrapper methodWrapper = new MethodWrapper(CountryServiceUtil.class.getName(),
243                     "getCountryByA2", new Object[] { paramObj0 });
244 
245             Object returnObj = null;
246 
247             try {
248                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
249             }
250             catch (Exception e) {
251                 if (e instanceof com.liferay.portal.PortalException) {
252                     throw (com.liferay.portal.PortalException)e;
253                 }
254 
255                 if (e instanceof com.liferay.portal.SystemException) {
256                     throw (com.liferay.portal.SystemException)e;
257                 }
258 
259                 throw new com.liferay.portal.SystemException(e);
260             }
261 
262             return (com.liferay.portal.model.Country)returnObj;
263         }
264         catch (com.liferay.portal.SystemException se) {
265             _log.error(se, se);
266 
267             throw se;
268         }
269     }
270 
271     public static com.liferay.portal.model.Country getCountryByA3(
272         HttpPrincipal httpPrincipal, java.lang.String a3)
273         throws com.liferay.portal.PortalException,
274             com.liferay.portal.SystemException {
275         try {
276             Object paramObj0 = a3;
277 
278             if (a3 == null) {
279                 paramObj0 = new NullWrapper("java.lang.String");
280             }
281 
282             MethodWrapper methodWrapper = new MethodWrapper(CountryServiceUtil.class.getName(),
283                     "getCountryByA3", new Object[] { paramObj0 });
284 
285             Object returnObj = null;
286 
287             try {
288                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
289             }
290             catch (Exception e) {
291                 if (e instanceof com.liferay.portal.PortalException) {
292                     throw (com.liferay.portal.PortalException)e;
293                 }
294 
295                 if (e instanceof com.liferay.portal.SystemException) {
296                     throw (com.liferay.portal.SystemException)e;
297                 }
298 
299                 throw new com.liferay.portal.SystemException(e);
300             }
301 
302             return (com.liferay.portal.model.Country)returnObj;
303         }
304         catch (com.liferay.portal.SystemException se) {
305             _log.error(se, se);
306 
307             throw se;
308         }
309     }
310 
311     public static com.liferay.portal.model.Country getCountryByName(
312         HttpPrincipal httpPrincipal, java.lang.String name)
313         throws com.liferay.portal.PortalException,
314             com.liferay.portal.SystemException {
315         try {
316             Object paramObj0 = name;
317 
318             if (name == null) {
319                 paramObj0 = new NullWrapper("java.lang.String");
320             }
321 
322             MethodWrapper methodWrapper = new MethodWrapper(CountryServiceUtil.class.getName(),
323                     "getCountryByName", new Object[] { paramObj0 });
324 
325             Object returnObj = null;
326 
327             try {
328                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
329             }
330             catch (Exception e) {
331                 if (e instanceof com.liferay.portal.PortalException) {
332                     throw (com.liferay.portal.PortalException)e;
333                 }
334 
335                 if (e instanceof com.liferay.portal.SystemException) {
336                     throw (com.liferay.portal.SystemException)e;
337                 }
338 
339                 throw new com.liferay.portal.SystemException(e);
340             }
341 
342             return (com.liferay.portal.model.Country)returnObj;
343         }
344         catch (com.liferay.portal.SystemException se) {
345             _log.error(se, se);
346 
347             throw se;
348         }
349     }
350 
351     private static Log _log = LogFactoryUtil.getLog(CountryServiceHttp.class);
352 }