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