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.portlet.expando.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.IntegerWrapper;
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.http.TunnelUtil;
33  
34  import com.liferay.portlet.expando.service.ExpandoRowServiceUtil;
35  
36  /**
37   * <a href="ExpandoRowServiceHttp.java.html"><b><i>View Source</i></b></a>
38   *
39   * <p>
40   * ServiceBuilder generated this class. Modifications in this class will be
41   * overwritten the next time is generated.
42   * </p>
43   *
44   * <p>
45   * This class provides a HTTP utility for the
46   * <code>com.liferay.portlet.expando.service.ExpandoRowServiceUtil</code> service
47   * utility. The static methods of this class calls the same methods of the
48   * service utility. However, the signatures are different because it requires an
49   * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code>
50   * parameter.
51   * </p>
52   *
53   * <p>
54   * The benefits of using the HTTP utility is that it is fast and allows for
55   * tunneling without the cost of serializing to text. The drawback is that it
56   * only works with Java.
57   * </p>
58   *
59   * <p>
60   * Set the property <code>tunnel.servlet.hosts.allowed</code> in
61   * portal.properties to configure security.
62   * </p>
63   *
64   * <p>
65   * The HTTP utility is only generated for remote services.
66   * </p>
67   *
68   * @author Brian Wing Shun Chan
69   *
70   * @see com.liferay.portal.security.auth.HttpPrincipal
71   * @see com.liferay.portlet.expando.service.ExpandoRowServiceUtil
72   * @see com.liferay.portlet.expando.service.http.ExpandoRowServiceSoap
73   *
74   */
75  public class ExpandoRowServiceHttp {
76      public static com.liferay.portlet.expando.model.ExpandoRow addRow(
77          HttpPrincipal httpPrincipal, long tableId)
78          throws com.liferay.portal.SystemException,
79              com.liferay.portal.PortalException {
80          try {
81              Object paramObj0 = new LongWrapper(tableId);
82  
83              MethodWrapper methodWrapper = new MethodWrapper(ExpandoRowServiceUtil.class.getName(),
84                      "addRow", new Object[] { paramObj0 });
85  
86              Object returnObj = null;
87  
88              try {
89                  returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
90              }
91              catch (Exception e) {
92                  if (e instanceof com.liferay.portal.SystemException) {
93                      throw (com.liferay.portal.SystemException)e;
94                  }
95  
96                  if (e instanceof com.liferay.portal.PortalException) {
97                      throw (com.liferay.portal.PortalException)e;
98                  }
99  
100                 throw new com.liferay.portal.SystemException(e);
101             }
102 
103             return (com.liferay.portlet.expando.model.ExpandoRow)returnObj;
104         }
105         catch (com.liferay.portal.SystemException se) {
106             _log.error(se, se);
107 
108             throw se;
109         }
110     }
111 
112     public static void deleteRow(HttpPrincipal httpPrincipal, long rowId)
113         throws com.liferay.portal.SystemException,
114             com.liferay.portal.PortalException {
115         try {
116             Object paramObj0 = new LongWrapper(rowId);
117 
118             MethodWrapper methodWrapper = new MethodWrapper(ExpandoRowServiceUtil.class.getName(),
119                     "deleteRow", new Object[] { paramObj0 });
120 
121             try {
122                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
123             }
124             catch (Exception e) {
125                 if (e instanceof com.liferay.portal.SystemException) {
126                     throw (com.liferay.portal.SystemException)e;
127                 }
128 
129                 if (e instanceof com.liferay.portal.PortalException) {
130                     throw (com.liferay.portal.PortalException)e;
131                 }
132 
133                 throw new com.liferay.portal.SystemException(e);
134             }
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.portlet.expando.model.ExpandoRow> getDefaultTableRows(
144         HttpPrincipal httpPrincipal, java.lang.String className, int begin,
145         int end) throws com.liferay.portal.SystemException {
146         try {
147             Object paramObj0 = className;
148 
149             if (className == null) {
150                 paramObj0 = new NullWrapper("java.lang.String");
151             }
152 
153             Object paramObj1 = new IntegerWrapper(begin);
154 
155             Object paramObj2 = new IntegerWrapper(end);
156 
157             MethodWrapper methodWrapper = new MethodWrapper(ExpandoRowServiceUtil.class.getName(),
158                     "getDefaultTableRows",
159                     new Object[] { paramObj0, paramObj1, paramObj2 });
160 
161             Object returnObj = null;
162 
163             try {
164                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
165             }
166             catch (Exception e) {
167                 if (e instanceof com.liferay.portal.SystemException) {
168                     throw (com.liferay.portal.SystemException)e;
169                 }
170 
171                 throw new com.liferay.portal.SystemException(e);
172             }
173 
174             return (java.util.List<com.liferay.portlet.expando.model.ExpandoRow>)returnObj;
175         }
176         catch (com.liferay.portal.SystemException se) {
177             _log.error(se, se);
178 
179             throw se;
180         }
181     }
182 
183     public static java.util.List<com.liferay.portlet.expando.model.ExpandoRow> getDefaultTableRows(
184         HttpPrincipal httpPrincipal, long classNameId, int begin, int end)
185         throws com.liferay.portal.SystemException {
186         try {
187             Object paramObj0 = new LongWrapper(classNameId);
188 
189             Object paramObj1 = new IntegerWrapper(begin);
190 
191             Object paramObj2 = new IntegerWrapper(end);
192 
193             MethodWrapper methodWrapper = new MethodWrapper(ExpandoRowServiceUtil.class.getName(),
194                     "getDefaultTableRows",
195                     new Object[] { paramObj0, paramObj1, paramObj2 });
196 
197             Object returnObj = null;
198 
199             try {
200                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
201             }
202             catch (Exception e) {
203                 if (e instanceof com.liferay.portal.SystemException) {
204                     throw (com.liferay.portal.SystemException)e;
205                 }
206 
207                 throw new com.liferay.portal.SystemException(e);
208             }
209 
210             return (java.util.List<com.liferay.portlet.expando.model.ExpandoRow>)returnObj;
211         }
212         catch (com.liferay.portal.SystemException se) {
213             _log.error(se, se);
214 
215             throw se;
216         }
217     }
218 
219     public static int getDefaultTableRowsCount(HttpPrincipal httpPrincipal,
220         java.lang.String className) throws com.liferay.portal.SystemException {
221         try {
222             Object paramObj0 = className;
223 
224             if (className == null) {
225                 paramObj0 = new NullWrapper("java.lang.String");
226             }
227 
228             MethodWrapper methodWrapper = new MethodWrapper(ExpandoRowServiceUtil.class.getName(),
229                     "getDefaultTableRowsCount", new Object[] { paramObj0 });
230 
231             Object returnObj = null;
232 
233             try {
234                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
235             }
236             catch (Exception e) {
237                 if (e instanceof com.liferay.portal.SystemException) {
238                     throw (com.liferay.portal.SystemException)e;
239                 }
240 
241                 throw new com.liferay.portal.SystemException(e);
242             }
243 
244             return ((Integer)returnObj).intValue();
245         }
246         catch (com.liferay.portal.SystemException se) {
247             _log.error(se, se);
248 
249             throw se;
250         }
251     }
252 
253     public static int getDefaultTableRowsCount(HttpPrincipal httpPrincipal,
254         long classNameId) throws com.liferay.portal.SystemException {
255         try {
256             Object paramObj0 = new LongWrapper(classNameId);
257 
258             MethodWrapper methodWrapper = new MethodWrapper(ExpandoRowServiceUtil.class.getName(),
259                     "getDefaultTableRowsCount", new Object[] { paramObj0 });
260 
261             Object returnObj = null;
262 
263             try {
264                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
265             }
266             catch (Exception e) {
267                 if (e instanceof com.liferay.portal.SystemException) {
268                     throw (com.liferay.portal.SystemException)e;
269                 }
270 
271                 throw new com.liferay.portal.SystemException(e);
272             }
273 
274             return ((Integer)returnObj).intValue();
275         }
276         catch (com.liferay.portal.SystemException se) {
277             _log.error(se, se);
278 
279             throw se;
280         }
281     }
282 
283     public static java.util.List<com.liferay.portlet.expando.model.ExpandoRow> getRows(
284         HttpPrincipal httpPrincipal, long tableId, int begin, int end)
285         throws com.liferay.portal.SystemException {
286         try {
287             Object paramObj0 = new LongWrapper(tableId);
288 
289             Object paramObj1 = new IntegerWrapper(begin);
290 
291             Object paramObj2 = new IntegerWrapper(end);
292 
293             MethodWrapper methodWrapper = new MethodWrapper(ExpandoRowServiceUtil.class.getName(),
294                     "getRows", new Object[] { paramObj0, paramObj1, paramObj2 });
295 
296             Object returnObj = null;
297 
298             try {
299                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
300             }
301             catch (Exception e) {
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 (java.util.List<com.liferay.portlet.expando.model.ExpandoRow>)returnObj;
310         }
311         catch (com.liferay.portal.SystemException se) {
312             _log.error(se, se);
313 
314             throw se;
315         }
316     }
317 
318     public static java.util.List<com.liferay.portlet.expando.model.ExpandoRow> getRows(
319         HttpPrincipal httpPrincipal, java.lang.String className,
320         java.lang.String tableName, int begin, int end)
321         throws com.liferay.portal.SystemException {
322         try {
323             Object paramObj0 = className;
324 
325             if (className == null) {
326                 paramObj0 = new NullWrapper("java.lang.String");
327             }
328 
329             Object paramObj1 = tableName;
330 
331             if (tableName == null) {
332                 paramObj1 = new NullWrapper("java.lang.String");
333             }
334 
335             Object paramObj2 = new IntegerWrapper(begin);
336 
337             Object paramObj3 = new IntegerWrapper(end);
338 
339             MethodWrapper methodWrapper = new MethodWrapper(ExpandoRowServiceUtil.class.getName(),
340                     "getRows",
341                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
342 
343             Object returnObj = null;
344 
345             try {
346                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
347             }
348             catch (Exception e) {
349                 if (e instanceof com.liferay.portal.SystemException) {
350                     throw (com.liferay.portal.SystemException)e;
351                 }
352 
353                 throw new com.liferay.portal.SystemException(e);
354             }
355 
356             return (java.util.List<com.liferay.portlet.expando.model.ExpandoRow>)returnObj;
357         }
358         catch (com.liferay.portal.SystemException se) {
359             _log.error(se, se);
360 
361             throw se;
362         }
363     }
364 
365     public static java.util.List<com.liferay.portlet.expando.model.ExpandoRow> getRows(
366         HttpPrincipal httpPrincipal, long classNameId,
367         java.lang.String tableName, int begin, int end)
368         throws com.liferay.portal.SystemException {
369         try {
370             Object paramObj0 = new LongWrapper(classNameId);
371 
372             Object paramObj1 = tableName;
373 
374             if (tableName == null) {
375                 paramObj1 = new NullWrapper("java.lang.String");
376             }
377 
378             Object paramObj2 = new IntegerWrapper(begin);
379 
380             Object paramObj3 = new IntegerWrapper(end);
381 
382             MethodWrapper methodWrapper = new MethodWrapper(ExpandoRowServiceUtil.class.getName(),
383                     "getRows",
384                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
385 
386             Object returnObj = null;
387 
388             try {
389                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
390             }
391             catch (Exception e) {
392                 if (e instanceof com.liferay.portal.SystemException) {
393                     throw (com.liferay.portal.SystemException)e;
394                 }
395 
396                 throw new com.liferay.portal.SystemException(e);
397             }
398 
399             return (java.util.List<com.liferay.portlet.expando.model.ExpandoRow>)returnObj;
400         }
401         catch (com.liferay.portal.SystemException se) {
402             _log.error(se, se);
403 
404             throw se;
405         }
406     }
407 
408     public static int getRowsCount(HttpPrincipal httpPrincipal, long tableId)
409         throws com.liferay.portal.SystemException {
410         try {
411             Object paramObj0 = new LongWrapper(tableId);
412 
413             MethodWrapper methodWrapper = new MethodWrapper(ExpandoRowServiceUtil.class.getName(),
414                     "getRowsCount", new Object[] { paramObj0 });
415 
416             Object returnObj = null;
417 
418             try {
419                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
420             }
421             catch (Exception e) {
422                 if (e instanceof com.liferay.portal.SystemException) {
423                     throw (com.liferay.portal.SystemException)e;
424                 }
425 
426                 throw new com.liferay.portal.SystemException(e);
427             }
428 
429             return ((Integer)returnObj).intValue();
430         }
431         catch (com.liferay.portal.SystemException se) {
432             _log.error(se, se);
433 
434             throw se;
435         }
436     }
437 
438     public static int getRowsCount(HttpPrincipal httpPrincipal,
439         java.lang.String className, java.lang.String tableName)
440         throws com.liferay.portal.SystemException {
441         try {
442             Object paramObj0 = className;
443 
444             if (className == null) {
445                 paramObj0 = new NullWrapper("java.lang.String");
446             }
447 
448             Object paramObj1 = tableName;
449 
450             if (tableName == null) {
451                 paramObj1 = new NullWrapper("java.lang.String");
452             }
453 
454             MethodWrapper methodWrapper = new MethodWrapper(ExpandoRowServiceUtil.class.getName(),
455                     "getRowsCount", new Object[] { paramObj0, paramObj1 });
456 
457             Object returnObj = null;
458 
459             try {
460                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
461             }
462             catch (Exception e) {
463                 if (e instanceof com.liferay.portal.SystemException) {
464                     throw (com.liferay.portal.SystemException)e;
465                 }
466 
467                 throw new com.liferay.portal.SystemException(e);
468             }
469 
470             return ((Integer)returnObj).intValue();
471         }
472         catch (com.liferay.portal.SystemException se) {
473             _log.error(se, se);
474 
475             throw se;
476         }
477     }
478 
479     public static int getRowsCount(HttpPrincipal httpPrincipal,
480         long classNameId, java.lang.String tableName)
481         throws com.liferay.portal.SystemException {
482         try {
483             Object paramObj0 = new LongWrapper(classNameId);
484 
485             Object paramObj1 = tableName;
486 
487             if (tableName == null) {
488                 paramObj1 = new NullWrapper("java.lang.String");
489             }
490 
491             MethodWrapper methodWrapper = new MethodWrapper(ExpandoRowServiceUtil.class.getName(),
492                     "getRowsCount", new Object[] { paramObj0, paramObj1 });
493 
494             Object returnObj = null;
495 
496             try {
497                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
498             }
499             catch (Exception e) {
500                 if (e instanceof com.liferay.portal.SystemException) {
501                     throw (com.liferay.portal.SystemException)e;
502                 }
503 
504                 throw new com.liferay.portal.SystemException(e);
505             }
506 
507             return ((Integer)returnObj).intValue();
508         }
509         catch (com.liferay.portal.SystemException se) {
510             _log.error(se, se);
511 
512             throw se;
513         }
514     }
515 
516     private static Log _log = LogFactoryUtil.getLog(ExpandoRowServiceHttp.class);
517 }