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.MBThreadServiceUtil;
25  
26  /**
27   * <a href="MBThreadServiceHttp.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.MBThreadServiceUtil} 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       MBThreadServiceSoap
59   * @see       com.liferay.portal.security.auth.HttpPrincipal
60   * @see       com.liferay.portlet.messageboards.service.MBThreadServiceUtil
61   * @generated
62   */
63  public class MBThreadServiceHttp {
64      public static void deleteThread(HttpPrincipal httpPrincipal, long threadId)
65          throws com.liferay.portal.PortalException,
66              com.liferay.portal.SystemException {
67          try {
68              MethodKey methodKey = new MethodKey(MBThreadServiceUtil.class.getName(),
69                      "deleteThread", _deleteThreadParameterTypes0);
70  
71              MethodHandler methodHandler = new MethodHandler(methodKey, threadId);
72  
73              try {
74                  TunnelUtil.invoke(httpPrincipal, methodHandler);
75              }
76              catch (Exception e) {
77                  if (e instanceof com.liferay.portal.PortalException) {
78                      throw (com.liferay.portal.PortalException)e;
79                  }
80  
81                  if (e instanceof com.liferay.portal.SystemException) {
82                      throw (com.liferay.portal.SystemException)e;
83                  }
84  
85                  throw new com.liferay.portal.SystemException(e);
86              }
87          }
88          catch (com.liferay.portal.SystemException se) {
89              _log.error(se, se);
90  
91              throw se;
92          }
93      }
94  
95      public static com.liferay.portal.model.Lock lockThread(
96          HttpPrincipal httpPrincipal, long threadId)
97          throws com.liferay.portal.PortalException,
98              com.liferay.portal.SystemException {
99          try {
100             MethodKey methodKey = new MethodKey(MBThreadServiceUtil.class.getName(),
101                     "lockThread", _lockThreadParameterTypes1);
102 
103             MethodHandler methodHandler = new MethodHandler(methodKey, threadId);
104 
105             Object returnObj = null;
106 
107             try {
108                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
109             }
110             catch (Exception e) {
111                 if (e instanceof com.liferay.portal.PortalException) {
112                     throw (com.liferay.portal.PortalException)e;
113                 }
114 
115                 if (e instanceof com.liferay.portal.SystemException) {
116                     throw (com.liferay.portal.SystemException)e;
117                 }
118 
119                 throw new com.liferay.portal.SystemException(e);
120             }
121 
122             return (com.liferay.portal.model.Lock)returnObj;
123         }
124         catch (com.liferay.portal.SystemException se) {
125             _log.error(se, se);
126 
127             throw se;
128         }
129     }
130 
131     public static com.liferay.portlet.messageboards.model.MBThread moveThread(
132         HttpPrincipal httpPrincipal, long categoryId, long threadId)
133         throws com.liferay.portal.PortalException,
134             com.liferay.portal.SystemException {
135         try {
136             MethodKey methodKey = new MethodKey(MBThreadServiceUtil.class.getName(),
137                     "moveThread", _moveThreadParameterTypes2);
138 
139             MethodHandler methodHandler = new MethodHandler(methodKey,
140                     categoryId, threadId);
141 
142             Object returnObj = null;
143 
144             try {
145                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
146             }
147             catch (Exception e) {
148                 if (e instanceof com.liferay.portal.PortalException) {
149                     throw (com.liferay.portal.PortalException)e;
150                 }
151 
152                 if (e instanceof com.liferay.portal.SystemException) {
153                     throw (com.liferay.portal.SystemException)e;
154                 }
155 
156                 throw new com.liferay.portal.SystemException(e);
157             }
158 
159             return (com.liferay.portlet.messageboards.model.MBThread)returnObj;
160         }
161         catch (com.liferay.portal.SystemException se) {
162             _log.error(se, se);
163 
164             throw se;
165         }
166     }
167 
168     public static com.liferay.portlet.messageboards.model.MBThread splitThread(
169         HttpPrincipal httpPrincipal, long messageId,
170         com.liferay.portal.service.ServiceContext serviceContext)
171         throws com.liferay.portal.PortalException,
172             com.liferay.portal.SystemException {
173         try {
174             MethodKey methodKey = new MethodKey(MBThreadServiceUtil.class.getName(),
175                     "splitThread", _splitThreadParameterTypes3);
176 
177             MethodHandler methodHandler = new MethodHandler(methodKey,
178                     messageId, serviceContext);
179 
180             Object returnObj = null;
181 
182             try {
183                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
184             }
185             catch (Exception e) {
186                 if (e instanceof com.liferay.portal.PortalException) {
187                     throw (com.liferay.portal.PortalException)e;
188                 }
189 
190                 if (e instanceof com.liferay.portal.SystemException) {
191                     throw (com.liferay.portal.SystemException)e;
192                 }
193 
194                 throw new com.liferay.portal.SystemException(e);
195             }
196 
197             return (com.liferay.portlet.messageboards.model.MBThread)returnObj;
198         }
199         catch (com.liferay.portal.SystemException se) {
200             _log.error(se, se);
201 
202             throw se;
203         }
204     }
205 
206     public static void unlockThread(HttpPrincipal httpPrincipal, long threadId)
207         throws com.liferay.portal.PortalException,
208             com.liferay.portal.SystemException {
209         try {
210             MethodKey methodKey = new MethodKey(MBThreadServiceUtil.class.getName(),
211                     "unlockThread", _unlockThreadParameterTypes4);
212 
213             MethodHandler methodHandler = new MethodHandler(methodKey, threadId);
214 
215             try {
216                 TunnelUtil.invoke(httpPrincipal, methodHandler);
217             }
218             catch (Exception e) {
219                 if (e instanceof com.liferay.portal.PortalException) {
220                     throw (com.liferay.portal.PortalException)e;
221                 }
222 
223                 if (e instanceof com.liferay.portal.SystemException) {
224                     throw (com.liferay.portal.SystemException)e;
225                 }
226 
227                 throw new com.liferay.portal.SystemException(e);
228             }
229         }
230         catch (com.liferay.portal.SystemException se) {
231             _log.error(se, se);
232 
233             throw se;
234         }
235     }
236 
237     private static Log _log = LogFactoryUtil.getLog(MBThreadServiceHttp.class);
238     private static final Class<?>[] _deleteThreadParameterTypes0 = new Class[] {
239             long.class
240         };
241     private static final Class<?>[] _lockThreadParameterTypes1 = new Class[] {
242             long.class
243         };
244     private static final Class<?>[] _moveThreadParameterTypes2 = new Class[] {
245             long.class, long.class
246         };
247     private static final Class<?>[] _splitThreadParameterTypes3 = new Class[] {
248             long.class, com.liferay.portal.service.ServiceContext.class
249         };
250     private static final Class<?>[] _unlockThreadParameterTypes4 = new Class[] {
251             long.class
252         };
253 }