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