1   /**
2    * Copyright (c) 2000-2008 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.SystemException,
79              com.liferay.portal.PortalException {
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.SystemException) {
127                     throw (com.liferay.portal.SystemException)e;
128                 }
129 
130                 if (e instanceof com.liferay.portal.PortalException) {
131                     throw (com.liferay.portal.PortalException)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.SystemException,
208             com.liferay.portal.PortalException {
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.SystemException) {
222                     throw (com.liferay.portal.SystemException)e;
223                 }
224 
225                 if (e instanceof com.liferay.portal.PortalException) {
226                     throw (com.liferay.portal.PortalException)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     private static Log _log = LogFactoryUtil.getLog(CountryServiceHttp.class);
242 }