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