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