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