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