1   /**
2    * Copyright (c) 2000-2007 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 overwritten
41   * the next time is generated.
42   * </p>
43   *
44   * <p>
45   * This class provides a HTTP utility for the <code>com.liferay.portlet.tags.service.TagsEntryServiceUtil</code>
46   * service utility. The static methods of this class calls the same methods of the
47   * service utility. However, the signatures are different because it requires an
48   * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code> parameter.
49   * </p>
50   *
51   * <p>
52   * The benefits of using the HTTP utility is that it is fast and allows for tunneling
53   * without the cost of serializing to text. The drawback is that it only works with
54   * Java.
55   * </p>
56   *
57   * <p>
58   * Set the property <code>tunnel.servlet.hosts.allowed</code> in portal.properties
59   * to configure security.
60   * </p>
61   *
62   * <p>
63   * The HTTP utility is only generated for remote services.
64   * </p>
65   *
66   * @author Brian Wing Shun Chan
67   *
68   * @see com.liferay.portal.security.auth.HttpPrincipal
69   * @see com.liferay.portlet.tags.service.TagsEntryServiceUtil
70   * @see com.liferay.portlet.tags.service.http.TagsEntryServiceSoap
71   *
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.SystemException, 
77              com.liferay.portal.PortalException {
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              Object returnObj = null;
88  
89              try {
90                  returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
91              }
92              catch (Exception e) {
93                  if (e instanceof com.liferay.portal.SystemException) {
94                      throw (com.liferay.portal.SystemException)e;
95                  }
96  
97                  if (e instanceof com.liferay.portal.PortalException) {
98                      throw (com.liferay.portal.PortalException)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             throw se;
109         }
110     }
111 
112     public static com.liferay.portlet.tags.model.TagsEntry addEntry(
113         HttpPrincipal httpPrincipal, java.lang.String name,
114         java.lang.String[] properties)
115         throws com.liferay.portal.SystemException, 
116             com.liferay.portal.PortalException {
117         try {
118             Object paramObj0 = name;
119 
120             if (name == null) {
121                 paramObj0 = new NullWrapper("java.lang.String");
122             }
123 
124             Object paramObj1 = properties;
125 
126             if (properties == null) {
127                 paramObj1 = new NullWrapper("[Ljava.lang.String;");
128             }
129 
130             MethodWrapper methodWrapper = new MethodWrapper(TagsEntryServiceUtil.class.getName(),
131                     "addEntry", new Object[] { paramObj0, paramObj1 });
132             Object returnObj = null;
133 
134             try {
135                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
136             }
137             catch (Exception e) {
138                 if (e instanceof com.liferay.portal.SystemException) {
139                     throw (com.liferay.portal.SystemException)e;
140                 }
141 
142                 if (e instanceof com.liferay.portal.PortalException) {
143                     throw (com.liferay.portal.PortalException)e;
144                 }
145 
146                 throw new com.liferay.portal.SystemException(e);
147             }
148 
149             return (com.liferay.portlet.tags.model.TagsEntry)returnObj;
150         }
151         catch (com.liferay.portal.SystemException se) {
152             _log.error(se, se);
153             throw se;
154         }
155     }
156 
157     public static void deleteEntry(HttpPrincipal httpPrincipal, long entryId)
158         throws com.liferay.portal.SystemException, 
159             com.liferay.portal.PortalException {
160         try {
161             Object paramObj0 = new LongWrapper(entryId);
162             MethodWrapper methodWrapper = new MethodWrapper(TagsEntryServiceUtil.class.getName(),
163                     "deleteEntry", new Object[] { paramObj0 });
164 
165             try {
166                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
167             }
168             catch (Exception e) {
169                 if (e instanceof com.liferay.portal.SystemException) {
170                     throw (com.liferay.portal.SystemException)e;
171                 }
172 
173                 if (e instanceof com.liferay.portal.PortalException) {
174                     throw (com.liferay.portal.PortalException)e;
175                 }
176 
177                 throw new com.liferay.portal.SystemException(e);
178             }
179         }
180         catch (com.liferay.portal.SystemException se) {
181             _log.error(se, se);
182             throw se;
183         }
184     }
185 
186     public static java.util.List getEntries(HttpPrincipal httpPrincipal,
187         java.lang.String className, long classPK)
188         throws com.liferay.portal.SystemException, 
189             com.liferay.portal.PortalException {
190         try {
191             Object paramObj0 = className;
192 
193             if (className == null) {
194                 paramObj0 = new NullWrapper("java.lang.String");
195             }
196 
197             Object paramObj1 = new LongWrapper(classPK);
198             MethodWrapper methodWrapper = new MethodWrapper(TagsEntryServiceUtil.class.getName(),
199                     "getEntries", new Object[] { paramObj0, paramObj1 });
200             Object returnObj = null;
201 
202             try {
203                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
204             }
205             catch (Exception e) {
206                 if (e instanceof com.liferay.portal.SystemException) {
207                     throw (com.liferay.portal.SystemException)e;
208                 }
209 
210                 if (e instanceof com.liferay.portal.PortalException) {
211                     throw (com.liferay.portal.PortalException)e;
212                 }
213 
214                 throw new com.liferay.portal.SystemException(e);
215             }
216 
217             return (java.util.List)returnObj;
218         }
219         catch (com.liferay.portal.SystemException se) {
220             _log.error(se, se);
221             throw se;
222         }
223     }
224 
225     public static java.util.List search(HttpPrincipal httpPrincipal,
226         long companyId, java.lang.String name, java.lang.String[] properties)
227         throws com.liferay.portal.SystemException {
228         try {
229             Object paramObj0 = new LongWrapper(companyId);
230             Object paramObj1 = name;
231 
232             if (name == null) {
233                 paramObj1 = new NullWrapper("java.lang.String");
234             }
235 
236             Object paramObj2 = properties;
237 
238             if (properties == null) {
239                 paramObj2 = new NullWrapper("[Ljava.lang.String;");
240             }
241 
242             MethodWrapper methodWrapper = new MethodWrapper(TagsEntryServiceUtil.class.getName(),
243                     "search", new Object[] { paramObj0, paramObj1, paramObj2 });
244             Object returnObj = null;
245 
246             try {
247                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
248             }
249             catch (Exception e) {
250                 if (e instanceof com.liferay.portal.SystemException) {
251                     throw (com.liferay.portal.SystemException)e;
252                 }
253 
254                 throw new com.liferay.portal.SystemException(e);
255             }
256 
257             return (java.util.List)returnObj;
258         }
259         catch (com.liferay.portal.SystemException se) {
260             _log.error(se, se);
261             throw se;
262         }
263     }
264 
265     public static java.util.List search(HttpPrincipal httpPrincipal,
266         long companyId, java.lang.String name, java.lang.String[] properties,
267         int begin, int end) throws com.liferay.portal.SystemException {
268         try {
269             Object paramObj0 = new LongWrapper(companyId);
270             Object paramObj1 = name;
271 
272             if (name == null) {
273                 paramObj1 = new NullWrapper("java.lang.String");
274             }
275 
276             Object paramObj2 = properties;
277 
278             if (properties == null) {
279                 paramObj2 = new NullWrapper("[Ljava.lang.String;");
280             }
281 
282             Object paramObj3 = new IntegerWrapper(begin);
283             Object paramObj4 = new IntegerWrapper(end);
284             MethodWrapper methodWrapper = new MethodWrapper(TagsEntryServiceUtil.class.getName(),
285                     "search",
286                     new Object[] {
287                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
288                     });
289             Object returnObj = null;
290 
291             try {
292                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
293             }
294             catch (Exception e) {
295                 if (e instanceof com.liferay.portal.SystemException) {
296                     throw (com.liferay.portal.SystemException)e;
297                 }
298 
299                 throw new com.liferay.portal.SystemException(e);
300             }
301 
302             return (java.util.List)returnObj;
303         }
304         catch (com.liferay.portal.SystemException se) {
305             _log.error(se, se);
306             throw se;
307         }
308     }
309 
310     public static com.liferay.portal.kernel.json.JSONArrayWrapper searchAutocomplete(
311         HttpPrincipal httpPrincipal, long companyId, java.lang.String name,
312         java.lang.String[] properties, int begin, int end)
313         throws com.liferay.portal.SystemException {
314         try {
315             Object paramObj0 = new LongWrapper(companyId);
316             Object paramObj1 = name;
317 
318             if (name == null) {
319                 paramObj1 = new NullWrapper("java.lang.String");
320             }
321 
322             Object paramObj2 = properties;
323 
324             if (properties == null) {
325                 paramObj2 = new NullWrapper("[Ljava.lang.String;");
326             }
327 
328             Object paramObj3 = new IntegerWrapper(begin);
329             Object paramObj4 = new IntegerWrapper(end);
330             MethodWrapper methodWrapper = new MethodWrapper(TagsEntryServiceUtil.class.getName(),
331                     "searchAutocomplete",
332                     new Object[] {
333                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
334                     });
335             Object returnObj = null;
336 
337             try {
338                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
339             }
340             catch (Exception e) {
341                 if (e instanceof com.liferay.portal.SystemException) {
342                     throw (com.liferay.portal.SystemException)e;
343                 }
344 
345                 throw new com.liferay.portal.SystemException(e);
346             }
347 
348             return (com.liferay.portal.kernel.json.JSONArrayWrapper)returnObj;
349         }
350         catch (com.liferay.portal.SystemException se) {
351             _log.error(se, se);
352             throw se;
353         }
354     }
355 
356     public static int searchCount(HttpPrincipal httpPrincipal, long companyId,
357         java.lang.String name, java.lang.String[] properties)
358         throws com.liferay.portal.SystemException {
359         try {
360             Object paramObj0 = new LongWrapper(companyId);
361             Object paramObj1 = name;
362 
363             if (name == null) {
364                 paramObj1 = new NullWrapper("java.lang.String");
365             }
366 
367             Object paramObj2 = properties;
368 
369             if (properties == null) {
370                 paramObj2 = new NullWrapper("[Ljava.lang.String;");
371             }
372 
373             MethodWrapper methodWrapper = new MethodWrapper(TagsEntryServiceUtil.class.getName(),
374                     "searchCount",
375                     new Object[] { paramObj0, paramObj1, paramObj2 });
376             Object returnObj = null;
377 
378             try {
379                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
380             }
381             catch (Exception e) {
382                 if (e instanceof com.liferay.portal.SystemException) {
383                     throw (com.liferay.portal.SystemException)e;
384                 }
385 
386                 throw new com.liferay.portal.SystemException(e);
387             }
388 
389             return ((Integer)returnObj).intValue();
390         }
391         catch (com.liferay.portal.SystemException se) {
392             _log.error(se, se);
393             throw se;
394         }
395     }
396 
397     public static com.liferay.portlet.tags.model.TagsEntry updateEntry(
398         HttpPrincipal httpPrincipal, long entryId, java.lang.String name)
399         throws com.liferay.portal.SystemException, 
400             com.liferay.portal.PortalException {
401         try {
402             Object paramObj0 = new LongWrapper(entryId);
403             Object paramObj1 = name;
404 
405             if (name == null) {
406                 paramObj1 = new NullWrapper("java.lang.String");
407             }
408 
409             MethodWrapper methodWrapper = new MethodWrapper(TagsEntryServiceUtil.class.getName(),
410                     "updateEntry", new Object[] { paramObj0, paramObj1 });
411             Object returnObj = null;
412 
413             try {
414                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
415             }
416             catch (Exception e) {
417                 if (e instanceof com.liferay.portal.SystemException) {
418                     throw (com.liferay.portal.SystemException)e;
419                 }
420 
421                 if (e instanceof com.liferay.portal.PortalException) {
422                     throw (com.liferay.portal.PortalException)e;
423                 }
424 
425                 throw new com.liferay.portal.SystemException(e);
426             }
427 
428             return (com.liferay.portlet.tags.model.TagsEntry)returnObj;
429         }
430         catch (com.liferay.portal.SystemException se) {
431             _log.error(se, se);
432             throw se;
433         }
434     }
435 
436     public static com.liferay.portlet.tags.model.TagsEntry updateEntry(
437         HttpPrincipal httpPrincipal, long entryId, java.lang.String name,
438         java.lang.String[] properties)
439         throws com.liferay.portal.SystemException, 
440             com.liferay.portal.PortalException {
441         try {
442             Object paramObj0 = new LongWrapper(entryId);
443             Object paramObj1 = name;
444 
445             if (name == null) {
446                 paramObj1 = new NullWrapper("java.lang.String");
447             }
448 
449             Object paramObj2 = properties;
450 
451             if (properties == null) {
452                 paramObj2 = new NullWrapper("[Ljava.lang.String;");
453             }
454 
455             MethodWrapper methodWrapper = new MethodWrapper(TagsEntryServiceUtil.class.getName(),
456                     "updateEntry",
457                     new Object[] { paramObj0, paramObj1, paramObj2 });
458             Object returnObj = null;
459 
460             try {
461                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
462             }
463             catch (Exception e) {
464                 if (e instanceof com.liferay.portal.SystemException) {
465                     throw (com.liferay.portal.SystemException)e;
466                 }
467 
468                 if (e instanceof com.liferay.portal.PortalException) {
469                     throw (com.liferay.portal.PortalException)e;
470                 }
471 
472                 throw new com.liferay.portal.SystemException(e);
473             }
474 
475             return (com.liferay.portlet.tags.model.TagsEntry)returnObj;
476         }
477         catch (com.liferay.portal.SystemException se) {
478             _log.error(se, se);
479             throw se;
480         }
481     }
482 
483     private static Log _log = LogFactoryUtil.getLog(TagsEntryServiceHttp.class);
484 }