1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portlet.tags.service.http;
24  
25  import com.liferay.portal.kernel.log.Log;
26  import com.liferay.portal.kernel.log.LogFactoryUtil;
27  import com.liferay.portal.kernel.util.BooleanWrapper;
28  import com.liferay.portal.kernel.util.LongWrapper;
29  import com.liferay.portal.kernel.util.MethodWrapper;
30  import com.liferay.portal.kernel.util.NullWrapper;
31  import com.liferay.portal.security.auth.HttpPrincipal;
32  import com.liferay.portal.service.http.TunnelUtil;
33  
34  import com.liferay.portlet.tags.service.TagsVocabularyServiceUtil;
35  
36  /**
37   * <a href="TagsVocabularyServiceHttp.java.html"><b><i>View Source</i></b></a>
38   *
39   * <p>
40   * ServiceBuilder generated this class. Modifications in this class will be
41   * overwritten the next time is generated.
42   * </p>
43   *
44   * <p>
45   * This class provides a HTTP utility for the
46   * {@link com.liferay.portlet.tags.service.TagsVocabularyServiceUtil} service utility. The
47   * static methods of this class calls the same methods of the service utility.
48   * However, the signatures are different because it requires an additional
49   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
50   * </p>
51   *
52   * <p>
53   * The benefits of using the HTTP utility is that it is fast and allows for
54   * tunneling without the cost of serializing to text. The drawback is that it
55   * only works with Java.
56   * </p>
57   *
58   * <p>
59   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
60   * configure security.
61   * </p>
62   *
63   * <p>
64   * The HTTP utility is only generated for remote services.
65   * </p>
66   *
67   * @author    Brian Wing Shun Chan
68   * @see       TagsVocabularyServiceSoap
69   * @see       com.liferay.portal.security.auth.HttpPrincipal
70   * @see       com.liferay.portlet.tags.service.TagsVocabularyServiceUtil
71   * @generated
72   */
73  public class TagsVocabularyServiceHttp {
74      public static com.liferay.portlet.tags.model.TagsVocabulary addVocabulary(
75          HttpPrincipal httpPrincipal, java.lang.String name, boolean folksonomy,
76          com.liferay.portal.service.ServiceContext serviceContext)
77          throws com.liferay.portal.PortalException,
78              com.liferay.portal.SystemException {
79          try {
80              Object paramObj0 = name;
81  
82              if (name == null) {
83                  paramObj0 = new NullWrapper("java.lang.String");
84              }
85  
86              Object paramObj1 = new BooleanWrapper(folksonomy);
87  
88              Object paramObj2 = serviceContext;
89  
90              if (serviceContext == null) {
91                  paramObj2 = new NullWrapper(
92                          "com.liferay.portal.service.ServiceContext");
93              }
94  
95              MethodWrapper methodWrapper = new MethodWrapper(TagsVocabularyServiceUtil.class.getName(),
96                      "addVocabulary",
97                      new Object[] { paramObj0, paramObj1, paramObj2 });
98  
99              Object returnObj = null;
100 
101             try {
102                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
103             }
104             catch (Exception e) {
105                 if (e instanceof com.liferay.portal.PortalException) {
106                     throw (com.liferay.portal.PortalException)e;
107                 }
108 
109                 if (e instanceof com.liferay.portal.SystemException) {
110                     throw (com.liferay.portal.SystemException)e;
111                 }
112 
113                 throw new com.liferay.portal.SystemException(e);
114             }
115 
116             return (com.liferay.portlet.tags.model.TagsVocabulary)returnObj;
117         }
118         catch (com.liferay.portal.SystemException se) {
119             _log.error(se, se);
120 
121             throw se;
122         }
123     }
124 
125     public static void deleteVocabulary(HttpPrincipal httpPrincipal,
126         long vocabularyId)
127         throws com.liferay.portal.PortalException,
128             com.liferay.portal.SystemException {
129         try {
130             Object paramObj0 = new LongWrapper(vocabularyId);
131 
132             MethodWrapper methodWrapper = new MethodWrapper(TagsVocabularyServiceUtil.class.getName(),
133                     "deleteVocabulary", new Object[] { paramObj0 });
134 
135             try {
136                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
137             }
138             catch (Exception e) {
139                 if (e instanceof com.liferay.portal.PortalException) {
140                     throw (com.liferay.portal.PortalException)e;
141                 }
142 
143                 if (e instanceof com.liferay.portal.SystemException) {
144                     throw (com.liferay.portal.SystemException)e;
145                 }
146 
147                 throw new com.liferay.portal.SystemException(e);
148             }
149         }
150         catch (com.liferay.portal.SystemException se) {
151             _log.error(se, se);
152 
153             throw se;
154         }
155     }
156 
157     public static java.util.List<com.liferay.portlet.tags.model.TagsVocabulary> getCompanyVocabularies(
158         HttpPrincipal httpPrincipal, long companyId, boolean folksonomy)
159         throws com.liferay.portal.PortalException,
160             com.liferay.portal.SystemException {
161         try {
162             Object paramObj0 = new LongWrapper(companyId);
163 
164             Object paramObj1 = new BooleanWrapper(folksonomy);
165 
166             MethodWrapper methodWrapper = new MethodWrapper(TagsVocabularyServiceUtil.class.getName(),
167                     "getCompanyVocabularies",
168                     new Object[] { paramObj0, paramObj1 });
169 
170             Object returnObj = null;
171 
172             try {
173                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
174             }
175             catch (Exception e) {
176                 if (e instanceof com.liferay.portal.PortalException) {
177                     throw (com.liferay.portal.PortalException)e;
178                 }
179 
180                 if (e instanceof com.liferay.portal.SystemException) {
181                     throw (com.liferay.portal.SystemException)e;
182                 }
183 
184                 throw new com.liferay.portal.SystemException(e);
185             }
186 
187             return (java.util.List<com.liferay.portlet.tags.model.TagsVocabulary>)returnObj;
188         }
189         catch (com.liferay.portal.SystemException se) {
190             _log.error(se, se);
191 
192             throw se;
193         }
194     }
195 
196     public static java.util.List<com.liferay.portlet.tags.model.TagsVocabulary> getGroupVocabularies(
197         HttpPrincipal httpPrincipal, long groupId, boolean folksonomy)
198         throws com.liferay.portal.PortalException,
199             com.liferay.portal.SystemException {
200         try {
201             Object paramObj0 = new LongWrapper(groupId);
202 
203             Object paramObj1 = new BooleanWrapper(folksonomy);
204 
205             MethodWrapper methodWrapper = new MethodWrapper(TagsVocabularyServiceUtil.class.getName(),
206                     "getGroupVocabularies",
207                     new Object[] { paramObj0, paramObj1 });
208 
209             Object returnObj = null;
210 
211             try {
212                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
213             }
214             catch (Exception e) {
215                 if (e instanceof com.liferay.portal.PortalException) {
216                     throw (com.liferay.portal.PortalException)e;
217                 }
218 
219                 if (e instanceof com.liferay.portal.SystemException) {
220                     throw (com.liferay.portal.SystemException)e;
221                 }
222 
223                 throw new com.liferay.portal.SystemException(e);
224             }
225 
226             return (java.util.List<com.liferay.portlet.tags.model.TagsVocabulary>)returnObj;
227         }
228         catch (com.liferay.portal.SystemException se) {
229             _log.error(se, se);
230 
231             throw se;
232         }
233     }
234 
235     public static com.liferay.portlet.tags.model.TagsVocabulary getVocabulary(
236         HttpPrincipal httpPrincipal, long vocabularyId)
237         throws com.liferay.portal.PortalException,
238             com.liferay.portal.SystemException {
239         try {
240             Object paramObj0 = new LongWrapper(vocabularyId);
241 
242             MethodWrapper methodWrapper = new MethodWrapper(TagsVocabularyServiceUtil.class.getName(),
243                     "getVocabulary", new Object[] { paramObj0 });
244 
245             Object returnObj = null;
246 
247             try {
248                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
249             }
250             catch (Exception e) {
251                 if (e instanceof com.liferay.portal.PortalException) {
252                     throw (com.liferay.portal.PortalException)e;
253                 }
254 
255                 if (e instanceof com.liferay.portal.SystemException) {
256                     throw (com.liferay.portal.SystemException)e;
257                 }
258 
259                 throw new com.liferay.portal.SystemException(e);
260             }
261 
262             return (com.liferay.portlet.tags.model.TagsVocabulary)returnObj;
263         }
264         catch (com.liferay.portal.SystemException se) {
265             _log.error(se, se);
266 
267             throw se;
268         }
269     }
270 
271     public static com.liferay.portlet.tags.model.TagsVocabulary updateVocabulary(
272         HttpPrincipal httpPrincipal, long vocabularyId, java.lang.String name,
273         boolean folksonomy)
274         throws com.liferay.portal.PortalException,
275             com.liferay.portal.SystemException {
276         try {
277             Object paramObj0 = new LongWrapper(vocabularyId);
278 
279             Object paramObj1 = name;
280 
281             if (name == null) {
282                 paramObj1 = new NullWrapper("java.lang.String");
283             }
284 
285             Object paramObj2 = new BooleanWrapper(folksonomy);
286 
287             MethodWrapper methodWrapper = new MethodWrapper(TagsVocabularyServiceUtil.class.getName(),
288                     "updateVocabulary",
289                     new Object[] { paramObj0, paramObj1, paramObj2 });
290 
291             Object returnObj = null;
292 
293             try {
294                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
295             }
296             catch (Exception e) {
297                 if (e instanceof com.liferay.portal.PortalException) {
298                     throw (com.liferay.portal.PortalException)e;
299                 }
300 
301                 if (e instanceof com.liferay.portal.SystemException) {
302                     throw (com.liferay.portal.SystemException)e;
303                 }
304 
305                 throw new com.liferay.portal.SystemException(e);
306             }
307 
308             return (com.liferay.portlet.tags.model.TagsVocabulary)returnObj;
309         }
310         catch (com.liferay.portal.SystemException se) {
311             _log.error(se, se);
312 
313             throw se;
314         }
315     }
316 
317     private static Log _log = LogFactoryUtil.getLog(TagsVocabularyServiceHttp.class);
318 }