1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet.asset.service.http;
16  
17  import com.liferay.portal.kernel.log.Log;
18  import com.liferay.portal.kernel.log.LogFactoryUtil;
19  import com.liferay.portal.kernel.util.IntegerWrapper;
20  import com.liferay.portal.kernel.util.LongWrapper;
21  import com.liferay.portal.kernel.util.MethodWrapper;
22  import com.liferay.portal.kernel.util.NullWrapper;
23  import com.liferay.portal.security.auth.HttpPrincipal;
24  import com.liferay.portal.service.http.TunnelUtil;
25  
26  import com.liferay.portlet.asset.service.AssetTagServiceUtil;
27  
28  /**
29   * <a href="AssetTagServiceHttp.java.html"><b><i>View Source</i></b></a>
30   *
31   * <p>
32   * ServiceBuilder generated this class. Modifications in this class will be
33   * overwritten the next time is generated.
34   * </p>
35   *
36   * <p>
37   * This class provides a HTTP utility for the
38   * {@link com.liferay.portlet.asset.service.AssetTagServiceUtil} service utility. The
39   * static methods of this class calls the same methods of the service utility.
40   * However, the signatures are different because it requires an additional
41   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
42   * </p>
43   *
44   * <p>
45   * The benefits of using the HTTP utility is that it is fast and allows for
46   * tunneling without the cost of serializing to text. The drawback is that it
47   * only works with Java.
48   * </p>
49   *
50   * <p>
51   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
52   * configure security.
53   * </p>
54   *
55   * <p>
56   * The HTTP utility is only generated for remote services.
57   * </p>
58   *
59   * @author    Brian Wing Shun Chan
60   * @see       AssetTagServiceSoap
61   * @see       com.liferay.portal.security.auth.HttpPrincipal
62   * @see       com.liferay.portlet.asset.service.AssetTagServiceUtil
63   * @generated
64   */
65  public class AssetTagServiceHttp {
66      public static com.liferay.portlet.asset.model.AssetTag addTag(
67          HttpPrincipal httpPrincipal, java.lang.String name,
68          java.lang.String[] tagProperties,
69          com.liferay.portal.service.ServiceContext serviceContext)
70          throws com.liferay.portal.kernel.exception.PortalException,
71              com.liferay.portal.kernel.exception.SystemException {
72          try {
73              Object paramObj0 = name;
74  
75              if (name == null) {
76                  paramObj0 = new NullWrapper("java.lang.String");
77              }
78  
79              Object paramObj1 = tagProperties;
80  
81              if (tagProperties == null) {
82                  paramObj1 = new NullWrapper("[Ljava.lang.String;");
83              }
84  
85              Object paramObj2 = serviceContext;
86  
87              if (serviceContext == null) {
88                  paramObj2 = new NullWrapper(
89                          "com.liferay.portal.service.ServiceContext");
90              }
91  
92              MethodWrapper methodWrapper = new MethodWrapper(AssetTagServiceUtil.class.getName(),
93                      "addTag", new Object[] { paramObj0, paramObj1, paramObj2 });
94  
95              Object returnObj = null;
96  
97              try {
98                  returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
99              }
100             catch (Exception e) {
101                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
102                     throw (com.liferay.portal.kernel.exception.PortalException)e;
103                 }
104 
105                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
106                     throw (com.liferay.portal.kernel.exception.SystemException)e;
107                 }
108 
109                 throw new com.liferay.portal.kernel.exception.SystemException(e);
110             }
111 
112             return (com.liferay.portlet.asset.model.AssetTag)returnObj;
113         }
114         catch (com.liferay.portal.kernel.exception.SystemException se) {
115             _log.error(se, se);
116 
117             throw se;
118         }
119     }
120 
121     public static void deleteTag(HttpPrincipal httpPrincipal, long tagId)
122         throws com.liferay.portal.kernel.exception.PortalException,
123             com.liferay.portal.kernel.exception.SystemException {
124         try {
125             Object paramObj0 = new LongWrapper(tagId);
126 
127             MethodWrapper methodWrapper = new MethodWrapper(AssetTagServiceUtil.class.getName(),
128                     "deleteTag", new Object[] { paramObj0 });
129 
130             try {
131                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
132             }
133             catch (Exception e) {
134                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
135                     throw (com.liferay.portal.kernel.exception.PortalException)e;
136                 }
137 
138                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
139                     throw (com.liferay.portal.kernel.exception.SystemException)e;
140                 }
141 
142                 throw new com.liferay.portal.kernel.exception.SystemException(e);
143             }
144         }
145         catch (com.liferay.portal.kernel.exception.SystemException se) {
146             _log.error(se, se);
147 
148             throw se;
149         }
150     }
151 
152     public static java.util.List<com.liferay.portlet.asset.model.AssetTag> getGroupTags(
153         HttpPrincipal httpPrincipal, long groupId)
154         throws com.liferay.portal.kernel.exception.PortalException,
155             com.liferay.portal.kernel.exception.SystemException {
156         try {
157             Object paramObj0 = new LongWrapper(groupId);
158 
159             MethodWrapper methodWrapper = new MethodWrapper(AssetTagServiceUtil.class.getName(),
160                     "getGroupTags", new Object[] { paramObj0 });
161 
162             Object returnObj = null;
163 
164             try {
165                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
166             }
167             catch (Exception e) {
168                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
169                     throw (com.liferay.portal.kernel.exception.PortalException)e;
170                 }
171 
172                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
173                     throw (com.liferay.portal.kernel.exception.SystemException)e;
174                 }
175 
176                 throw new com.liferay.portal.kernel.exception.SystemException(e);
177             }
178 
179             return (java.util.List<com.liferay.portlet.asset.model.AssetTag>)returnObj;
180         }
181         catch (com.liferay.portal.kernel.exception.SystemException se) {
182             _log.error(se, se);
183 
184             throw se;
185         }
186     }
187 
188     public static com.liferay.portlet.asset.model.AssetTag getTag(
189         HttpPrincipal httpPrincipal, long tagId)
190         throws com.liferay.portal.kernel.exception.PortalException,
191             com.liferay.portal.kernel.exception.SystemException {
192         try {
193             Object paramObj0 = new LongWrapper(tagId);
194 
195             MethodWrapper methodWrapper = new MethodWrapper(AssetTagServiceUtil.class.getName(),
196                     "getTag", new Object[] { paramObj0 });
197 
198             Object returnObj = null;
199 
200             try {
201                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
202             }
203             catch (Exception e) {
204                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
205                     throw (com.liferay.portal.kernel.exception.PortalException)e;
206                 }
207 
208                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
209                     throw (com.liferay.portal.kernel.exception.SystemException)e;
210                 }
211 
212                 throw new com.liferay.portal.kernel.exception.SystemException(e);
213             }
214 
215             return (com.liferay.portlet.asset.model.AssetTag)returnObj;
216         }
217         catch (com.liferay.portal.kernel.exception.SystemException se) {
218             _log.error(se, se);
219 
220             throw se;
221         }
222     }
223 
224     public static java.util.List<com.liferay.portlet.asset.model.AssetTag> getTags(
225         HttpPrincipal httpPrincipal, long groupId, long classNameId,
226         java.lang.String name)
227         throws com.liferay.portal.kernel.exception.PortalException,
228             com.liferay.portal.kernel.exception.SystemException {
229         try {
230             Object paramObj0 = new LongWrapper(groupId);
231 
232             Object paramObj1 = new LongWrapper(classNameId);
233 
234             Object paramObj2 = name;
235 
236             if (name == null) {
237                 paramObj2 = new NullWrapper("java.lang.String");
238             }
239 
240             MethodWrapper methodWrapper = new MethodWrapper(AssetTagServiceUtil.class.getName(),
241                     "getTags", new Object[] { paramObj0, paramObj1, paramObj2 });
242 
243             Object returnObj = null;
244 
245             try {
246                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
247             }
248             catch (Exception e) {
249                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
250                     throw (com.liferay.portal.kernel.exception.PortalException)e;
251                 }
252 
253                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
254                     throw (com.liferay.portal.kernel.exception.SystemException)e;
255                 }
256 
257                 throw new com.liferay.portal.kernel.exception.SystemException(e);
258             }
259 
260             return (java.util.List<com.liferay.portlet.asset.model.AssetTag>)returnObj;
261         }
262         catch (com.liferay.portal.kernel.exception.SystemException se) {
263             _log.error(se, se);
264 
265             throw se;
266         }
267     }
268 
269     public static java.util.List<com.liferay.portlet.asset.model.AssetTag> getTags(
270         HttpPrincipal httpPrincipal, java.lang.String className, long classPK)
271         throws com.liferay.portal.kernel.exception.PortalException,
272             com.liferay.portal.kernel.exception.SystemException {
273         try {
274             Object paramObj0 = className;
275 
276             if (className == null) {
277                 paramObj0 = new NullWrapper("java.lang.String");
278             }
279 
280             Object paramObj1 = new LongWrapper(classPK);
281 
282             MethodWrapper methodWrapper = new MethodWrapper(AssetTagServiceUtil.class.getName(),
283                     "getTags", new Object[] { paramObj0, paramObj1 });
284 
285             Object returnObj = null;
286 
287             try {
288                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
289             }
290             catch (Exception e) {
291                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
292                     throw (com.liferay.portal.kernel.exception.PortalException)e;
293                 }
294 
295                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
296                     throw (com.liferay.portal.kernel.exception.SystemException)e;
297                 }
298 
299                 throw new com.liferay.portal.kernel.exception.SystemException(e);
300             }
301 
302             return (java.util.List<com.liferay.portlet.asset.model.AssetTag>)returnObj;
303         }
304         catch (com.liferay.portal.kernel.exception.SystemException se) {
305             _log.error(se, se);
306 
307             throw se;
308         }
309     }
310 
311     public static void mergeTags(HttpPrincipal httpPrincipal, long fromTagId,
312         long toTagId)
313         throws com.liferay.portal.kernel.exception.PortalException,
314             com.liferay.portal.kernel.exception.SystemException {
315         try {
316             Object paramObj0 = new LongWrapper(fromTagId);
317 
318             Object paramObj1 = new LongWrapper(toTagId);
319 
320             MethodWrapper methodWrapper = new MethodWrapper(AssetTagServiceUtil.class.getName(),
321                     "mergeTags", new Object[] { paramObj0, paramObj1 });
322 
323             try {
324                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
325             }
326             catch (Exception e) {
327                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
328                     throw (com.liferay.portal.kernel.exception.PortalException)e;
329                 }
330 
331                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
332                     throw (com.liferay.portal.kernel.exception.SystemException)e;
333                 }
334 
335                 throw new com.liferay.portal.kernel.exception.SystemException(e);
336             }
337         }
338         catch (com.liferay.portal.kernel.exception.SystemException se) {
339             _log.error(se, se);
340 
341             throw se;
342         }
343     }
344 
345     public static com.liferay.portal.kernel.json.JSONArray search(
346         HttpPrincipal httpPrincipal, long groupId, java.lang.String name,
347         java.lang.String[] tagProperties, int start, int end)
348         throws com.liferay.portal.kernel.exception.SystemException {
349         try {
350             Object paramObj0 = new LongWrapper(groupId);
351 
352             Object paramObj1 = name;
353 
354             if (name == null) {
355                 paramObj1 = new NullWrapper("java.lang.String");
356             }
357 
358             Object paramObj2 = tagProperties;
359 
360             if (tagProperties == null) {
361                 paramObj2 = new NullWrapper("[Ljava.lang.String;");
362             }
363 
364             Object paramObj3 = new IntegerWrapper(start);
365 
366             Object paramObj4 = new IntegerWrapper(end);
367 
368             MethodWrapper methodWrapper = new MethodWrapper(AssetTagServiceUtil.class.getName(),
369                     "search",
370                     new Object[] {
371                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
372                     });
373 
374             Object returnObj = null;
375 
376             try {
377                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
378             }
379             catch (Exception e) {
380                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
381                     throw (com.liferay.portal.kernel.exception.SystemException)e;
382                 }
383 
384                 throw new com.liferay.portal.kernel.exception.SystemException(e);
385             }
386 
387             return (com.liferay.portal.kernel.json.JSONArray)returnObj;
388         }
389         catch (com.liferay.portal.kernel.exception.SystemException se) {
390             _log.error(se, se);
391 
392             throw se;
393         }
394     }
395 
396     public static com.liferay.portlet.asset.model.AssetTag updateTag(
397         HttpPrincipal httpPrincipal, long tagId, java.lang.String name,
398         java.lang.String[] tagProperties,
399         com.liferay.portal.service.ServiceContext serviceContext)
400         throws com.liferay.portal.kernel.exception.PortalException,
401             com.liferay.portal.kernel.exception.SystemException {
402         try {
403             Object paramObj0 = new LongWrapper(tagId);
404 
405             Object paramObj1 = name;
406 
407             if (name == null) {
408                 paramObj1 = new NullWrapper("java.lang.String");
409             }
410 
411             Object paramObj2 = tagProperties;
412 
413             if (tagProperties == null) {
414                 paramObj2 = new NullWrapper("[Ljava.lang.String;");
415             }
416 
417             Object paramObj3 = serviceContext;
418 
419             if (serviceContext == null) {
420                 paramObj3 = new NullWrapper(
421                         "com.liferay.portal.service.ServiceContext");
422             }
423 
424             MethodWrapper methodWrapper = new MethodWrapper(AssetTagServiceUtil.class.getName(),
425                     "updateTag",
426                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
427 
428             Object returnObj = null;
429 
430             try {
431                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
432             }
433             catch (Exception e) {
434                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
435                     throw (com.liferay.portal.kernel.exception.PortalException)e;
436                 }
437 
438                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
439                     throw (com.liferay.portal.kernel.exception.SystemException)e;
440                 }
441 
442                 throw new com.liferay.portal.kernel.exception.SystemException(e);
443             }
444 
445             return (com.liferay.portlet.asset.model.AssetTag)returnObj;
446         }
447         catch (com.liferay.portal.kernel.exception.SystemException se) {
448             _log.error(se, se);
449 
450             throw se;
451         }
452     }
453 
454     private static Log _log = LogFactoryUtil.getLog(AssetTagServiceHttp.class);
455 }