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   * <code>com.liferay.portlet.tags.service.TagsVocabularyServiceUtil</code> service
47   * utility. The static methods of this class calls the same methods of the
48   * service utility. However, the signatures are different because it requires an
49   * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code>
50   * parameter.
51   * </p>
52   *
53   * <p>
54   * The benefits of using the HTTP utility is that it is fast and allows for
55   * tunneling without the cost of serializing to text. The drawback is that it
56   * only works with Java.
57   * </p>
58   *
59   * <p>
60   * Set the property <code>tunnel.servlet.hosts.allowed</code> in
61   * portal.properties to configure security.
62   * </p>
63   *
64   * <p>
65   * The HTTP utility is only generated for remote services.
66   * </p>
67   *
68   * @author Brian Wing Shun Chan
69   *
70   * @see com.liferay.portal.security.auth.HttpPrincipal
71   * @see com.liferay.portlet.tags.service.TagsVocabularyServiceUtil
72   * @see com.liferay.portlet.tags.service.http.TagsVocabularyServiceSoap
73   *
74   */
75  public class TagsVocabularyServiceHttp {
76      public static com.liferay.portlet.tags.model.TagsVocabulary addVocabulary(
77          HttpPrincipal httpPrincipal, java.lang.String name, boolean folksonomy,
78          com.liferay.portal.service.ServiceContext serviceContext)
79          throws com.liferay.portal.PortalException,
80              com.liferay.portal.SystemException {
81          try {
82              Object paramObj0 = name;
83  
84              if (name == null) {
85                  paramObj0 = new NullWrapper("java.lang.String");
86              }
87  
88              Object paramObj1 = new BooleanWrapper(folksonomy);
89  
90              Object paramObj2 = serviceContext;
91  
92              if (serviceContext == null) {
93                  paramObj2 = new NullWrapper(
94                          "com.liferay.portal.service.ServiceContext");
95              }
96  
97              MethodWrapper methodWrapper = new MethodWrapper(TagsVocabularyServiceUtil.class.getName(),
98                      "addVocabulary",
99                      new Object[] { paramObj0, paramObj1, paramObj2 });
100 
101             Object returnObj = null;
102 
103             try {
104                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
105             }
106             catch (Exception e) {
107                 if (e instanceof com.liferay.portal.PortalException) {
108                     throw (com.liferay.portal.PortalException)e;
109                 }
110 
111                 if (e instanceof com.liferay.portal.SystemException) {
112                     throw (com.liferay.portal.SystemException)e;
113                 }
114 
115                 throw new com.liferay.portal.SystemException(e);
116             }
117 
118             return (com.liferay.portlet.tags.model.TagsVocabulary)returnObj;
119         }
120         catch (com.liferay.portal.SystemException se) {
121             _log.error(se, se);
122 
123             throw se;
124         }
125     }
126 
127     public static void deleteVocabulary(HttpPrincipal httpPrincipal,
128         long vocabularyId)
129         throws com.liferay.portal.PortalException,
130             com.liferay.portal.SystemException {
131         try {
132             Object paramObj0 = new LongWrapper(vocabularyId);
133 
134             MethodWrapper methodWrapper = new MethodWrapper(TagsVocabularyServiceUtil.class.getName(),
135                     "deleteVocabulary", new Object[] { paramObj0 });
136 
137             try {
138                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
139             }
140             catch (Exception e) {
141                 if (e instanceof com.liferay.portal.PortalException) {
142                     throw (com.liferay.portal.PortalException)e;
143                 }
144 
145                 if (e instanceof com.liferay.portal.SystemException) {
146                     throw (com.liferay.portal.SystemException)e;
147                 }
148 
149                 throw new com.liferay.portal.SystemException(e);
150             }
151         }
152         catch (com.liferay.portal.SystemException se) {
153             _log.error(se, se);
154 
155             throw se;
156         }
157     }
158 
159     public static java.util.List<com.liferay.portlet.tags.model.TagsVocabulary> getCompanyVocabularies(
160         HttpPrincipal httpPrincipal, long companyId, boolean folksonomy)
161         throws com.liferay.portal.PortalException,
162             com.liferay.portal.SystemException {
163         try {
164             Object paramObj0 = new LongWrapper(companyId);
165 
166             Object paramObj1 = new BooleanWrapper(folksonomy);
167 
168             MethodWrapper methodWrapper = new MethodWrapper(TagsVocabularyServiceUtil.class.getName(),
169                     "getCompanyVocabularies",
170                     new Object[] { paramObj0, paramObj1 });
171 
172             Object returnObj = null;
173 
174             try {
175                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
176             }
177             catch (Exception e) {
178                 if (e instanceof com.liferay.portal.PortalException) {
179                     throw (com.liferay.portal.PortalException)e;
180                 }
181 
182                 if (e instanceof com.liferay.portal.SystemException) {
183                     throw (com.liferay.portal.SystemException)e;
184                 }
185 
186                 throw new com.liferay.portal.SystemException(e);
187             }
188 
189             return (java.util.List<com.liferay.portlet.tags.model.TagsVocabulary>)returnObj;
190         }
191         catch (com.liferay.portal.SystemException se) {
192             _log.error(se, se);
193 
194             throw se;
195         }
196     }
197 
198     public static java.util.List<com.liferay.portlet.tags.model.TagsVocabulary> getGroupVocabularies(
199         HttpPrincipal httpPrincipal, long groupId, boolean folksonomy)
200         throws com.liferay.portal.PortalException,
201             com.liferay.portal.SystemException {
202         try {
203             Object paramObj0 = new LongWrapper(groupId);
204 
205             Object paramObj1 = new BooleanWrapper(folksonomy);
206 
207             MethodWrapper methodWrapper = new MethodWrapper(TagsVocabularyServiceUtil.class.getName(),
208                     "getGroupVocabularies",
209                     new Object[] { paramObj0, paramObj1 });
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.PortalException) {
218                     throw (com.liferay.portal.PortalException)e;
219                 }
220 
221                 if (e instanceof com.liferay.portal.SystemException) {
222                     throw (com.liferay.portal.SystemException)e;
223                 }
224 
225                 throw new com.liferay.portal.SystemException(e);
226             }
227 
228             return (java.util.List<com.liferay.portlet.tags.model.TagsVocabulary>)returnObj;
229         }
230         catch (com.liferay.portal.SystemException se) {
231             _log.error(se, se);
232 
233             throw se;
234         }
235     }
236 
237     public static com.liferay.portlet.tags.model.TagsVocabulary getVocabulary(
238         HttpPrincipal httpPrincipal, long vocabularyId)
239         throws com.liferay.portal.PortalException,
240             com.liferay.portal.SystemException {
241         try {
242             Object paramObj0 = new LongWrapper(vocabularyId);
243 
244             MethodWrapper methodWrapper = new MethodWrapper(TagsVocabularyServiceUtil.class.getName(),
245                     "getVocabulary", 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.PortalException) {
254                     throw (com.liferay.portal.PortalException)e;
255                 }
256 
257                 if (e instanceof com.liferay.portal.SystemException) {
258                     throw (com.liferay.portal.SystemException)e;
259                 }
260 
261                 throw new com.liferay.portal.SystemException(e);
262             }
263 
264             return (com.liferay.portlet.tags.model.TagsVocabulary)returnObj;
265         }
266         catch (com.liferay.portal.SystemException se) {
267             _log.error(se, se);
268 
269             throw se;
270         }
271     }
272 
273     public static com.liferay.portlet.tags.model.TagsVocabulary updateVocabulary(
274         HttpPrincipal httpPrincipal, long vocabularyId, java.lang.String name,
275         boolean folksonomy)
276         throws com.liferay.portal.PortalException,
277             com.liferay.portal.SystemException {
278         try {
279             Object paramObj0 = new LongWrapper(vocabularyId);
280 
281             Object paramObj1 = name;
282 
283             if (name == null) {
284                 paramObj1 = new NullWrapper("java.lang.String");
285             }
286 
287             Object paramObj2 = new BooleanWrapper(folksonomy);
288 
289             MethodWrapper methodWrapper = new MethodWrapper(TagsVocabularyServiceUtil.class.getName(),
290                     "updateVocabulary",
291                     new Object[] { paramObj0, paramObj1, paramObj2 });
292 
293             Object returnObj = null;
294 
295             try {
296                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
297             }
298             catch (Exception e) {
299                 if (e instanceof com.liferay.portal.PortalException) {
300                     throw (com.liferay.portal.PortalException)e;
301                 }
302 
303                 if (e instanceof com.liferay.portal.SystemException) {
304                     throw (com.liferay.portal.SystemException)e;
305                 }
306 
307                 throw new com.liferay.portal.SystemException(e);
308             }
309 
310             return (com.liferay.portlet.tags.model.TagsVocabulary)returnObj;
311         }
312         catch (com.liferay.portal.SystemException se) {
313             _log.error(se, se);
314 
315             throw se;
316         }
317     }
318 
319     private static Log _log = LogFactoryUtil.getLog(TagsVocabularyServiceHttp.class);
320 }