1   /**
2    * Copyright (c) 2000-2009 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   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portlet.messageboards.service.http;
21  
22  import com.liferay.portal.kernel.log.Log;
23  import com.liferay.portal.kernel.log.LogFactoryUtil;
24  
25  import com.liferay.portlet.messageboards.service.MBMessageServiceUtil;
26  
27  import java.rmi.RemoteException;
28  
29  /**
30   * <a href="MBMessageServiceSoap.java.html"><b><i>View Source</i></b></a>
31   *
32   * <p>
33   * ServiceBuilder generated this class. Modifications in this class will be
34   * overwritten the next time is generated.
35   * </p>
36   *
37   * <p>
38   * This class provides a SOAP utility for the
39   * <code>com.liferay.portlet.messageboards.service.MBMessageServiceUtil</code> service
40   * utility. The static methods of this class calls the same methods of the
41   * service utility. However, the signatures are different because it is
42   * difficult for SOAP to support certain types.
43   * </p>
44   *
45   * <p>
46   * ServiceBuilder follows certain rules in translating the methods. For example,
47   * if the method in the service utility returns a <code>java.util.List</code>,
48   * that is translated to an array of
49   * <code>com.liferay.portlet.messageboards.model.MBMessageSoap</code>. If the method in the
50   * service utility returns a <code>com.liferay.portlet.messageboards.model.MBMessage</code>,
51   * that is translated to a <code>com.liferay.portlet.messageboards.model.MBMessageSoap</code>.
52   * Methods that SOAP cannot safely wire are skipped.
53   * </p>
54   *
55   * <p>
56   * The benefits of using the SOAP utility is that it is cross platform
57   * compatible. SOAP allows different languages like Java, .NET, C++, PHP, and
58   * even Perl, to call the generated services. One drawback of SOAP is that it is
59   * slow because it needs to serialize all calls into a text format (XML).
60   * </p>
61   *
62   * <p>
63   * You can see a list of services at
64   * http://localhost:8080/tunnel-web/secure/axis. Set the property
65   * <code>tunnel.servlet.hosts.allowed</code> in portal.properties to configure
66   * security.
67   * </p>
68   *
69   * <p>
70   * The SOAP utility is only generated for remote services.
71   * </p>
72   *
73   * @author Brian Wing Shun Chan
74   *
75   * @see com.liferay.portlet.messageboards.model.MBMessageSoap
76   * @see com.liferay.portlet.messageboards.service.MBMessageServiceUtil
77   * @see com.liferay.portlet.messageboards.service.http.MBMessageServiceHttp
78   *
79   */
80  public class MBMessageServiceSoap {
81      public static com.liferay.portlet.messageboards.model.MBMessageSoap addDiscussionMessage(
82          java.lang.String className, long classPK, long threadId,
83          long parentMessageId, java.lang.String subject, java.lang.String body,
84          com.liferay.portal.service.ServiceContext serviceContext)
85          throws RemoteException {
86          try {
87              com.liferay.portlet.messageboards.model.MBMessage returnValue = MBMessageServiceUtil.addDiscussionMessage(className,
88                      classPK, threadId, parentMessageId, subject, body,
89                      serviceContext);
90  
91              return com.liferay.portlet.messageboards.model.MBMessageSoap.toSoapModel(returnValue);
92          }
93          catch (Exception e) {
94              _log.error(e, e);
95  
96              throw new RemoteException(e.getMessage());
97          }
98      }
99  
100     public static com.liferay.portlet.messageboards.model.MBMessageSoap addMessage(
101         long categoryId, java.lang.String subject, java.lang.String body,
102         java.util.List<com.liferay.portal.kernel.util.ObjectValuePair<String, byte[]>> files,
103         boolean anonymous, double priority,
104         com.liferay.portal.service.ServiceContext serviceContext)
105         throws RemoteException {
106         try {
107             com.liferay.portlet.messageboards.model.MBMessage returnValue = MBMessageServiceUtil.addMessage(categoryId,
108                     subject, body, files, anonymous, priority, serviceContext);
109 
110             return com.liferay.portlet.messageboards.model.MBMessageSoap.toSoapModel(returnValue);
111         }
112         catch (Exception e) {
113             _log.error(e, e);
114 
115             throw new RemoteException(e.getMessage());
116         }
117     }
118 
119     public static com.liferay.portlet.messageboards.model.MBMessageSoap addMessage(
120         long categoryId, long threadId, long parentMessageId,
121         java.lang.String subject, java.lang.String body,
122         java.util.List<com.liferay.portal.kernel.util.ObjectValuePair<String, byte[]>> files,
123         boolean anonymous, double priority,
124         com.liferay.portal.service.ServiceContext serviceContext)
125         throws RemoteException {
126         try {
127             com.liferay.portlet.messageboards.model.MBMessage returnValue = MBMessageServiceUtil.addMessage(categoryId,
128                     threadId, parentMessageId, subject, body, files, anonymous,
129                     priority, serviceContext);
130 
131             return com.liferay.portlet.messageboards.model.MBMessageSoap.toSoapModel(returnValue);
132         }
133         catch (Exception e) {
134             _log.error(e, e);
135 
136             throw new RemoteException(e.getMessage());
137         }
138     }
139 
140     public static void deleteDiscussionMessage(long groupId,
141         java.lang.String className, long classPK, long messageId)
142         throws RemoteException {
143         try {
144             MBMessageServiceUtil.deleteDiscussionMessage(groupId, className,
145                 classPK, messageId);
146         }
147         catch (Exception e) {
148             _log.error(e, e);
149 
150             throw new RemoteException(e.getMessage());
151         }
152     }
153 
154     public static void deleteMessage(long messageId) throws RemoteException {
155         try {
156             MBMessageServiceUtil.deleteMessage(messageId);
157         }
158         catch (Exception e) {
159             _log.error(e, e);
160 
161             throw new RemoteException(e.getMessage());
162         }
163     }
164 
165     public static com.liferay.portlet.messageboards.model.MBMessageSoap[] getCategoryMessages(
166         long categoryId, int start, int end) throws RemoteException {
167         try {
168             java.util.List<com.liferay.portlet.messageboards.model.MBMessage> returnValue =
169                 MBMessageServiceUtil.getCategoryMessages(categoryId, start, end);
170 
171             return com.liferay.portlet.messageboards.model.MBMessageSoap.toSoapModels(returnValue);
172         }
173         catch (Exception e) {
174             _log.error(e, e);
175 
176             throw new RemoteException(e.getMessage());
177         }
178     }
179 
180     public static int getCategoryMessagesCount(long categoryId)
181         throws RemoteException {
182         try {
183             int returnValue = MBMessageServiceUtil.getCategoryMessagesCount(categoryId);
184 
185             return returnValue;
186         }
187         catch (Exception e) {
188             _log.error(e, e);
189 
190             throw new RemoteException(e.getMessage());
191         }
192     }
193 
194     public static com.liferay.portlet.messageboards.model.MBMessageSoap getMessage(
195         long messageId) throws RemoteException {
196         try {
197             com.liferay.portlet.messageboards.model.MBMessage returnValue = MBMessageServiceUtil.getMessage(messageId);
198 
199             return com.liferay.portlet.messageboards.model.MBMessageSoap.toSoapModel(returnValue);
200         }
201         catch (Exception e) {
202             _log.error(e, e);
203 
204             throw new RemoteException(e.getMessage());
205         }
206     }
207 
208     public static void subscribeMessage(long messageId)
209         throws RemoteException {
210         try {
211             MBMessageServiceUtil.subscribeMessage(messageId);
212         }
213         catch (Exception e) {
214             _log.error(e, e);
215 
216             throw new RemoteException(e.getMessage());
217         }
218     }
219 
220     public static void unsubscribeMessage(long messageId)
221         throws RemoteException {
222         try {
223             MBMessageServiceUtil.unsubscribeMessage(messageId);
224         }
225         catch (Exception e) {
226             _log.error(e, e);
227 
228             throw new RemoteException(e.getMessage());
229         }
230     }
231 
232     public static com.liferay.portlet.messageboards.model.MBMessageSoap updateDiscussionMessage(
233         java.lang.String className, long classPK, long messageId,
234         java.lang.String subject, java.lang.String body,
235         com.liferay.portal.service.ServiceContext serviceContext)
236         throws RemoteException {
237         try {
238             com.liferay.portlet.messageboards.model.MBMessage returnValue = MBMessageServiceUtil.updateDiscussionMessage(className,
239                     classPK, messageId, subject, body, serviceContext);
240 
241             return com.liferay.portlet.messageboards.model.MBMessageSoap.toSoapModel(returnValue);
242         }
243         catch (Exception e) {
244             _log.error(e, e);
245 
246             throw new RemoteException(e.getMessage());
247         }
248     }
249 
250     public static com.liferay.portlet.messageboards.model.MBMessageSoap updateMessage(
251         long messageId, java.lang.String subject, java.lang.String body,
252         java.util.List<com.liferay.portal.kernel.util.ObjectValuePair<String, byte[]>> files,
253         java.util.List<String> existingFiles, double priority,
254         com.liferay.portal.service.ServiceContext serviceContext)
255         throws RemoteException {
256         try {
257             com.liferay.portlet.messageboards.model.MBMessage returnValue = MBMessageServiceUtil.updateMessage(messageId,
258                     subject, body, files, existingFiles, priority,
259                     serviceContext);
260 
261             return com.liferay.portlet.messageboards.model.MBMessageSoap.toSoapModel(returnValue);
262         }
263         catch (Exception e) {
264             _log.error(e, e);
265 
266             throw new RemoteException(e.getMessage());
267         }
268     }
269 
270     private static Log _log = LogFactoryUtil.getLog(MBMessageServiceSoap.class);
271 }