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