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