1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
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.MethodHandler;
20  import com.liferay.portal.kernel.util.MethodKey;
21  import com.liferay.portal.security.auth.HttpPrincipal;
22  import com.liferay.portal.service.http.TunnelUtil;
23  
24  import com.liferay.portlet.tags.service.TagsVocabularyServiceUtil;
25  
26  /**
27   * <a href="TagsVocabularyServiceHttp.java.html"><b><i>View Source</i></b></a>
28   *
29   * <p>
30   * ServiceBuilder generated this class. Modifications in this class will be
31   * overwritten the next time is generated.
32   * </p>
33   *
34   * <p>
35   * This class provides a HTTP utility for the
36   * {@link com.liferay.portlet.tags.service.TagsVocabularyServiceUtil} service utility. The
37   * static methods of this class calls the same methods of the service utility.
38   * However, the signatures are different because it requires an additional
39   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
40   * </p>
41   *
42   * <p>
43   * The benefits of using the HTTP utility is that it is fast and allows for
44   * tunneling without the cost of serializing to text. The drawback is that it
45   * only works with Java.
46   * </p>
47   *
48   * <p>
49   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
50   * configure security.
51   * </p>
52   *
53   * <p>
54   * The HTTP utility is only generated for remote services.
55   * </p>
56   *
57   * @author    Brian Wing Shun Chan
58   * @see       TagsVocabularyServiceSoap
59   * @see       com.liferay.portal.security.auth.HttpPrincipal
60   * @see       com.liferay.portlet.tags.service.TagsVocabularyServiceUtil
61   * @generated
62   */
63  public class TagsVocabularyServiceHttp {
64      public static com.liferay.portlet.tags.model.TagsVocabulary addVocabulary(
65          HttpPrincipal httpPrincipal, java.lang.String name, boolean folksonomy,
66          com.liferay.portal.service.ServiceContext serviceContext)
67          throws com.liferay.portal.PortalException,
68              com.liferay.portal.SystemException {
69          try {
70              MethodKey methodKey = new MethodKey(TagsVocabularyServiceUtil.class.getName(),
71                      "addVocabulary", _addVocabularyParameterTypes0);
72  
73              MethodHandler methodHandler = new MethodHandler(methodKey, name,
74                      folksonomy, serviceContext);
75  
76              Object returnObj = null;
77  
78              try {
79                  returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
80              }
81              catch (Exception e) {
82                  if (e instanceof com.liferay.portal.PortalException) {
83                      throw (com.liferay.portal.PortalException)e;
84                  }
85  
86                  if (e instanceof com.liferay.portal.SystemException) {
87                      throw (com.liferay.portal.SystemException)e;
88                  }
89  
90                  throw new com.liferay.portal.SystemException(e);
91              }
92  
93              return (com.liferay.portlet.tags.model.TagsVocabulary)returnObj;
94          }
95          catch (com.liferay.portal.SystemException se) {
96              _log.error(se, se);
97  
98              throw se;
99          }
100     }
101 
102     public static void deleteVocabulary(HttpPrincipal httpPrincipal,
103         long vocabularyId)
104         throws com.liferay.portal.PortalException,
105             com.liferay.portal.SystemException {
106         try {
107             MethodKey methodKey = new MethodKey(TagsVocabularyServiceUtil.class.getName(),
108                     "deleteVocabulary", _deleteVocabularyParameterTypes1);
109 
110             MethodHandler methodHandler = new MethodHandler(methodKey,
111                     vocabularyId);
112 
113             try {
114                 TunnelUtil.invoke(httpPrincipal, methodHandler);
115             }
116             catch (Exception e) {
117                 if (e instanceof com.liferay.portal.PortalException) {
118                     throw (com.liferay.portal.PortalException)e;
119                 }
120 
121                 if (e instanceof com.liferay.portal.SystemException) {
122                     throw (com.liferay.portal.SystemException)e;
123                 }
124 
125                 throw new com.liferay.portal.SystemException(e);
126             }
127         }
128         catch (com.liferay.portal.SystemException se) {
129             _log.error(se, se);
130 
131             throw se;
132         }
133     }
134 
135     public static java.util.List<com.liferay.portlet.tags.model.TagsVocabulary> getCompanyVocabularies(
136         HttpPrincipal httpPrincipal, long companyId, boolean folksonomy)
137         throws com.liferay.portal.PortalException,
138             com.liferay.portal.SystemException {
139         try {
140             MethodKey methodKey = new MethodKey(TagsVocabularyServiceUtil.class.getName(),
141                     "getCompanyVocabularies",
142                     _getCompanyVocabulariesParameterTypes2);
143 
144             MethodHandler methodHandler = new MethodHandler(methodKey,
145                     companyId, folksonomy);
146 
147             Object returnObj = null;
148 
149             try {
150                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
151             }
152             catch (Exception e) {
153                 if (e instanceof com.liferay.portal.PortalException) {
154                     throw (com.liferay.portal.PortalException)e;
155                 }
156 
157                 if (e instanceof com.liferay.portal.SystemException) {
158                     throw (com.liferay.portal.SystemException)e;
159                 }
160 
161                 throw new com.liferay.portal.SystemException(e);
162             }
163 
164             return (java.util.List<com.liferay.portlet.tags.model.TagsVocabulary>)returnObj;
165         }
166         catch (com.liferay.portal.SystemException se) {
167             _log.error(se, se);
168 
169             throw se;
170         }
171     }
172 
173     public static java.util.List<com.liferay.portlet.tags.model.TagsVocabulary> getGroupVocabularies(
174         HttpPrincipal httpPrincipal, long groupId, boolean folksonomy)
175         throws com.liferay.portal.PortalException,
176             com.liferay.portal.SystemException {
177         try {
178             MethodKey methodKey = new MethodKey(TagsVocabularyServiceUtil.class.getName(),
179                     "getGroupVocabularies", _getGroupVocabulariesParameterTypes3);
180 
181             MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
182                     folksonomy);
183 
184             Object returnObj = null;
185 
186             try {
187                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
188             }
189             catch (Exception e) {
190                 if (e instanceof com.liferay.portal.PortalException) {
191                     throw (com.liferay.portal.PortalException)e;
192                 }
193 
194                 if (e instanceof com.liferay.portal.SystemException) {
195                     throw (com.liferay.portal.SystemException)e;
196                 }
197 
198                 throw new com.liferay.portal.SystemException(e);
199             }
200 
201             return (java.util.List<com.liferay.portlet.tags.model.TagsVocabulary>)returnObj;
202         }
203         catch (com.liferay.portal.SystemException se) {
204             _log.error(se, se);
205 
206             throw se;
207         }
208     }
209 
210     public static com.liferay.portlet.tags.model.TagsVocabulary getVocabulary(
211         HttpPrincipal httpPrincipal, long vocabularyId)
212         throws com.liferay.portal.PortalException,
213             com.liferay.portal.SystemException {
214         try {
215             MethodKey methodKey = new MethodKey(TagsVocabularyServiceUtil.class.getName(),
216                     "getVocabulary", _getVocabularyParameterTypes4);
217 
218             MethodHandler methodHandler = new MethodHandler(methodKey,
219                     vocabularyId);
220 
221             Object returnObj = null;
222 
223             try {
224                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
225             }
226             catch (Exception e) {
227                 if (e instanceof com.liferay.portal.PortalException) {
228                     throw (com.liferay.portal.PortalException)e;
229                 }
230 
231                 if (e instanceof com.liferay.portal.SystemException) {
232                     throw (com.liferay.portal.SystemException)e;
233                 }
234 
235                 throw new com.liferay.portal.SystemException(e);
236             }
237 
238             return (com.liferay.portlet.tags.model.TagsVocabulary)returnObj;
239         }
240         catch (com.liferay.portal.SystemException se) {
241             _log.error(se, se);
242 
243             throw se;
244         }
245     }
246 
247     public static com.liferay.portlet.tags.model.TagsVocabulary updateVocabulary(
248         HttpPrincipal httpPrincipal, long vocabularyId, java.lang.String name,
249         boolean folksonomy)
250         throws com.liferay.portal.PortalException,
251             com.liferay.portal.SystemException {
252         try {
253             MethodKey methodKey = new MethodKey(TagsVocabularyServiceUtil.class.getName(),
254                     "updateVocabulary", _updateVocabularyParameterTypes5);
255 
256             MethodHandler methodHandler = new MethodHandler(methodKey,
257                     vocabularyId, name, folksonomy);
258 
259             Object returnObj = null;
260 
261             try {
262                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
263             }
264             catch (Exception e) {
265                 if (e instanceof com.liferay.portal.PortalException) {
266                     throw (com.liferay.portal.PortalException)e;
267                 }
268 
269                 if (e instanceof com.liferay.portal.SystemException) {
270                     throw (com.liferay.portal.SystemException)e;
271                 }
272 
273                 throw new com.liferay.portal.SystemException(e);
274             }
275 
276             return (com.liferay.portlet.tags.model.TagsVocabulary)returnObj;
277         }
278         catch (com.liferay.portal.SystemException se) {
279             _log.error(se, se);
280 
281             throw se;
282         }
283     }
284 
285     private static Log _log = LogFactoryUtil.getLog(TagsVocabularyServiceHttp.class);
286     private static final Class<?>[] _addVocabularyParameterTypes0 = new Class[] {
287             java.lang.String.class, boolean.class,
288             com.liferay.portal.service.ServiceContext.class
289         };
290     private static final Class<?>[] _deleteVocabularyParameterTypes1 = new Class[] {
291             long.class
292         };
293     private static final Class<?>[] _getCompanyVocabulariesParameterTypes2 = new Class[] {
294             long.class, boolean.class
295         };
296     private static final Class<?>[] _getGroupVocabulariesParameterTypes3 = new Class[] {
297             long.class, boolean.class
298         };
299     private static final Class<?>[] _getVocabularyParameterTypes4 = new Class[] {
300             long.class
301         };
302     private static final Class<?>[] _updateVocabularyParameterTypes5 = new Class[] {
303             long.class, java.lang.String.class, boolean.class
304         };
305 }