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.LongWrapper;
20  import com.liferay.portal.kernel.util.MethodWrapper;
21  import com.liferay.portal.kernel.util.NullWrapper;
22  import com.liferay.portal.security.auth.HttpPrincipal;
23  import com.liferay.portal.service.http.TunnelUtil;
24  
25  import com.liferay.portlet.asset.service.AssetVocabularyServiceUtil;
26  
27  /**
28   * <a href="AssetVocabularyServiceHttp.java.html"><b><i>View Source</i></b></a>
29   *
30   * <p>
31   * ServiceBuilder generated this class. Modifications in this class will be
32   * overwritten the next time is generated.
33   * </p>
34   *
35   * <p>
36   * This class provides a HTTP utility for the
37   * {@link com.liferay.portlet.asset.service.AssetVocabularyServiceUtil} service utility. The
38   * static methods of this class calls the same methods of the service utility.
39   * However, the signatures are different because it requires an additional
40   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
41   * </p>
42   *
43   * <p>
44   * The benefits of using the HTTP utility is that it is fast and allows for
45   * tunneling without the cost of serializing to text. The drawback is that it
46   * only works with Java.
47   * </p>
48   *
49   * <p>
50   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
51   * configure security.
52   * </p>
53   *
54   * <p>
55   * The HTTP utility is only generated for remote services.
56   * </p>
57   *
58   * @author    Brian Wing Shun Chan
59   * @see       AssetVocabularyServiceSoap
60   * @see       com.liferay.portal.security.auth.HttpPrincipal
61   * @see       com.liferay.portlet.asset.service.AssetVocabularyServiceUtil
62   * @generated
63   */
64  public class AssetVocabularyServiceHttp {
65      public static com.liferay.portlet.asset.model.AssetVocabulary addVocabulary(
66          HttpPrincipal httpPrincipal,
67          java.util.Map<java.util.Locale, String> titleMap,
68          java.util.Map<java.util.Locale, String> descriptionMap,
69          java.lang.String settings,
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 = titleMap;
75  
76              if (titleMap == null) {
77                  paramObj0 = new NullWrapper("java.util.Map");
78              }
79  
80              Object paramObj1 = descriptionMap;
81  
82              if (descriptionMap == null) {
83                  paramObj1 = new NullWrapper("java.util.Map");
84              }
85  
86              Object paramObj2 = settings;
87  
88              if (settings == null) {
89                  paramObj2 = new NullWrapper("java.lang.String");
90              }
91  
92              Object paramObj3 = serviceContext;
93  
94              if (serviceContext == null) {
95                  paramObj3 = new NullWrapper(
96                          "com.liferay.portal.service.ServiceContext");
97              }
98  
99              MethodWrapper methodWrapper = new MethodWrapper(AssetVocabularyServiceUtil.class.getName(),
100                     "addVocabulary",
101                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
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.AssetVocabulary)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 deleteVocabulary(HttpPrincipal httpPrincipal,
130         long vocabularyId)
131         throws com.liferay.portal.kernel.exception.PortalException,
132             com.liferay.portal.kernel.exception.SystemException {
133         try {
134             Object paramObj0 = new LongWrapper(vocabularyId);
135 
136             MethodWrapper methodWrapper = new MethodWrapper(AssetVocabularyServiceUtil.class.getName(),
137                     "deleteVocabulary", 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.AssetVocabulary> getCompanyVocabularies(
162         HttpPrincipal httpPrincipal, long companyId)
163         throws com.liferay.portal.kernel.exception.PortalException,
164             com.liferay.portal.kernel.exception.SystemException {
165         try {
166             Object paramObj0 = new LongWrapper(companyId);
167 
168             MethodWrapper methodWrapper = new MethodWrapper(AssetVocabularyServiceUtil.class.getName(),
169                     "getCompanyVocabularies", new Object[] { paramObj0 });
170 
171             Object returnObj = null;
172 
173             try {
174                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
175             }
176             catch (Exception e) {
177                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
178                     throw (com.liferay.portal.kernel.exception.PortalException)e;
179                 }
180 
181                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
182                     throw (com.liferay.portal.kernel.exception.SystemException)e;
183                 }
184 
185                 throw new com.liferay.portal.kernel.exception.SystemException(e);
186             }
187 
188             return (java.util.List<com.liferay.portlet.asset.model.AssetVocabulary>)returnObj;
189         }
190         catch (com.liferay.portal.kernel.exception.SystemException se) {
191             _log.error(se, se);
192 
193             throw se;
194         }
195     }
196 
197     public static java.util.List<com.liferay.portlet.asset.model.AssetVocabulary> getGroupsVocabularies(
198         HttpPrincipal httpPrincipal, long[] groupIds)
199         throws com.liferay.portal.kernel.exception.PortalException,
200             com.liferay.portal.kernel.exception.SystemException {
201         try {
202             Object paramObj0 = groupIds;
203 
204             if (groupIds == null) {
205                 paramObj0 = new NullWrapper("[J");
206             }
207 
208             MethodWrapper methodWrapper = new MethodWrapper(AssetVocabularyServiceUtil.class.getName(),
209                     "getGroupsVocabularies", new Object[] { paramObj0 });
210 
211             Object returnObj = null;
212 
213             try {
214                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
215             }
216             catch (Exception e) {
217                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
218                     throw (com.liferay.portal.kernel.exception.PortalException)e;
219                 }
220 
221                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
222                     throw (com.liferay.portal.kernel.exception.SystemException)e;
223                 }
224 
225                 throw new com.liferay.portal.kernel.exception.SystemException(e);
226             }
227 
228             return (java.util.List<com.liferay.portlet.asset.model.AssetVocabulary>)returnObj;
229         }
230         catch (com.liferay.portal.kernel.exception.SystemException se) {
231             _log.error(se, se);
232 
233             throw se;
234         }
235     }
236 
237     public static java.util.List<com.liferay.portlet.asset.model.AssetVocabulary> getGroupVocabularies(
238         HttpPrincipal httpPrincipal, long groupId)
239         throws com.liferay.portal.kernel.exception.PortalException,
240             com.liferay.portal.kernel.exception.SystemException {
241         try {
242             Object paramObj0 = new LongWrapper(groupId);
243 
244             MethodWrapper methodWrapper = new MethodWrapper(AssetVocabularyServiceUtil.class.getName(),
245                     "getGroupVocabularies", new Object[] { paramObj0 });
246 
247             Object returnObj = null;
248 
249             try {
250                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
251             }
252             catch (Exception e) {
253                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
254                     throw (com.liferay.portal.kernel.exception.PortalException)e;
255                 }
256 
257                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
258                     throw (com.liferay.portal.kernel.exception.SystemException)e;
259                 }
260 
261                 throw new com.liferay.portal.kernel.exception.SystemException(e);
262             }
263 
264             return (java.util.List<com.liferay.portlet.asset.model.AssetVocabulary>)returnObj;
265         }
266         catch (com.liferay.portal.kernel.exception.SystemException se) {
267             _log.error(se, se);
268 
269             throw se;
270         }
271     }
272 
273     public static com.liferay.portlet.asset.model.AssetVocabulary getVocabulary(
274         HttpPrincipal httpPrincipal, long vocabularyId)
275         throws com.liferay.portal.kernel.exception.PortalException,
276             com.liferay.portal.kernel.exception.SystemException {
277         try {
278             Object paramObj0 = new LongWrapper(vocabularyId);
279 
280             MethodWrapper methodWrapper = new MethodWrapper(AssetVocabularyServiceUtil.class.getName(),
281                     "getVocabulary", new Object[] { paramObj0 });
282 
283             Object returnObj = null;
284 
285             try {
286                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
287             }
288             catch (Exception e) {
289                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
290                     throw (com.liferay.portal.kernel.exception.PortalException)e;
291                 }
292 
293                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
294                     throw (com.liferay.portal.kernel.exception.SystemException)e;
295                 }
296 
297                 throw new com.liferay.portal.kernel.exception.SystemException(e);
298             }
299 
300             return (com.liferay.portlet.asset.model.AssetVocabulary)returnObj;
301         }
302         catch (com.liferay.portal.kernel.exception.SystemException se) {
303             _log.error(se, se);
304 
305             throw se;
306         }
307     }
308 
309     public static com.liferay.portlet.asset.model.AssetVocabulary updateVocabulary(
310         HttpPrincipal httpPrincipal, long vocabularyId,
311         java.util.Map<java.util.Locale, String> titleMap,
312         java.util.Map<java.util.Locale, String> descriptionMap,
313         java.lang.String settings,
314         com.liferay.portal.service.ServiceContext serviceContext)
315         throws com.liferay.portal.kernel.exception.PortalException,
316             com.liferay.portal.kernel.exception.SystemException {
317         try {
318             Object paramObj0 = new LongWrapper(vocabularyId);
319 
320             Object paramObj1 = titleMap;
321 
322             if (titleMap == null) {
323                 paramObj1 = new NullWrapper("java.util.Map");
324             }
325 
326             Object paramObj2 = descriptionMap;
327 
328             if (descriptionMap == null) {
329                 paramObj2 = new NullWrapper("java.util.Map");
330             }
331 
332             Object paramObj3 = settings;
333 
334             if (settings == null) {
335                 paramObj3 = new NullWrapper("java.lang.String");
336             }
337 
338             Object paramObj4 = serviceContext;
339 
340             if (serviceContext == null) {
341                 paramObj4 = new NullWrapper(
342                         "com.liferay.portal.service.ServiceContext");
343             }
344 
345             MethodWrapper methodWrapper = new MethodWrapper(AssetVocabularyServiceUtil.class.getName(),
346                     "updateVocabulary",
347                     new Object[] {
348                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
349                     });
350 
351             Object returnObj = null;
352 
353             try {
354                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
355             }
356             catch (Exception e) {
357                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
358                     throw (com.liferay.portal.kernel.exception.PortalException)e;
359                 }
360 
361                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
362                     throw (com.liferay.portal.kernel.exception.SystemException)e;
363                 }
364 
365                 throw new com.liferay.portal.kernel.exception.SystemException(e);
366             }
367 
368             return (com.liferay.portlet.asset.model.AssetVocabulary)returnObj;
369         }
370         catch (com.liferay.portal.kernel.exception.SystemException se) {
371             _log.error(se, se);
372 
373             throw se;
374         }
375     }
376 
377     private static Log _log = LogFactoryUtil.getLog(AssetVocabularyServiceHttp.class);
378 }