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.AssetCategoryServiceUtil;
27  
28  /**
29   * <a href="AssetCategoryServiceHttp.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.AssetCategoryServiceUtil} 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       AssetCategoryServiceSoap
61   * @see       com.liferay.portal.security.auth.HttpPrincipal
62   * @see       com.liferay.portlet.asset.service.AssetCategoryServiceUtil
63   * @generated
64   */
65  public class AssetCategoryServiceHttp {
66      public static com.liferay.portlet.asset.model.AssetCategory addCategory(
67          HttpPrincipal httpPrincipal, long parentCategoryId,
68          java.util.Map<java.util.Locale, String> titleMap, long vocabularyId,
69          java.lang.String[] categoryProperties,
70          com.liferay.portal.service.ServiceContext serviceContext)
71          throws com.liferay.portal.kernel.exception.PortalException,
72              com.liferay.portal.kernel.exception.SystemException {
73          try {
74              Object paramObj0 = new LongWrapper(parentCategoryId);
75  
76              Object paramObj1 = titleMap;
77  
78              if (titleMap == null) {
79                  paramObj1 = new NullWrapper("java.util.Map");
80              }
81  
82              Object paramObj2 = new LongWrapper(vocabularyId);
83  
84              Object paramObj3 = categoryProperties;
85  
86              if (categoryProperties == null) {
87                  paramObj3 = new NullWrapper("[Ljava.lang.String;");
88              }
89  
90              Object paramObj4 = serviceContext;
91  
92              if (serviceContext == null) {
93                  paramObj4 = new NullWrapper(
94                          "com.liferay.portal.service.ServiceContext");
95              }
96  
97              MethodWrapper methodWrapper = new MethodWrapper(AssetCategoryServiceUtil.class.getName(),
98                      "addCategory",
99                      new Object[] {
100                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
101                     });
102 
103             Object returnObj = null;
104 
105             try {
106                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
107             }
108             catch (Exception e) {
109                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
110                     throw (com.liferay.portal.kernel.exception.PortalException)e;
111                 }
112 
113                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
114                     throw (com.liferay.portal.kernel.exception.SystemException)e;
115                 }
116 
117                 throw new com.liferay.portal.kernel.exception.SystemException(e);
118             }
119 
120             return (com.liferay.portlet.asset.model.AssetCategory)returnObj;
121         }
122         catch (com.liferay.portal.kernel.exception.SystemException se) {
123             _log.error(se, se);
124 
125             throw se;
126         }
127     }
128 
129     public static void deleteCategory(HttpPrincipal httpPrincipal,
130         long categoryId)
131         throws com.liferay.portal.kernel.exception.PortalException,
132             com.liferay.portal.kernel.exception.SystemException {
133         try {
134             Object paramObj0 = new LongWrapper(categoryId);
135 
136             MethodWrapper methodWrapper = new MethodWrapper(AssetCategoryServiceUtil.class.getName(),
137                     "deleteCategory", new Object[] { paramObj0 });
138 
139             try {
140                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
141             }
142             catch (Exception e) {
143                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
144                     throw (com.liferay.portal.kernel.exception.PortalException)e;
145                 }
146 
147                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
148                     throw (com.liferay.portal.kernel.exception.SystemException)e;
149                 }
150 
151                 throw new com.liferay.portal.kernel.exception.SystemException(e);
152             }
153         }
154         catch (com.liferay.portal.kernel.exception.SystemException se) {
155             _log.error(se, se);
156 
157             throw se;
158         }
159     }
160 
161     public static java.util.List<com.liferay.portlet.asset.model.AssetCategory> getCategories(
162         HttpPrincipal httpPrincipal, java.lang.String className, long classPK)
163         throws com.liferay.portal.kernel.exception.PortalException,
164             com.liferay.portal.kernel.exception.SystemException {
165         try {
166             Object paramObj0 = className;
167 
168             if (className == null) {
169                 paramObj0 = new NullWrapper("java.lang.String");
170             }
171 
172             Object paramObj1 = new LongWrapper(classPK);
173 
174             MethodWrapper methodWrapper = new MethodWrapper(AssetCategoryServiceUtil.class.getName(),
175                     "getCategories", new Object[] { paramObj0, paramObj1 });
176 
177             Object returnObj = null;
178 
179             try {
180                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
181             }
182             catch (Exception e) {
183                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
184                     throw (com.liferay.portal.kernel.exception.PortalException)e;
185                 }
186 
187                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
188                     throw (com.liferay.portal.kernel.exception.SystemException)e;
189                 }
190 
191                 throw new com.liferay.portal.kernel.exception.SystemException(e);
192             }
193 
194             return (java.util.List<com.liferay.portlet.asset.model.AssetCategory>)returnObj;
195         }
196         catch (com.liferay.portal.kernel.exception.SystemException se) {
197             _log.error(se, se);
198 
199             throw se;
200         }
201     }
202 
203     public static com.liferay.portlet.asset.model.AssetCategory getCategory(
204         HttpPrincipal httpPrincipal, long categoryId)
205         throws com.liferay.portal.kernel.exception.PortalException,
206             com.liferay.portal.kernel.exception.SystemException {
207         try {
208             Object paramObj0 = new LongWrapper(categoryId);
209 
210             MethodWrapper methodWrapper = new MethodWrapper(AssetCategoryServiceUtil.class.getName(),
211                     "getCategory", new Object[] { paramObj0 });
212 
213             Object returnObj = null;
214 
215             try {
216                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
217             }
218             catch (Exception e) {
219                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
220                     throw (com.liferay.portal.kernel.exception.PortalException)e;
221                 }
222 
223                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
224                     throw (com.liferay.portal.kernel.exception.SystemException)e;
225                 }
226 
227                 throw new com.liferay.portal.kernel.exception.SystemException(e);
228             }
229 
230             return (com.liferay.portlet.asset.model.AssetCategory)returnObj;
231         }
232         catch (com.liferay.portal.kernel.exception.SystemException se) {
233             _log.error(se, se);
234 
235             throw se;
236         }
237     }
238 
239     public static java.util.List<com.liferay.portlet.asset.model.AssetCategory> getChildCategories(
240         HttpPrincipal httpPrincipal, long parentCategoryId)
241         throws com.liferay.portal.kernel.exception.PortalException,
242             com.liferay.portal.kernel.exception.SystemException {
243         try {
244             Object paramObj0 = new LongWrapper(parentCategoryId);
245 
246             MethodWrapper methodWrapper = new MethodWrapper(AssetCategoryServiceUtil.class.getName(),
247                     "getChildCategories", new Object[] { paramObj0 });
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.kernel.exception.PortalException) {
256                     throw (com.liferay.portal.kernel.exception.PortalException)e;
257                 }
258 
259                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
260                     throw (com.liferay.portal.kernel.exception.SystemException)e;
261                 }
262 
263                 throw new com.liferay.portal.kernel.exception.SystemException(e);
264             }
265 
266             return (java.util.List<com.liferay.portlet.asset.model.AssetCategory>)returnObj;
267         }
268         catch (com.liferay.portal.kernel.exception.SystemException se) {
269             _log.error(se, se);
270 
271             throw se;
272         }
273     }
274 
275     public static java.util.List<com.liferay.portlet.asset.model.AssetCategory> getVocabularyCategories(
276         HttpPrincipal httpPrincipal, long vocabularyId)
277         throws com.liferay.portal.kernel.exception.PortalException,
278             com.liferay.portal.kernel.exception.SystemException {
279         try {
280             Object paramObj0 = new LongWrapper(vocabularyId);
281 
282             MethodWrapper methodWrapper = new MethodWrapper(AssetCategoryServiceUtil.class.getName(),
283                     "getVocabularyCategories", new Object[] { paramObj0 });
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.AssetCategory>)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 java.util.List<com.liferay.portlet.asset.model.AssetCategory> getVocabularyRootCategories(
312         HttpPrincipal httpPrincipal, long vocabularyId)
313         throws com.liferay.portal.kernel.exception.PortalException,
314             com.liferay.portal.kernel.exception.SystemException {
315         try {
316             Object paramObj0 = new LongWrapper(vocabularyId);
317 
318             MethodWrapper methodWrapper = new MethodWrapper(AssetCategoryServiceUtil.class.getName(),
319                     "getVocabularyRootCategories", new Object[] { paramObj0 });
320 
321             Object returnObj = null;
322 
323             try {
324                 returnObj = 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             return (java.util.List<com.liferay.portlet.asset.model.AssetCategory>)returnObj;
339         }
340         catch (com.liferay.portal.kernel.exception.SystemException se) {
341             _log.error(se, se);
342 
343             throw se;
344         }
345     }
346 
347     public static com.liferay.portal.kernel.json.JSONArray search(
348         HttpPrincipal httpPrincipal, long groupId, java.lang.String name,
349         java.lang.String[] categoryProperties, int start, int end)
350         throws com.liferay.portal.kernel.exception.SystemException {
351         try {
352             Object paramObj0 = new LongWrapper(groupId);
353 
354             Object paramObj1 = name;
355 
356             if (name == null) {
357                 paramObj1 = new NullWrapper("java.lang.String");
358             }
359 
360             Object paramObj2 = categoryProperties;
361 
362             if (categoryProperties == null) {
363                 paramObj2 = new NullWrapper("[Ljava.lang.String;");
364             }
365 
366             Object paramObj3 = new IntegerWrapper(start);
367 
368             Object paramObj4 = new IntegerWrapper(end);
369 
370             MethodWrapper methodWrapper = new MethodWrapper(AssetCategoryServiceUtil.class.getName(),
371                     "search",
372                     new Object[] {
373                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
374                     });
375 
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.kernel.exception.SystemException) {
383                     throw (com.liferay.portal.kernel.exception.SystemException)e;
384                 }
385 
386                 throw new com.liferay.portal.kernel.exception.SystemException(e);
387             }
388 
389             return (com.liferay.portal.kernel.json.JSONArray)returnObj;
390         }
391         catch (com.liferay.portal.kernel.exception.SystemException se) {
392             _log.error(se, se);
393 
394             throw se;
395         }
396     }
397 
398     public static com.liferay.portlet.asset.model.AssetCategory updateCategory(
399         HttpPrincipal httpPrincipal, long categoryId, long parentCategoryId,
400         java.util.Map<java.util.Locale, String> titleMap, long vocabularyId,
401         java.lang.String[] categoryProperties,
402         com.liferay.portal.service.ServiceContext serviceContext)
403         throws com.liferay.portal.kernel.exception.PortalException,
404             com.liferay.portal.kernel.exception.SystemException {
405         try {
406             Object paramObj0 = new LongWrapper(categoryId);
407 
408             Object paramObj1 = new LongWrapper(parentCategoryId);
409 
410             Object paramObj2 = titleMap;
411 
412             if (titleMap == null) {
413                 paramObj2 = new NullWrapper("java.util.Map");
414             }
415 
416             Object paramObj3 = new LongWrapper(vocabularyId);
417 
418             Object paramObj4 = categoryProperties;
419 
420             if (categoryProperties == null) {
421                 paramObj4 = new NullWrapper("[Ljava.lang.String;");
422             }
423 
424             Object paramObj5 = serviceContext;
425 
426             if (serviceContext == null) {
427                 paramObj5 = new NullWrapper(
428                         "com.liferay.portal.service.ServiceContext");
429             }
430 
431             MethodWrapper methodWrapper = new MethodWrapper(AssetCategoryServiceUtil.class.getName(),
432                     "updateCategory",
433                     new Object[] {
434                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
435                         paramObj5
436                     });
437 
438             Object returnObj = null;
439 
440             try {
441                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
442             }
443             catch (Exception e) {
444                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
445                     throw (com.liferay.portal.kernel.exception.PortalException)e;
446                 }
447 
448                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
449                     throw (com.liferay.portal.kernel.exception.SystemException)e;
450                 }
451 
452                 throw new com.liferay.portal.kernel.exception.SystemException(e);
453             }
454 
455             return (com.liferay.portlet.asset.model.AssetCategory)returnObj;
456         }
457         catch (com.liferay.portal.kernel.exception.SystemException se) {
458             _log.error(se, se);
459 
460             throw se;
461         }
462     }
463 
464     private static Log _log = LogFactoryUtil.getLog(AssetCategoryServiceHttp.class);
465 }