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.tags.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.BooleanWrapper;
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.tags.service.TagsVocabularyServiceUtil;
27  
28  /**
29   * <a href="TagsVocabularyServiceHttp.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.tags.service.TagsVocabularyServiceUtil} 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       TagsVocabularyServiceSoap
61   * @see       com.liferay.portal.security.auth.HttpPrincipal
62   * @see       com.liferay.portlet.tags.service.TagsVocabularyServiceUtil
63   * @generated
64   */
65  public class TagsVocabularyServiceHttp {
66      public static com.liferay.portlet.tags.model.TagsVocabulary addVocabulary(
67          HttpPrincipal httpPrincipal, java.lang.String name, boolean folksonomy,
68          com.liferay.portal.service.ServiceContext serviceContext)
69          throws com.liferay.portal.PortalException,
70              com.liferay.portal.SystemException {
71          try {
72              Object paramObj0 = name;
73  
74              if (name == null) {
75                  paramObj0 = new NullWrapper("java.lang.String");
76              }
77  
78              Object paramObj1 = new BooleanWrapper(folksonomy);
79  
80              Object paramObj2 = serviceContext;
81  
82              if (serviceContext == null) {
83                  paramObj2 = new NullWrapper(
84                          "com.liferay.portal.service.ServiceContext");
85              }
86  
87              MethodWrapper methodWrapper = new MethodWrapper(TagsVocabularyServiceUtil.class.getName(),
88                      "addVocabulary",
89                      new Object[] { paramObj0, paramObj1, paramObj2 });
90  
91              Object returnObj = null;
92  
93              try {
94                  returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
95              }
96              catch (Exception e) {
97                  if (e instanceof com.liferay.portal.PortalException) {
98                      throw (com.liferay.portal.PortalException)e;
99                  }
100 
101                 if (e instanceof com.liferay.portal.SystemException) {
102                     throw (com.liferay.portal.SystemException)e;
103                 }
104 
105                 throw new com.liferay.portal.SystemException(e);
106             }
107 
108             return (com.liferay.portlet.tags.model.TagsVocabulary)returnObj;
109         }
110         catch (com.liferay.portal.SystemException se) {
111             _log.error(se, se);
112 
113             throw se;
114         }
115     }
116 
117     public static void deleteVocabulary(HttpPrincipal httpPrincipal,
118         long vocabularyId)
119         throws com.liferay.portal.PortalException,
120             com.liferay.portal.SystemException {
121         try {
122             Object paramObj0 = new LongWrapper(vocabularyId);
123 
124             MethodWrapper methodWrapper = new MethodWrapper(TagsVocabularyServiceUtil.class.getName(),
125                     "deleteVocabulary", new Object[] { paramObj0 });
126 
127             try {
128                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
129             }
130             catch (Exception e) {
131                 if (e instanceof com.liferay.portal.PortalException) {
132                     throw (com.liferay.portal.PortalException)e;
133                 }
134 
135                 if (e instanceof com.liferay.portal.SystemException) {
136                     throw (com.liferay.portal.SystemException)e;
137                 }
138 
139                 throw new com.liferay.portal.SystemException(e);
140             }
141         }
142         catch (com.liferay.portal.SystemException se) {
143             _log.error(se, se);
144 
145             throw se;
146         }
147     }
148 
149     public static java.util.List<com.liferay.portlet.tags.model.TagsVocabulary> getCompanyVocabularies(
150         HttpPrincipal httpPrincipal, long companyId, boolean folksonomy)
151         throws com.liferay.portal.PortalException,
152             com.liferay.portal.SystemException {
153         try {
154             Object paramObj0 = new LongWrapper(companyId);
155 
156             Object paramObj1 = new BooleanWrapper(folksonomy);
157 
158             MethodWrapper methodWrapper = new MethodWrapper(TagsVocabularyServiceUtil.class.getName(),
159                     "getCompanyVocabularies",
160                     new Object[] { paramObj0, paramObj1 });
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.PortalException) {
169                     throw (com.liferay.portal.PortalException)e;
170                 }
171 
172                 if (e instanceof com.liferay.portal.SystemException) {
173                     throw (com.liferay.portal.SystemException)e;
174                 }
175 
176                 throw new com.liferay.portal.SystemException(e);
177             }
178 
179             return (java.util.List<com.liferay.portlet.tags.model.TagsVocabulary>)returnObj;
180         }
181         catch (com.liferay.portal.SystemException se) {
182             _log.error(se, se);
183 
184             throw se;
185         }
186     }
187 
188     public static java.util.List<com.liferay.portlet.tags.model.TagsVocabulary> getGroupVocabularies(
189         HttpPrincipal httpPrincipal, long groupId, boolean folksonomy)
190         throws com.liferay.portal.PortalException,
191             com.liferay.portal.SystemException {
192         try {
193             Object paramObj0 = new LongWrapper(groupId);
194 
195             Object paramObj1 = new BooleanWrapper(folksonomy);
196 
197             MethodWrapper methodWrapper = new MethodWrapper(TagsVocabularyServiceUtil.class.getName(),
198                     "getGroupVocabularies",
199                     new Object[] { paramObj0, paramObj1 });
200 
201             Object returnObj = null;
202 
203             try {
204                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
205             }
206             catch (Exception e) {
207                 if (e instanceof com.liferay.portal.PortalException) {
208                     throw (com.liferay.portal.PortalException)e;
209                 }
210 
211                 if (e instanceof com.liferay.portal.SystemException) {
212                     throw (com.liferay.portal.SystemException)e;
213                 }
214 
215                 throw new com.liferay.portal.SystemException(e);
216             }
217 
218             return (java.util.List<com.liferay.portlet.tags.model.TagsVocabulary>)returnObj;
219         }
220         catch (com.liferay.portal.SystemException se) {
221             _log.error(se, se);
222 
223             throw se;
224         }
225     }
226 
227     public static com.liferay.portlet.tags.model.TagsVocabulary getVocabulary(
228         HttpPrincipal httpPrincipal, long vocabularyId)
229         throws com.liferay.portal.PortalException,
230             com.liferay.portal.SystemException {
231         try {
232             Object paramObj0 = new LongWrapper(vocabularyId);
233 
234             MethodWrapper methodWrapper = new MethodWrapper(TagsVocabularyServiceUtil.class.getName(),
235                     "getVocabulary", new Object[] { paramObj0 });
236 
237             Object returnObj = null;
238 
239             try {
240                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
241             }
242             catch (Exception e) {
243                 if (e instanceof com.liferay.portal.PortalException) {
244                     throw (com.liferay.portal.PortalException)e;
245                 }
246 
247                 if (e instanceof com.liferay.portal.SystemException) {
248                     throw (com.liferay.portal.SystemException)e;
249                 }
250 
251                 throw new com.liferay.portal.SystemException(e);
252             }
253 
254             return (com.liferay.portlet.tags.model.TagsVocabulary)returnObj;
255         }
256         catch (com.liferay.portal.SystemException se) {
257             _log.error(se, se);
258 
259             throw se;
260         }
261     }
262 
263     public static com.liferay.portlet.tags.model.TagsVocabulary updateVocabulary(
264         HttpPrincipal httpPrincipal, long vocabularyId, java.lang.String name,
265         boolean folksonomy)
266         throws com.liferay.portal.PortalException,
267             com.liferay.portal.SystemException {
268         try {
269             Object paramObj0 = new LongWrapper(vocabularyId);
270 
271             Object paramObj1 = name;
272 
273             if (name == null) {
274                 paramObj1 = new NullWrapper("java.lang.String");
275             }
276 
277             Object paramObj2 = new BooleanWrapper(folksonomy);
278 
279             MethodWrapper methodWrapper = new MethodWrapper(TagsVocabularyServiceUtil.class.getName(),
280                     "updateVocabulary",
281                     new Object[] { paramObj0, paramObj1, paramObj2 });
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.PortalException) {
290                     throw (com.liferay.portal.PortalException)e;
291                 }
292 
293                 if (e instanceof com.liferay.portal.SystemException) {
294                     throw (com.liferay.portal.SystemException)e;
295                 }
296 
297                 throw new com.liferay.portal.SystemException(e);
298             }
299 
300             return (com.liferay.portlet.tags.model.TagsVocabulary)returnObj;
301         }
302         catch (com.liferay.portal.SystemException se) {
303             _log.error(se, se);
304 
305             throw se;
306         }
307     }
308 
309     private static Log _log = LogFactoryUtil.getLog(TagsVocabularyServiceHttp.class);
310 }