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