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