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.MethodHandler;
20  import com.liferay.portal.kernel.util.MethodKey;
21  import com.liferay.portal.security.auth.HttpPrincipal;
22  import com.liferay.portal.service.RegionServiceUtil;
23  
24  /**
25   * <a href="RegionServiceHttp.java.html"><b><i>View Source</i></b></a>
26   *
27   * <p>
28   * ServiceBuilder generated this class. Modifications in this class will be
29   * overwritten the next time is generated.
30   * </p>
31   *
32   * <p>
33   * This class provides a HTTP utility for the
34   * {@link com.liferay.portal.service.RegionServiceUtil} service utility. The
35   * static methods of this class calls the same methods of the service utility.
36   * However, the signatures are different because it requires an additional
37   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
38   * </p>
39   *
40   * <p>
41   * The benefits of using the HTTP utility is that it is fast and allows for
42   * tunneling without the cost of serializing to text. The drawback is that it
43   * only works with Java.
44   * </p>
45   *
46   * <p>
47   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
48   * configure security.
49   * </p>
50   *
51   * <p>
52   * The HTTP utility is only generated for remote services.
53   * </p>
54   *
55   * @author    Brian Wing Shun Chan
56   * @see       RegionServiceSoap
57   * @see       com.liferay.portal.security.auth.HttpPrincipal
58   * @see       com.liferay.portal.service.RegionServiceUtil
59   * @generated
60   */
61  public class RegionServiceHttp {
62      public static com.liferay.portal.model.Region addRegion(
63          HttpPrincipal httpPrincipal, long countryId,
64          java.lang.String regionCode, java.lang.String name, boolean active)
65          throws com.liferay.portal.PortalException,
66              com.liferay.portal.SystemException {
67          try {
68              MethodKey methodKey = new MethodKey(RegionServiceUtil.class.getName(),
69                      "addRegion", _addRegionParameterTypes0);
70  
71              MethodHandler methodHandler = new MethodHandler(methodKey,
72                      countryId, regionCode, name, active);
73  
74              Object returnObj = null;
75  
76              try {
77                  returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
78              }
79              catch (Exception e) {
80                  if (e instanceof com.liferay.portal.PortalException) {
81                      throw (com.liferay.portal.PortalException)e;
82                  }
83  
84                  if (e instanceof com.liferay.portal.SystemException) {
85                      throw (com.liferay.portal.SystemException)e;
86                  }
87  
88                  throw new com.liferay.portal.SystemException(e);
89              }
90  
91              return (com.liferay.portal.model.Region)returnObj;
92          }
93          catch (com.liferay.portal.SystemException se) {
94              _log.error(se, se);
95  
96              throw se;
97          }
98      }
99  
100     public static java.util.List<com.liferay.portal.model.Region> getRegions(
101         HttpPrincipal httpPrincipal) throws com.liferay.portal.SystemException {
102         try {
103             MethodKey methodKey = new MethodKey(RegionServiceUtil.class.getName(),
104                     "getRegions", _getRegionsParameterTypes1);
105 
106             MethodHandler methodHandler = new MethodHandler(methodKey);
107 
108             Object returnObj = null;
109 
110             try {
111                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
112             }
113             catch (Exception e) {
114                 if (e instanceof com.liferay.portal.SystemException) {
115                     throw (com.liferay.portal.SystemException)e;
116                 }
117 
118                 throw new com.liferay.portal.SystemException(e);
119             }
120 
121             return (java.util.List<com.liferay.portal.model.Region>)returnObj;
122         }
123         catch (com.liferay.portal.SystemException se) {
124             _log.error(se, se);
125 
126             throw se;
127         }
128     }
129 
130     public static java.util.List<com.liferay.portal.model.Region> getRegions(
131         HttpPrincipal httpPrincipal, long countryId)
132         throws com.liferay.portal.SystemException {
133         try {
134             MethodKey methodKey = new MethodKey(RegionServiceUtil.class.getName(),
135                     "getRegions", _getRegionsParameterTypes2);
136 
137             MethodHandler methodHandler = new MethodHandler(methodKey, countryId);
138 
139             Object returnObj = null;
140 
141             try {
142                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
143             }
144             catch (Exception e) {
145                 if (e instanceof com.liferay.portal.SystemException) {
146                     throw (com.liferay.portal.SystemException)e;
147                 }
148 
149                 throw new com.liferay.portal.SystemException(e);
150             }
151 
152             return (java.util.List<com.liferay.portal.model.Region>)returnObj;
153         }
154         catch (com.liferay.portal.SystemException se) {
155             _log.error(se, se);
156 
157             throw se;
158         }
159     }
160 
161     public static java.util.List<com.liferay.portal.model.Region> getRegions(
162         HttpPrincipal httpPrincipal, boolean active)
163         throws com.liferay.portal.SystemException {
164         try {
165             MethodKey methodKey = new MethodKey(RegionServiceUtil.class.getName(),
166                     "getRegions", _getRegionsParameterTypes3);
167 
168             MethodHandler methodHandler = new MethodHandler(methodKey, active);
169 
170             Object returnObj = null;
171 
172             try {
173                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
174             }
175             catch (Exception e) {
176                 if (e instanceof com.liferay.portal.SystemException) {
177                     throw (com.liferay.portal.SystemException)e;
178                 }
179 
180                 throw new com.liferay.portal.SystemException(e);
181             }
182 
183             return (java.util.List<com.liferay.portal.model.Region>)returnObj;
184         }
185         catch (com.liferay.portal.SystemException se) {
186             _log.error(se, se);
187 
188             throw se;
189         }
190     }
191 
192     public static java.util.List<com.liferay.portal.model.Region> getRegions(
193         HttpPrincipal httpPrincipal, long countryId, boolean active)
194         throws com.liferay.portal.SystemException {
195         try {
196             MethodKey methodKey = new MethodKey(RegionServiceUtil.class.getName(),
197                     "getRegions", _getRegionsParameterTypes4);
198 
199             MethodHandler methodHandler = new MethodHandler(methodKey,
200                     countryId, active);
201 
202             Object returnObj = null;
203 
204             try {
205                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
206             }
207             catch (Exception e) {
208                 if (e instanceof com.liferay.portal.SystemException) {
209                     throw (com.liferay.portal.SystemException)e;
210                 }
211 
212                 throw new com.liferay.portal.SystemException(e);
213             }
214 
215             return (java.util.List<com.liferay.portal.model.Region>)returnObj;
216         }
217         catch (com.liferay.portal.SystemException se) {
218             _log.error(se, se);
219 
220             throw se;
221         }
222     }
223 
224     public static com.liferay.portal.model.Region getRegion(
225         HttpPrincipal httpPrincipal, long regionId)
226         throws com.liferay.portal.PortalException,
227             com.liferay.portal.SystemException {
228         try {
229             MethodKey methodKey = new MethodKey(RegionServiceUtil.class.getName(),
230                     "getRegion", _getRegionParameterTypes5);
231 
232             MethodHandler methodHandler = new MethodHandler(methodKey, regionId);
233 
234             Object returnObj = null;
235 
236             try {
237                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
238             }
239             catch (Exception e) {
240                 if (e instanceof com.liferay.portal.PortalException) {
241                     throw (com.liferay.portal.PortalException)e;
242                 }
243 
244                 if (e instanceof com.liferay.portal.SystemException) {
245                     throw (com.liferay.portal.SystemException)e;
246                 }
247 
248                 throw new com.liferay.portal.SystemException(e);
249             }
250 
251             return (com.liferay.portal.model.Region)returnObj;
252         }
253         catch (com.liferay.portal.SystemException se) {
254             _log.error(se, se);
255 
256             throw se;
257         }
258     }
259 
260     private static Log _log = LogFactoryUtil.getLog(RegionServiceHttp.class);
261     private static final Class<?>[] _addRegionParameterTypes0 = new Class[] {
262             long.class, java.lang.String.class, java.lang.String.class,
263             boolean.class
264         };
265     private static final Class<?>[] _getRegionsParameterTypes1 = new Class[] {  };
266     private static final Class<?>[] _getRegionsParameterTypes2 = new Class[] {
267             long.class
268         };
269     private static final Class<?>[] _getRegionsParameterTypes3 = new Class[] {
270             boolean.class
271         };
272     private static final Class<?>[] _getRegionsParameterTypes4 = new Class[] {
273             long.class, boolean.class
274         };
275     private static final Class<?>[] _getRegionParameterTypes5 = new Class[] {
276             long.class
277         };
278 }