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.RegionServiceUtil;
25  
26  /**
27   * <a href="RegionServiceHttp.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.RegionServiceUtil} 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       RegionServiceSoap
59   * @see       com.liferay.portal.security.auth.HttpPrincipal
60   * @see       com.liferay.portal.service.RegionServiceUtil
61   * @generated
62   */
63  public class RegionServiceHttp {
64      public static com.liferay.portal.model.Region addRegion(
65          HttpPrincipal httpPrincipal, long countryId,
66          java.lang.String regionCode, java.lang.String name, boolean active)
67          throws com.liferay.portal.PortalException,
68              com.liferay.portal.SystemException {
69          try {
70              Object paramObj0 = new LongWrapper(countryId);
71  
72              Object paramObj1 = regionCode;
73  
74              if (regionCode == null) {
75                  paramObj1 = new NullWrapper("java.lang.String");
76              }
77  
78              Object paramObj2 = name;
79  
80              if (name == null) {
81                  paramObj2 = new NullWrapper("java.lang.String");
82              }
83  
84              Object paramObj3 = new BooleanWrapper(active);
85  
86              MethodWrapper methodWrapper = new MethodWrapper(RegionServiceUtil.class.getName(),
87                      "addRegion",
88                      new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
89  
90              Object returnObj = null;
91  
92              try {
93                  returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
94              }
95              catch (Exception e) {
96                  if (e instanceof com.liferay.portal.PortalException) {
97                      throw (com.liferay.portal.PortalException)e;
98                  }
99  
100                 if (e instanceof com.liferay.portal.SystemException) {
101                     throw (com.liferay.portal.SystemException)e;
102                 }
103 
104                 throw new com.liferay.portal.SystemException(e);
105             }
106 
107             return (com.liferay.portal.model.Region)returnObj;
108         }
109         catch (com.liferay.portal.SystemException se) {
110             _log.error(se, se);
111 
112             throw se;
113         }
114     }
115 
116     public static java.util.List<com.liferay.portal.model.Region> getRegions(
117         HttpPrincipal httpPrincipal) throws com.liferay.portal.SystemException {
118         try {
119             MethodWrapper methodWrapper = new MethodWrapper(RegionServiceUtil.class.getName(),
120                     "getRegions", new Object[0]);
121 
122             Object returnObj = null;
123 
124             try {
125                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
126             }
127             catch (Exception e) {
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 (java.util.List<com.liferay.portal.model.Region>)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.Region> getRegions(
145         HttpPrincipal httpPrincipal, long countryId)
146         throws com.liferay.portal.SystemException {
147         try {
148             Object paramObj0 = new LongWrapper(countryId);
149 
150             MethodWrapper methodWrapper = new MethodWrapper(RegionServiceUtil.class.getName(),
151                     "getRegions", new Object[] { paramObj0 });
152 
153             Object returnObj = null;
154 
155             try {
156                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
157             }
158             catch (Exception e) {
159                 if (e instanceof com.liferay.portal.SystemException) {
160                     throw (com.liferay.portal.SystemException)e;
161                 }
162 
163                 throw new com.liferay.portal.SystemException(e);
164             }
165 
166             return (java.util.List<com.liferay.portal.model.Region>)returnObj;
167         }
168         catch (com.liferay.portal.SystemException se) {
169             _log.error(se, se);
170 
171             throw se;
172         }
173     }
174 
175     public static java.util.List<com.liferay.portal.model.Region> getRegions(
176         HttpPrincipal httpPrincipal, boolean active)
177         throws com.liferay.portal.SystemException {
178         try {
179             Object paramObj0 = new BooleanWrapper(active);
180 
181             MethodWrapper methodWrapper = new MethodWrapper(RegionServiceUtil.class.getName(),
182                     "getRegions", new Object[] { paramObj0 });
183 
184             Object returnObj = null;
185 
186             try {
187                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
188             }
189             catch (Exception e) {
190                 if (e instanceof com.liferay.portal.SystemException) {
191                     throw (com.liferay.portal.SystemException)e;
192                 }
193 
194                 throw new com.liferay.portal.SystemException(e);
195             }
196 
197             return (java.util.List<com.liferay.portal.model.Region>)returnObj;
198         }
199         catch (com.liferay.portal.SystemException se) {
200             _log.error(se, se);
201 
202             throw se;
203         }
204     }
205 
206     public static java.util.List<com.liferay.portal.model.Region> getRegions(
207         HttpPrincipal httpPrincipal, long countryId, boolean active)
208         throws com.liferay.portal.SystemException {
209         try {
210             Object paramObj0 = new LongWrapper(countryId);
211 
212             Object paramObj1 = new BooleanWrapper(active);
213 
214             MethodWrapper methodWrapper = new MethodWrapper(RegionServiceUtil.class.getName(),
215                     "getRegions", new Object[] { paramObj0, paramObj1 });
216 
217             Object returnObj = null;
218 
219             try {
220                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
221             }
222             catch (Exception e) {
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 (java.util.List<com.liferay.portal.model.Region>)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.Region getRegion(
240         HttpPrincipal httpPrincipal, long regionId)
241         throws com.liferay.portal.PortalException,
242             com.liferay.portal.SystemException {
243         try {
244             Object paramObj0 = new LongWrapper(regionId);
245 
246             MethodWrapper methodWrapper = new MethodWrapper(RegionServiceUtil.class.getName(),
247                     "getRegion", new Object[] { paramObj0 });
248 
249             Object returnObj = null;
250 
251             try {
252                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
253             }
254             catch (Exception e) {
255                 if (e instanceof com.liferay.portal.PortalException) {
256                     throw (com.liferay.portal.PortalException)e;
257                 }
258 
259                 if (e instanceof com.liferay.portal.SystemException) {
260                     throw (com.liferay.portal.SystemException)e;
261                 }
262 
263                 throw new com.liferay.portal.SystemException(e);
264             }
265 
266             return (com.liferay.portal.model.Region)returnObj;
267         }
268         catch (com.liferay.portal.SystemException se) {
269             _log.error(se, se);
270 
271             throw se;
272         }
273     }
274 
275     private static Log _log = LogFactoryUtil.getLog(RegionServiceHttp.class);
276 }