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.PortalException,
79              com.liferay.portal.SystemException {
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.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.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.PortalException,
120             com.liferay.portal.SystemException {
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.PortalException) {
144                     throw (com.liferay.portal.PortalException)e;
145                 }
146 
147                 if (e instanceof com.liferay.portal.SystemException) {
148                     throw (com.liferay.portal.SystemException)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.PortalException,
165             com.liferay.portal.SystemException {
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.PortalException) {
177                     throw (com.liferay.portal.PortalException)e;
178                 }
179 
180                 if (e instanceof com.liferay.portal.SystemException) {
181                     throw (com.liferay.portal.SystemException)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         try {
198             Object paramObj0 = className;
199 
200             if (className == null) {
201                 paramObj0 = new NullWrapper("java.lang.String");
202             }
203 
204             Object paramObj1 = new LongWrapper(classPK);
205 
206             MethodWrapper methodWrapper = new MethodWrapper(TagsEntryServiceUtil.class.getName(),
207                     "getEntries", new Object[] { paramObj0, paramObj1 });
208 
209             Object returnObj = null;
210 
211             try {
212                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
213             }
214             catch (Exception e) {
215                 if (e instanceof com.liferay.portal.SystemException) {
216                     throw (com.liferay.portal.SystemException)e;
217                 }
218 
219                 throw new com.liferay.portal.SystemException(e);
220             }
221 
222             return (java.util.List<com.liferay.portlet.tags.model.TagsEntry>)returnObj;
223         }
224         catch (com.liferay.portal.SystemException se) {
225             _log.error(se, se);
226 
227             throw se;
228         }
229     }
230 
231     public static java.util.List<com.liferay.portlet.tags.model.TagsEntry> getEntries(
232         HttpPrincipal httpPrincipal, long groupId, long companyId,
233         long classNameId, java.lang.String name)
234         throws com.liferay.portal.SystemException {
235         try {
236             Object paramObj0 = new LongWrapper(groupId);
237 
238             Object paramObj1 = new LongWrapper(companyId);
239 
240             Object paramObj2 = new LongWrapper(classNameId);
241 
242             Object paramObj3 = name;
243 
244             if (name == null) {
245                 paramObj3 = new NullWrapper("java.lang.String");
246             }
247 
248             MethodWrapper methodWrapper = new MethodWrapper(TagsEntryServiceUtil.class.getName(),
249                     "getEntries",
250                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
251 
252             Object returnObj = null;
253 
254             try {
255                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
256             }
257             catch (Exception e) {
258                 if (e instanceof com.liferay.portal.SystemException) {
259                     throw (com.liferay.portal.SystemException)e;
260                 }
261 
262                 throw new com.liferay.portal.SystemException(e);
263             }
264 
265             return (java.util.List<com.liferay.portlet.tags.model.TagsEntry>)returnObj;
266         }
267         catch (com.liferay.portal.SystemException se) {
268             _log.error(se, se);
269 
270             throw se;
271         }
272     }
273 
274     public static void mergeEntries(HttpPrincipal httpPrincipal,
275         long fromEntryId, long toEntryId)
276         throws com.liferay.portal.PortalException,
277             com.liferay.portal.SystemException {
278         try {
279             Object paramObj0 = new LongWrapper(fromEntryId);
280 
281             Object paramObj1 = new LongWrapper(toEntryId);
282 
283             MethodWrapper methodWrapper = new MethodWrapper(TagsEntryServiceUtil.class.getName(),
284                     "mergeEntries", new Object[] { paramObj0, paramObj1 });
285 
286             try {
287                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
288             }
289             catch (Exception e) {
290                 if (e instanceof com.liferay.portal.PortalException) {
291                     throw (com.liferay.portal.PortalException)e;
292                 }
293 
294                 if (e instanceof com.liferay.portal.SystemException) {
295                     throw (com.liferay.portal.SystemException)e;
296                 }
297 
298                 throw new com.liferay.portal.SystemException(e);
299             }
300         }
301         catch (com.liferay.portal.SystemException se) {
302             _log.error(se, se);
303 
304             throw se;
305         }
306     }
307 
308     public static java.util.List<com.liferay.portlet.tags.model.TagsEntry> search(
309         HttpPrincipal httpPrincipal, long companyId, java.lang.String name,
310         java.lang.String[] properties)
311         throws com.liferay.portal.SystemException {
312         try {
313             Object paramObj0 = new LongWrapper(companyId);
314 
315             Object paramObj1 = name;
316 
317             if (name == null) {
318                 paramObj1 = new NullWrapper("java.lang.String");
319             }
320 
321             Object paramObj2 = properties;
322 
323             if (properties == null) {
324                 paramObj2 = new NullWrapper("[Ljava.lang.String;");
325             }
326 
327             MethodWrapper methodWrapper = new MethodWrapper(TagsEntryServiceUtil.class.getName(),
328                     "search", new Object[] { paramObj0, paramObj1, paramObj2 });
329 
330             Object returnObj = null;
331 
332             try {
333                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
334             }
335             catch (Exception e) {
336                 if (e instanceof com.liferay.portal.SystemException) {
337                     throw (com.liferay.portal.SystemException)e;
338                 }
339 
340                 throw new com.liferay.portal.SystemException(e);
341             }
342 
343             return (java.util.List<com.liferay.portlet.tags.model.TagsEntry>)returnObj;
344         }
345         catch (com.liferay.portal.SystemException se) {
346             _log.error(se, se);
347 
348             throw se;
349         }
350     }
351 
352     public static java.util.List<com.liferay.portlet.tags.model.TagsEntry> search(
353         HttpPrincipal httpPrincipal, long companyId, java.lang.String name,
354         java.lang.String[] properties, int start, int end)
355         throws com.liferay.portal.SystemException {
356         try {
357             Object paramObj0 = new LongWrapper(companyId);
358 
359             Object paramObj1 = name;
360 
361             if (name == null) {
362                 paramObj1 = new NullWrapper("java.lang.String");
363             }
364 
365             Object paramObj2 = properties;
366 
367             if (properties == null) {
368                 paramObj2 = new NullWrapper("[Ljava.lang.String;");
369             }
370 
371             Object paramObj3 = new IntegerWrapper(start);
372 
373             Object paramObj4 = new IntegerWrapper(end);
374 
375             MethodWrapper methodWrapper = new MethodWrapper(TagsEntryServiceUtil.class.getName(),
376                     "search",
377                     new Object[] {
378                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
379                     });
380 
381             Object returnObj = null;
382 
383             try {
384                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
385             }
386             catch (Exception e) {
387                 if (e instanceof com.liferay.portal.SystemException) {
388                     throw (com.liferay.portal.SystemException)e;
389                 }
390 
391                 throw new com.liferay.portal.SystemException(e);
392             }
393 
394             return (java.util.List<com.liferay.portlet.tags.model.TagsEntry>)returnObj;
395         }
396         catch (com.liferay.portal.SystemException se) {
397             _log.error(se, se);
398 
399             throw se;
400         }
401     }
402 
403     public static com.liferay.portal.kernel.json.JSONArray searchAutocomplete(
404         HttpPrincipal httpPrincipal, long companyId, java.lang.String name,
405         java.lang.String[] properties, int start, int end)
406         throws com.liferay.portal.SystemException {
407         try {
408             Object paramObj0 = new LongWrapper(companyId);
409 
410             Object paramObj1 = name;
411 
412             if (name == null) {
413                 paramObj1 = new NullWrapper("java.lang.String");
414             }
415 
416             Object paramObj2 = properties;
417 
418             if (properties == null) {
419                 paramObj2 = new NullWrapper("[Ljava.lang.String;");
420             }
421 
422             Object paramObj3 = new IntegerWrapper(start);
423 
424             Object paramObj4 = new IntegerWrapper(end);
425 
426             MethodWrapper methodWrapper = new MethodWrapper(TagsEntryServiceUtil.class.getName(),
427                     "searchAutocomplete",
428                     new Object[] {
429                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
430                     });
431 
432             Object returnObj = null;
433 
434             try {
435                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
436             }
437             catch (Exception e) {
438                 if (e instanceof com.liferay.portal.SystemException) {
439                     throw (com.liferay.portal.SystemException)e;
440                 }
441 
442                 throw new com.liferay.portal.SystemException(e);
443             }
444 
445             return (com.liferay.portal.kernel.json.JSONArray)returnObj;
446         }
447         catch (com.liferay.portal.SystemException se) {
448             _log.error(se, se);
449 
450             throw se;
451         }
452     }
453 
454     public static int searchCount(HttpPrincipal httpPrincipal, long companyId,
455         java.lang.String name, java.lang.String[] properties)
456         throws com.liferay.portal.SystemException {
457         try {
458             Object paramObj0 = new LongWrapper(companyId);
459 
460             Object paramObj1 = name;
461 
462             if (name == null) {
463                 paramObj1 = new NullWrapper("java.lang.String");
464             }
465 
466             Object paramObj2 = properties;
467 
468             if (properties == null) {
469                 paramObj2 = new NullWrapper("[Ljava.lang.String;");
470             }
471 
472             MethodWrapper methodWrapper = new MethodWrapper(TagsEntryServiceUtil.class.getName(),
473                     "searchCount",
474                     new Object[] { paramObj0, paramObj1, paramObj2 });
475 
476             Object returnObj = null;
477 
478             try {
479                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
480             }
481             catch (Exception e) {
482                 if (e instanceof com.liferay.portal.SystemException) {
483                     throw (com.liferay.portal.SystemException)e;
484                 }
485 
486                 throw new com.liferay.portal.SystemException(e);
487             }
488 
489             return ((Integer)returnObj).intValue();
490         }
491         catch (com.liferay.portal.SystemException se) {
492             _log.error(se, se);
493 
494             throw se;
495         }
496     }
497 
498     public static com.liferay.portlet.tags.model.TagsEntry updateEntry(
499         HttpPrincipal httpPrincipal, long entryId, java.lang.String name)
500         throws com.liferay.portal.PortalException,
501             com.liferay.portal.SystemException {
502         try {
503             Object paramObj0 = new LongWrapper(entryId);
504 
505             Object paramObj1 = name;
506 
507             if (name == null) {
508                 paramObj1 = new NullWrapper("java.lang.String");
509             }
510 
511             MethodWrapper methodWrapper = new MethodWrapper(TagsEntryServiceUtil.class.getName(),
512                     "updateEntry", new Object[] { paramObj0, paramObj1 });
513 
514             Object returnObj = null;
515 
516             try {
517                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
518             }
519             catch (Exception e) {
520                 if (e instanceof com.liferay.portal.PortalException) {
521                     throw (com.liferay.portal.PortalException)e;
522                 }
523 
524                 if (e instanceof com.liferay.portal.SystemException) {
525                     throw (com.liferay.portal.SystemException)e;
526                 }
527 
528                 throw new com.liferay.portal.SystemException(e);
529             }
530 
531             return (com.liferay.portlet.tags.model.TagsEntry)returnObj;
532         }
533         catch (com.liferay.portal.SystemException se) {
534             _log.error(se, se);
535 
536             throw se;
537         }
538     }
539 
540     public static com.liferay.portlet.tags.model.TagsEntry updateEntry(
541         HttpPrincipal httpPrincipal, long entryId, java.lang.String name,
542         java.lang.String[] properties)
543         throws com.liferay.portal.PortalException,
544             com.liferay.portal.SystemException {
545         try {
546             Object paramObj0 = new LongWrapper(entryId);
547 
548             Object paramObj1 = name;
549 
550             if (name == null) {
551                 paramObj1 = new NullWrapper("java.lang.String");
552             }
553 
554             Object paramObj2 = properties;
555 
556             if (properties == null) {
557                 paramObj2 = new NullWrapper("[Ljava.lang.String;");
558             }
559 
560             MethodWrapper methodWrapper = new MethodWrapper(TagsEntryServiceUtil.class.getName(),
561                     "updateEntry",
562                     new Object[] { paramObj0, paramObj1, paramObj2 });
563 
564             Object returnObj = null;
565 
566             try {
567                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
568             }
569             catch (Exception e) {
570                 if (e instanceof com.liferay.portal.PortalException) {
571                     throw (com.liferay.portal.PortalException)e;
572                 }
573 
574                 if (e instanceof com.liferay.portal.SystemException) {
575                     throw (com.liferay.portal.SystemException)e;
576                 }
577 
578                 throw new com.liferay.portal.SystemException(e);
579             }
580 
581             return (com.liferay.portlet.tags.model.TagsEntry)returnObj;
582         }
583         catch (com.liferay.portal.SystemException se) {
584             _log.error(se, se);
585 
586             throw se;
587         }
588     }
589 
590     private static Log _log = LogFactoryUtil.getLog(TagsEntryServiceHttp.class);
591 }