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.messageboards.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.messageboards.service.MBCategoryServiceUtil;
25  
26  /**
27   * <a href="MBCategoryServiceHttp.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.messageboards.service.MBCategoryServiceUtil} 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       MBCategoryServiceSoap
59   * @see       com.liferay.portal.security.auth.HttpPrincipal
60   * @see       com.liferay.portlet.messageboards.service.MBCategoryServiceUtil
61   * @generated
62   */
63  public class MBCategoryServiceHttp {
64      public static com.liferay.portlet.messageboards.model.MBCategory addCategory(
65          HttpPrincipal httpPrincipal, long parentCategoryId,
66          java.lang.String name, java.lang.String description,
67          java.lang.String emailAddress, java.lang.String inProtocol,
68          java.lang.String inServerName, int inServerPort, boolean inUseSSL,
69          java.lang.String inUserName, java.lang.String inPassword,
70          int inReadInterval, java.lang.String outEmailAddress,
71          boolean outCustom, java.lang.String outServerName, int outServerPort,
72          boolean outUseSSL, java.lang.String outUserName,
73          java.lang.String outPassword, boolean mailingListActive,
74          com.liferay.portal.service.ServiceContext serviceContext)
75          throws com.liferay.portal.PortalException,
76              com.liferay.portal.SystemException {
77          try {
78              MethodKey methodKey = new MethodKey(MBCategoryServiceUtil.class.getName(),
79                      "addCategory", _addCategoryParameterTypes0);
80  
81              MethodHandler methodHandler = new MethodHandler(methodKey,
82                      parentCategoryId, name, description, emailAddress,
83                      inProtocol, inServerName, inServerPort, inUseSSL,
84                      inUserName, inPassword, inReadInterval, outEmailAddress,
85                      outCustom, outServerName, outServerPort, outUseSSL,
86                      outUserName, outPassword, mailingListActive, serviceContext);
87  
88              Object returnObj = null;
89  
90              try {
91                  returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
92              }
93              catch (Exception e) {
94                  if (e instanceof com.liferay.portal.PortalException) {
95                      throw (com.liferay.portal.PortalException)e;
96                  }
97  
98                  if (e instanceof com.liferay.portal.SystemException) {
99                      throw (com.liferay.portal.SystemException)e;
100                 }
101 
102                 throw new com.liferay.portal.SystemException(e);
103             }
104 
105             return (com.liferay.portlet.messageboards.model.MBCategory)returnObj;
106         }
107         catch (com.liferay.portal.SystemException se) {
108             _log.error(se, se);
109 
110             throw se;
111         }
112     }
113 
114     public static void deleteCategory(HttpPrincipal httpPrincipal,
115         long categoryId)
116         throws com.liferay.portal.PortalException,
117             com.liferay.portal.SystemException {
118         try {
119             MethodKey methodKey = new MethodKey(MBCategoryServiceUtil.class.getName(),
120                     "deleteCategory", _deleteCategoryParameterTypes1);
121 
122             MethodHandler methodHandler = new MethodHandler(methodKey,
123                     categoryId);
124 
125             try {
126                 TunnelUtil.invoke(httpPrincipal, methodHandler);
127             }
128             catch (Exception e) {
129                 if (e instanceof com.liferay.portal.PortalException) {
130                     throw (com.liferay.portal.PortalException)e;
131                 }
132 
133                 if (e instanceof com.liferay.portal.SystemException) {
134                     throw (com.liferay.portal.SystemException)e;
135                 }
136 
137                 throw new com.liferay.portal.SystemException(e);
138             }
139         }
140         catch (com.liferay.portal.SystemException se) {
141             _log.error(se, se);
142 
143             throw se;
144         }
145     }
146 
147     public static java.util.List<com.liferay.portlet.messageboards.model.MBCategory> getCategories(
148         HttpPrincipal httpPrincipal, long groupId, long parentCategoryId,
149         int start, int end)
150         throws com.liferay.portal.PortalException,
151             com.liferay.portal.SystemException {
152         try {
153             MethodKey methodKey = new MethodKey(MBCategoryServiceUtil.class.getName(),
154                     "getCategories", _getCategoriesParameterTypes2);
155 
156             MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
157                     parentCategoryId, start, end);
158 
159             Object returnObj = null;
160 
161             try {
162                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
163             }
164             catch (Exception e) {
165                 if (e instanceof com.liferay.portal.PortalException) {
166                     throw (com.liferay.portal.PortalException)e;
167                 }
168 
169                 if (e instanceof com.liferay.portal.SystemException) {
170                     throw (com.liferay.portal.SystemException)e;
171                 }
172 
173                 throw new com.liferay.portal.SystemException(e);
174             }
175 
176             return (java.util.List<com.liferay.portlet.messageboards.model.MBCategory>)returnObj;
177         }
178         catch (com.liferay.portal.SystemException se) {
179             _log.error(se, se);
180 
181             throw se;
182         }
183     }
184 
185     public static int getCategoriesCount(HttpPrincipal httpPrincipal,
186         long groupId, long parentCategoryId)
187         throws com.liferay.portal.SystemException {
188         try {
189             MethodKey methodKey = new MethodKey(MBCategoryServiceUtil.class.getName(),
190                     "getCategoriesCount", _getCategoriesCountParameterTypes3);
191 
192             MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
193                     parentCategoryId);
194 
195             Object returnObj = null;
196 
197             try {
198                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
199             }
200             catch (Exception e) {
201                 if (e instanceof com.liferay.portal.SystemException) {
202                     throw (com.liferay.portal.SystemException)e;
203                 }
204 
205                 throw new com.liferay.portal.SystemException(e);
206             }
207 
208             return ((Integer)returnObj).intValue();
209         }
210         catch (com.liferay.portal.SystemException se) {
211             _log.error(se, se);
212 
213             throw se;
214         }
215     }
216 
217     public static com.liferay.portlet.messageboards.model.MBCategory getCategory(
218         HttpPrincipal httpPrincipal, long categoryId)
219         throws com.liferay.portal.PortalException,
220             com.liferay.portal.SystemException {
221         try {
222             MethodKey methodKey = new MethodKey(MBCategoryServiceUtil.class.getName(),
223                     "getCategory", _getCategoryParameterTypes4);
224 
225             MethodHandler methodHandler = new MethodHandler(methodKey,
226                     categoryId);
227 
228             Object returnObj = null;
229 
230             try {
231                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
232             }
233             catch (Exception e) {
234                 if (e instanceof com.liferay.portal.PortalException) {
235                     throw (com.liferay.portal.PortalException)e;
236                 }
237 
238                 if (e instanceof com.liferay.portal.SystemException) {
239                     throw (com.liferay.portal.SystemException)e;
240                 }
241 
242                 throw new com.liferay.portal.SystemException(e);
243             }
244 
245             return (com.liferay.portlet.messageboards.model.MBCategory)returnObj;
246         }
247         catch (com.liferay.portal.SystemException se) {
248             _log.error(se, se);
249 
250             throw se;
251         }
252     }
253 
254     public static void subscribeCategory(HttpPrincipal httpPrincipal,
255         long categoryId)
256         throws com.liferay.portal.PortalException,
257             com.liferay.portal.SystemException {
258         try {
259             MethodKey methodKey = new MethodKey(MBCategoryServiceUtil.class.getName(),
260                     "subscribeCategory", _subscribeCategoryParameterTypes5);
261 
262             MethodHandler methodHandler = new MethodHandler(methodKey,
263                     categoryId);
264 
265             try {
266                 TunnelUtil.invoke(httpPrincipal, methodHandler);
267             }
268             catch (Exception e) {
269                 if (e instanceof com.liferay.portal.PortalException) {
270                     throw (com.liferay.portal.PortalException)e;
271                 }
272 
273                 if (e instanceof com.liferay.portal.SystemException) {
274                     throw (com.liferay.portal.SystemException)e;
275                 }
276 
277                 throw new com.liferay.portal.SystemException(e);
278             }
279         }
280         catch (com.liferay.portal.SystemException se) {
281             _log.error(se, se);
282 
283             throw se;
284         }
285     }
286 
287     public static void unsubscribeCategory(HttpPrincipal httpPrincipal,
288         long categoryId)
289         throws com.liferay.portal.PortalException,
290             com.liferay.portal.SystemException {
291         try {
292             MethodKey methodKey = new MethodKey(MBCategoryServiceUtil.class.getName(),
293                     "unsubscribeCategory", _unsubscribeCategoryParameterTypes6);
294 
295             MethodHandler methodHandler = new MethodHandler(methodKey,
296                     categoryId);
297 
298             try {
299                 TunnelUtil.invoke(httpPrincipal, methodHandler);
300             }
301             catch (Exception e) {
302                 if (e instanceof com.liferay.portal.PortalException) {
303                     throw (com.liferay.portal.PortalException)e;
304                 }
305 
306                 if (e instanceof com.liferay.portal.SystemException) {
307                     throw (com.liferay.portal.SystemException)e;
308                 }
309 
310                 throw new com.liferay.portal.SystemException(e);
311             }
312         }
313         catch (com.liferay.portal.SystemException se) {
314             _log.error(se, se);
315 
316             throw se;
317         }
318     }
319 
320     public static com.liferay.portlet.messageboards.model.MBCategory updateCategory(
321         HttpPrincipal httpPrincipal, long categoryId, long parentCategoryId,
322         java.lang.String name, java.lang.String description,
323         java.lang.String emailAddress, java.lang.String inProtocol,
324         java.lang.String inServerName, int inServerPort, boolean inUseSSL,
325         java.lang.String inUserName, java.lang.String inPassword,
326         int inReadInterval, java.lang.String outEmailAddress,
327         boolean outCustom, java.lang.String outServerName, int outServerPort,
328         boolean outUseSSL, java.lang.String outUserName,
329         java.lang.String outPassword, boolean mailingListActive,
330         boolean mergeWithParentCategory)
331         throws com.liferay.portal.PortalException,
332             com.liferay.portal.SystemException {
333         try {
334             MethodKey methodKey = new MethodKey(MBCategoryServiceUtil.class.getName(),
335                     "updateCategory", _updateCategoryParameterTypes7);
336 
337             MethodHandler methodHandler = new MethodHandler(methodKey,
338                     categoryId, parentCategoryId, name, description,
339                     emailAddress, inProtocol, inServerName, inServerPort,
340                     inUseSSL, inUserName, inPassword, inReadInterval,
341                     outEmailAddress, outCustom, outServerName, outServerPort,
342                     outUseSSL, outUserName, outPassword, mailingListActive,
343                     mergeWithParentCategory);
344 
345             Object returnObj = null;
346 
347             try {
348                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
349             }
350             catch (Exception e) {
351                 if (e instanceof com.liferay.portal.PortalException) {
352                     throw (com.liferay.portal.PortalException)e;
353                 }
354 
355                 if (e instanceof com.liferay.portal.SystemException) {
356                     throw (com.liferay.portal.SystemException)e;
357                 }
358 
359                 throw new com.liferay.portal.SystemException(e);
360             }
361 
362             return (com.liferay.portlet.messageboards.model.MBCategory)returnObj;
363         }
364         catch (com.liferay.portal.SystemException se) {
365             _log.error(se, se);
366 
367             throw se;
368         }
369     }
370 
371     private static Log _log = LogFactoryUtil.getLog(MBCategoryServiceHttp.class);
372     private static final Class<?>[] _addCategoryParameterTypes0 = new Class[] {
373             long.class, java.lang.String.class, java.lang.String.class,
374             java.lang.String.class, java.lang.String.class,
375             java.lang.String.class, int.class, boolean.class,
376             java.lang.String.class, java.lang.String.class, int.class,
377             java.lang.String.class, boolean.class, java.lang.String.class,
378             int.class, boolean.class, java.lang.String.class,
379             java.lang.String.class, boolean.class,
380             com.liferay.portal.service.ServiceContext.class
381         };
382     private static final Class<?>[] _deleteCategoryParameterTypes1 = new Class[] {
383             long.class
384         };
385     private static final Class<?>[] _getCategoriesParameterTypes2 = new Class[] {
386             long.class, long.class, int.class, int.class
387         };
388     private static final Class<?>[] _getCategoriesCountParameterTypes3 = new Class[] {
389             long.class, long.class
390         };
391     private static final Class<?>[] _getCategoryParameterTypes4 = new Class[] {
392             long.class
393         };
394     private static final Class<?>[] _subscribeCategoryParameterTypes5 = new Class[] {
395             long.class
396         };
397     private static final Class<?>[] _unsubscribeCategoryParameterTypes6 = new Class[] {
398             long.class
399         };
400     private static final Class<?>[] _updateCategoryParameterTypes7 = new Class[] {
401             long.class, long.class, java.lang.String.class,
402             java.lang.String.class, java.lang.String.class,
403             java.lang.String.class, java.lang.String.class, int.class,
404             boolean.class, java.lang.String.class, java.lang.String.class,
405             int.class, java.lang.String.class, boolean.class,
406             java.lang.String.class, int.class, boolean.class,
407             java.lang.String.class, java.lang.String.class, boolean.class,
408             boolean.class
409         };
410 }