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.tags.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.tags.service.TagsEntryServiceUtil;
35  
36  /**
37   * <a href="TagsEntryServiceHttp.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.tags.service.TagsEntryServiceUtil</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.tags.service.TagsEntryServiceUtil
72   * @see com.liferay.portlet.tags.service.http.TagsEntryServiceSoap
73   *
74   */
75  public class TagsEntryServiceHttp {
76      public static com.liferay.portlet.tags.model.TagsEntry addEntry(
77          HttpPrincipal httpPrincipal, java.lang.String name)
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              MethodWrapper methodWrapper = new MethodWrapper(TagsEntryServiceUtil.class.getName(),
88                      "addEntry", new Object[] { paramObj0 });
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.SystemException) {
97                      throw (com.liferay.portal.SystemException)e;
98                  }
99  
100                 if (e instanceof com.liferay.portal.PortalException) {
101                     throw (com.liferay.portal.PortalException)e;
102                 }
103 
104                 throw new com.liferay.portal.SystemException(e);
105             }
106 
107             return (com.liferay.portlet.tags.model.TagsEntry)returnObj;
108         }
109         catch (com.liferay.portal.SystemException se) {
110             _log.error(se, se);
111 
112             throw se;
113         }
114     }
115 
116     public static com.liferay.portlet.tags.model.TagsEntry addEntry(
117         HttpPrincipal httpPrincipal, java.lang.String name,
118         java.lang.String[] properties)
119         throws com.liferay.portal.SystemException,
120             com.liferay.portal.PortalException {
121         try {
122             Object paramObj0 = name;
123 
124             if (name == null) {
125                 paramObj0 = new NullWrapper("java.lang.String");
126             }
127 
128             Object paramObj1 = properties;
129 
130             if (properties == null) {
131                 paramObj1 = new NullWrapper("[Ljava.lang.String;");
132             }
133 
134             MethodWrapper methodWrapper = new MethodWrapper(TagsEntryServiceUtil.class.getName(),
135                     "addEntry", new Object[] { paramObj0, paramObj1 });
136 
137             Object returnObj = null;
138 
139             try {
140                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
141             }
142             catch (Exception e) {
143                 if (e instanceof com.liferay.portal.SystemException) {
144                     throw (com.liferay.portal.SystemException)e;
145                 }
146 
147                 if (e instanceof com.liferay.portal.PortalException) {
148                     throw (com.liferay.portal.PortalException)e;
149                 }
150 
151                 throw new com.liferay.portal.SystemException(e);
152             }
153 
154             return (com.liferay.portlet.tags.model.TagsEntry)returnObj;
155         }
156         catch (com.liferay.portal.SystemException se) {
157             _log.error(se, se);
158 
159             throw se;
160         }
161     }
162 
163     public static void deleteEntry(HttpPrincipal httpPrincipal, long entryId)
164         throws com.liferay.portal.SystemException,
165             com.liferay.portal.PortalException {
166         try {
167             Object paramObj0 = new LongWrapper(entryId);
168 
169             MethodWrapper methodWrapper = new MethodWrapper(TagsEntryServiceUtil.class.getName(),
170                     "deleteEntry", new Object[] { paramObj0 });
171 
172             try {
173                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
174             }
175             catch (Exception e) {
176                 if (e instanceof com.liferay.portal.SystemException) {
177                     throw (com.liferay.portal.SystemException)e;
178                 }
179 
180                 if (e instanceof com.liferay.portal.PortalException) {
181                     throw (com.liferay.portal.PortalException)e;
182                 }
183 
184                 throw new com.liferay.portal.SystemException(e);
185             }
186         }
187         catch (com.liferay.portal.SystemException se) {
188             _log.error(se, se);
189 
190             throw se;
191         }
192     }
193 
194     public static java.util.List<com.liferay.portlet.tags.model.TagsEntry> getEntries(
195         HttpPrincipal httpPrincipal, java.lang.String className, long classPK)
196         throws com.liferay.portal.SystemException,
197             com.liferay.portal.PortalException {
198         try {
199             Object paramObj0 = className;
200 
201             if (className == null) {
202                 paramObj0 = new NullWrapper("java.lang.String");
203             }
204 
205             Object paramObj1 = new LongWrapper(classPK);
206 
207             MethodWrapper methodWrapper = new MethodWrapper(TagsEntryServiceUtil.class.getName(),
208                     "getEntries", new Object[] { paramObj0, paramObj1 });
209 
210             Object returnObj = null;
211 
212             try {
213                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
214             }
215             catch (Exception e) {
216                 if (e instanceof com.liferay.portal.SystemException) {
217                     throw (com.liferay.portal.SystemException)e;
218                 }
219 
220                 if (e instanceof com.liferay.portal.PortalException) {
221                     throw (com.liferay.portal.PortalException)e;
222                 }
223 
224                 throw new com.liferay.portal.SystemException(e);
225             }
226 
227             return (java.util.List<com.liferay.portlet.tags.model.TagsEntry>)returnObj;
228         }
229         catch (com.liferay.portal.SystemException se) {
230             _log.error(se, se);
231 
232             throw se;
233         }
234     }
235 
236     public static java.util.List<com.liferay.portlet.tags.model.TagsEntry> getEntries(
237         HttpPrincipal httpPrincipal, long groupId, long companyId,
238         long classNameId, java.lang.String name)
239         throws com.liferay.portal.SystemException {
240         try {
241             Object paramObj0 = new LongWrapper(groupId);
242 
243             Object paramObj1 = new LongWrapper(companyId);
244 
245             Object paramObj2 = new LongWrapper(classNameId);
246 
247             Object paramObj3 = name;
248 
249             if (name == null) {
250                 paramObj3 = new NullWrapper("java.lang.String");
251             }
252 
253             MethodWrapper methodWrapper = new MethodWrapper(TagsEntryServiceUtil.class.getName(),
254                     "getEntries",
255                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
256 
257             Object returnObj = null;
258 
259             try {
260                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
261             }
262             catch (Exception e) {
263                 if (e instanceof com.liferay.portal.SystemException) {
264                     throw (com.liferay.portal.SystemException)e;
265                 }
266 
267                 throw new com.liferay.portal.SystemException(e);
268             }
269 
270             return (java.util.List<com.liferay.portlet.tags.model.TagsEntry>)returnObj;
271         }
272         catch (com.liferay.portal.SystemException se) {
273             _log.error(se, se);
274 
275             throw se;
276         }
277     }
278 
279     public static void mergeEntries(HttpPrincipal httpPrincipal,
280         long fromEntryId, long toEntryId)
281         throws com.liferay.portal.SystemException,
282             com.liferay.portal.PortalException {
283         try {
284             Object paramObj0 = new LongWrapper(fromEntryId);
285 
286             Object paramObj1 = new LongWrapper(toEntryId);
287 
288             MethodWrapper methodWrapper = new MethodWrapper(TagsEntryServiceUtil.class.getName(),
289                     "mergeEntries", new Object[] { paramObj0, paramObj1 });
290 
291             try {
292                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
293             }
294             catch (Exception e) {
295                 if (e instanceof com.liferay.portal.SystemException) {
296                     throw (com.liferay.portal.SystemException)e;
297                 }
298 
299                 if (e instanceof com.liferay.portal.PortalException) {
300                     throw (com.liferay.portal.PortalException)e;
301                 }
302 
303                 throw new com.liferay.portal.SystemException(e);
304             }
305         }
306         catch (com.liferay.portal.SystemException se) {
307             _log.error(se, se);
308 
309             throw se;
310         }
311     }
312 
313     public static java.util.List<com.liferay.portlet.tags.model.TagsEntry> search(
314         HttpPrincipal httpPrincipal, long companyId, java.lang.String name,
315         java.lang.String[] properties)
316         throws com.liferay.portal.SystemException {
317         try {
318             Object paramObj0 = new LongWrapper(companyId);
319 
320             Object paramObj1 = name;
321 
322             if (name == null) {
323                 paramObj1 = new NullWrapper("java.lang.String");
324             }
325 
326             Object paramObj2 = properties;
327 
328             if (properties == null) {
329                 paramObj2 = new NullWrapper("[Ljava.lang.String;");
330             }
331 
332             MethodWrapper methodWrapper = new MethodWrapper(TagsEntryServiceUtil.class.getName(),
333                     "search", new Object[] { paramObj0, paramObj1, paramObj2 });
334 
335             Object returnObj = null;
336 
337             try {
338                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
339             }
340             catch (Exception e) {
341                 if (e instanceof com.liferay.portal.SystemException) {
342                     throw (com.liferay.portal.SystemException)e;
343                 }
344 
345                 throw new com.liferay.portal.SystemException(e);
346             }
347 
348             return (java.util.List<com.liferay.portlet.tags.model.TagsEntry>)returnObj;
349         }
350         catch (com.liferay.portal.SystemException se) {
351             _log.error(se, se);
352 
353             throw se;
354         }
355     }
356 
357     public static java.util.List<com.liferay.portlet.tags.model.TagsEntry> search(
358         HttpPrincipal httpPrincipal, long companyId, java.lang.String name,
359         java.lang.String[] properties, int begin, int end)
360         throws com.liferay.portal.SystemException {
361         try {
362             Object paramObj0 = new LongWrapper(companyId);
363 
364             Object paramObj1 = name;
365 
366             if (name == null) {
367                 paramObj1 = new NullWrapper("java.lang.String");
368             }
369 
370             Object paramObj2 = properties;
371 
372             if (properties == null) {
373                 paramObj2 = new NullWrapper("[Ljava.lang.String;");
374             }
375 
376             Object paramObj3 = new IntegerWrapper(begin);
377 
378             Object paramObj4 = new IntegerWrapper(end);
379 
380             MethodWrapper methodWrapper = new MethodWrapper(TagsEntryServiceUtil.class.getName(),
381                     "search",
382                     new Object[] {
383                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
384                     });
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.tags.model.TagsEntry>)returnObj;
400         }
401         catch (com.liferay.portal.SystemException se) {
402             _log.error(se, se);
403 
404             throw se;
405         }
406     }
407 
408     public static com.liferay.portal.kernel.json.JSONArrayWrapper searchAutocomplete(
409         HttpPrincipal httpPrincipal, long companyId, java.lang.String name,
410         java.lang.String[] properties, int begin, int end)
411         throws com.liferay.portal.SystemException {
412         try {
413             Object paramObj0 = new LongWrapper(companyId);
414 
415             Object paramObj1 = name;
416 
417             if (name == null) {
418                 paramObj1 = new NullWrapper("java.lang.String");
419             }
420 
421             Object paramObj2 = properties;
422 
423             if (properties == null) {
424                 paramObj2 = new NullWrapper("[Ljava.lang.String;");
425             }
426 
427             Object paramObj3 = new IntegerWrapper(begin);
428 
429             Object paramObj4 = new IntegerWrapper(end);
430 
431             MethodWrapper methodWrapper = new MethodWrapper(TagsEntryServiceUtil.class.getName(),
432                     "searchAutocomplete",
433                     new Object[] {
434                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
435                     });
436 
437             Object returnObj = null;
438 
439             try {
440                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
441             }
442             catch (Exception e) {
443                 if (e instanceof com.liferay.portal.SystemException) {
444                     throw (com.liferay.portal.SystemException)e;
445                 }
446 
447                 throw new com.liferay.portal.SystemException(e);
448             }
449 
450             return (com.liferay.portal.kernel.json.JSONArrayWrapper)returnObj;
451         }
452         catch (com.liferay.portal.SystemException se) {
453             _log.error(se, se);
454 
455             throw se;
456         }
457     }
458 
459     public static int searchCount(HttpPrincipal httpPrincipal, long companyId,
460         java.lang.String name, java.lang.String[] properties)
461         throws com.liferay.portal.SystemException {
462         try {
463             Object paramObj0 = new LongWrapper(companyId);
464 
465             Object paramObj1 = name;
466 
467             if (name == null) {
468                 paramObj1 = new NullWrapper("java.lang.String");
469             }
470 
471             Object paramObj2 = properties;
472 
473             if (properties == null) {
474                 paramObj2 = new NullWrapper("[Ljava.lang.String;");
475             }
476 
477             MethodWrapper methodWrapper = new MethodWrapper(TagsEntryServiceUtil.class.getName(),
478                     "searchCount",
479                     new Object[] { paramObj0, paramObj1, paramObj2 });
480 
481             Object returnObj = null;
482 
483             try {
484                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
485             }
486             catch (Exception e) {
487                 if (e instanceof com.liferay.portal.SystemException) {
488                     throw (com.liferay.portal.SystemException)e;
489                 }
490 
491                 throw new com.liferay.portal.SystemException(e);
492             }
493 
494             return ((Integer)returnObj).intValue();
495         }
496         catch (com.liferay.portal.SystemException se) {
497             _log.error(se, se);
498 
499             throw se;
500         }
501     }
502 
503     public static com.liferay.portlet.tags.model.TagsEntry updateEntry(
504         HttpPrincipal httpPrincipal, long entryId, java.lang.String name)
505         throws com.liferay.portal.SystemException,
506             com.liferay.portal.PortalException {
507         try {
508             Object paramObj0 = new LongWrapper(entryId);
509 
510             Object paramObj1 = name;
511 
512             if (name == null) {
513                 paramObj1 = new NullWrapper("java.lang.String");
514             }
515 
516             MethodWrapper methodWrapper = new MethodWrapper(TagsEntryServiceUtil.class.getName(),
517                     "updateEntry", new Object[] { paramObj0, paramObj1 });
518 
519             Object returnObj = null;
520 
521             try {
522                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
523             }
524             catch (Exception e) {
525                 if (e instanceof com.liferay.portal.SystemException) {
526                     throw (com.liferay.portal.SystemException)e;
527                 }
528 
529                 if (e instanceof com.liferay.portal.PortalException) {
530                     throw (com.liferay.portal.PortalException)e;
531                 }
532 
533                 throw new com.liferay.portal.SystemException(e);
534             }
535 
536             return (com.liferay.portlet.tags.model.TagsEntry)returnObj;
537         }
538         catch (com.liferay.portal.SystemException se) {
539             _log.error(se, se);
540 
541             throw se;
542         }
543     }
544 
545     public static com.liferay.portlet.tags.model.TagsEntry updateEntry(
546         HttpPrincipal httpPrincipal, long entryId, java.lang.String name,
547         java.lang.String[] properties)
548         throws com.liferay.portal.SystemException,
549             com.liferay.portal.PortalException {
550         try {
551             Object paramObj0 = new LongWrapper(entryId);
552 
553             Object paramObj1 = name;
554 
555             if (name == null) {
556                 paramObj1 = new NullWrapper("java.lang.String");
557             }
558 
559             Object paramObj2 = properties;
560 
561             if (properties == null) {
562                 paramObj2 = new NullWrapper("[Ljava.lang.String;");
563             }
564 
565             MethodWrapper methodWrapper = new MethodWrapper(TagsEntryServiceUtil.class.getName(),
566                     "updateEntry",
567                     new Object[] { paramObj0, paramObj1, paramObj2 });
568 
569             Object returnObj = null;
570 
571             try {
572                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
573             }
574             catch (Exception e) {
575                 if (e instanceof com.liferay.portal.SystemException) {
576                     throw (com.liferay.portal.SystemException)e;
577                 }
578 
579                 if (e instanceof com.liferay.portal.PortalException) {
580                     throw (com.liferay.portal.PortalException)e;
581                 }
582 
583                 throw new com.liferay.portal.SystemException(e);
584             }
585 
586             return (com.liferay.portlet.tags.model.TagsEntry)returnObj;
587         }
588         catch (com.liferay.portal.SystemException se) {
589             _log.error(se, se);
590 
591             throw se;
592         }
593     }
594 
595     private static Log _log = LogFactoryUtil.getLog(TagsEntryServiceHttp.class);
596 }