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, java.lang.String> titleMap,
69          long vocabularyId, 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, int start, int end,
241         com.liferay.portal.kernel.util.OrderByComparator obc)
242         throws com.liferay.portal.kernel.exception.PortalException,
243             com.liferay.portal.kernel.exception.SystemException {
244         try {
245             Object paramObj0 = new LongWrapper(parentCategoryId);
246 
247             Object paramObj1 = new IntegerWrapper(start);
248 
249             Object paramObj2 = new IntegerWrapper(end);
250 
251             Object paramObj3 = obc;
252 
253             if (obc == null) {
254                 paramObj3 = new NullWrapper(
255                         "com.liferay.portal.kernel.util.OrderByComparator");
256             }
257 
258             MethodWrapper methodWrapper = new MethodWrapper(AssetCategoryServiceUtil.class.getName(),
259                     "getChildCategories",
260                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
261 
262             Object returnObj = null;
263 
264             try {
265                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
266             }
267             catch (Exception e) {
268                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
269                     throw (com.liferay.portal.kernel.exception.PortalException)e;
270                 }
271 
272                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
273                     throw (com.liferay.portal.kernel.exception.SystemException)e;
274                 }
275 
276                 throw new com.liferay.portal.kernel.exception.SystemException(e);
277             }
278 
279             return (java.util.List<com.liferay.portlet.asset.model.AssetCategory>)returnObj;
280         }
281         catch (com.liferay.portal.kernel.exception.SystemException se) {
282             _log.error(se, se);
283 
284             throw se;
285         }
286     }
287 
288     public static java.util.List<com.liferay.portlet.asset.model.AssetCategory> getVocabularyCategories(
289         HttpPrincipal httpPrincipal, long vocabularyId, int start, int end,
290         com.liferay.portal.kernel.util.OrderByComparator obc)
291         throws com.liferay.portal.kernel.exception.PortalException,
292             com.liferay.portal.kernel.exception.SystemException {
293         try {
294             Object paramObj0 = new LongWrapper(vocabularyId);
295 
296             Object paramObj1 = new IntegerWrapper(start);
297 
298             Object paramObj2 = new IntegerWrapper(end);
299 
300             Object paramObj3 = obc;
301 
302             if (obc == null) {
303                 paramObj3 = new NullWrapper(
304                         "com.liferay.portal.kernel.util.OrderByComparator");
305             }
306 
307             MethodWrapper methodWrapper = new MethodWrapper(AssetCategoryServiceUtil.class.getName(),
308                     "getVocabularyCategories",
309                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
310 
311             Object returnObj = null;
312 
313             try {
314                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
315             }
316             catch (Exception e) {
317                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
318                     throw (com.liferay.portal.kernel.exception.PortalException)e;
319                 }
320 
321                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
322                     throw (com.liferay.portal.kernel.exception.SystemException)e;
323                 }
324 
325                 throw new com.liferay.portal.kernel.exception.SystemException(e);
326             }
327 
328             return (java.util.List<com.liferay.portlet.asset.model.AssetCategory>)returnObj;
329         }
330         catch (com.liferay.portal.kernel.exception.SystemException se) {
331             _log.error(se, se);
332 
333             throw se;
334         }
335     }
336 
337     public static java.util.List<com.liferay.portlet.asset.model.AssetCategory> getVocabularyRootCategories(
338         HttpPrincipal httpPrincipal, long vocabularyId, int start, int end,
339         com.liferay.portal.kernel.util.OrderByComparator obc)
340         throws com.liferay.portal.kernel.exception.PortalException,
341             com.liferay.portal.kernel.exception.SystemException {
342         try {
343             Object paramObj0 = new LongWrapper(vocabularyId);
344 
345             Object paramObj1 = new IntegerWrapper(start);
346 
347             Object paramObj2 = new IntegerWrapper(end);
348 
349             Object paramObj3 = obc;
350 
351             if (obc == null) {
352                 paramObj3 = new NullWrapper(
353                         "com.liferay.portal.kernel.util.OrderByComparator");
354             }
355 
356             MethodWrapper methodWrapper = new MethodWrapper(AssetCategoryServiceUtil.class.getName(),
357                     "getVocabularyRootCategories",
358                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
359 
360             Object returnObj = null;
361 
362             try {
363                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
364             }
365             catch (Exception e) {
366                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
367                     throw (com.liferay.portal.kernel.exception.PortalException)e;
368                 }
369 
370                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
371                     throw (com.liferay.portal.kernel.exception.SystemException)e;
372                 }
373 
374                 throw new com.liferay.portal.kernel.exception.SystemException(e);
375             }
376 
377             return (java.util.List<com.liferay.portlet.asset.model.AssetCategory>)returnObj;
378         }
379         catch (com.liferay.portal.kernel.exception.SystemException se) {
380             _log.error(se, se);
381 
382             throw se;
383         }
384     }
385 
386     public static com.liferay.portal.kernel.json.JSONArray search(
387         HttpPrincipal httpPrincipal, long groupId, java.lang.String name,
388         java.lang.String[] categoryProperties, int start, int end)
389         throws com.liferay.portal.kernel.exception.SystemException {
390         try {
391             Object paramObj0 = new LongWrapper(groupId);
392 
393             Object paramObj1 = name;
394 
395             if (name == null) {
396                 paramObj1 = new NullWrapper("java.lang.String");
397             }
398 
399             Object paramObj2 = categoryProperties;
400 
401             if (categoryProperties == null) {
402                 paramObj2 = new NullWrapper("[Ljava.lang.String;");
403             }
404 
405             Object paramObj3 = new IntegerWrapper(start);
406 
407             Object paramObj4 = new IntegerWrapper(end);
408 
409             MethodWrapper methodWrapper = new MethodWrapper(AssetCategoryServiceUtil.class.getName(),
410                     "search",
411                     new Object[] {
412                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
413                     });
414 
415             Object returnObj = null;
416 
417             try {
418                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
419             }
420             catch (Exception e) {
421                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
422                     throw (com.liferay.portal.kernel.exception.SystemException)e;
423                 }
424 
425                 throw new com.liferay.portal.kernel.exception.SystemException(e);
426             }
427 
428             return (com.liferay.portal.kernel.json.JSONArray)returnObj;
429         }
430         catch (com.liferay.portal.kernel.exception.SystemException se) {
431             _log.error(se, se);
432 
433             throw se;
434         }
435     }
436 
437     public static com.liferay.portlet.asset.model.AssetCategory updateCategory(
438         HttpPrincipal httpPrincipal, long categoryId, long parentCategoryId,
439         java.util.Map<java.util.Locale, java.lang.String> titleMap,
440         long vocabularyId, java.lang.String[] categoryProperties,
441         com.liferay.portal.service.ServiceContext serviceContext)
442         throws com.liferay.portal.kernel.exception.PortalException,
443             com.liferay.portal.kernel.exception.SystemException {
444         try {
445             Object paramObj0 = new LongWrapper(categoryId);
446 
447             Object paramObj1 = new LongWrapper(parentCategoryId);
448 
449             Object paramObj2 = titleMap;
450 
451             if (titleMap == null) {
452                 paramObj2 = new NullWrapper("java.util.Map");
453             }
454 
455             Object paramObj3 = new LongWrapper(vocabularyId);
456 
457             Object paramObj4 = categoryProperties;
458 
459             if (categoryProperties == null) {
460                 paramObj4 = new NullWrapper("[Ljava.lang.String;");
461             }
462 
463             Object paramObj5 = serviceContext;
464 
465             if (serviceContext == null) {
466                 paramObj5 = new NullWrapper(
467                         "com.liferay.portal.service.ServiceContext");
468             }
469 
470             MethodWrapper methodWrapper = new MethodWrapper(AssetCategoryServiceUtil.class.getName(),
471                     "updateCategory",
472                     new Object[] {
473                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
474                         paramObj5
475                     });
476 
477             Object returnObj = null;
478 
479             try {
480                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
481             }
482             catch (Exception e) {
483                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
484                     throw (com.liferay.portal.kernel.exception.PortalException)e;
485                 }
486 
487                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
488                     throw (com.liferay.portal.kernel.exception.SystemException)e;
489                 }
490 
491                 throw new com.liferay.portal.kernel.exception.SystemException(e);
492             }
493 
494             return (com.liferay.portlet.asset.model.AssetCategory)returnObj;
495         }
496         catch (com.liferay.portal.kernel.exception.SystemException se) {
497             _log.error(se, se);
498 
499             throw se;
500         }
501     }
502 
503     private static Log _log = LogFactoryUtil.getLog(AssetCategoryServiceHttp.class);
504 }