1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet.bookmarks.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.LongWrapper;
20  import com.liferay.portal.kernel.util.MethodWrapper;
21  import com.liferay.portal.kernel.util.NullWrapper;
22  import com.liferay.portal.security.auth.HttpPrincipal;
23  import com.liferay.portal.service.http.TunnelUtil;
24  
25  import com.liferay.portlet.bookmarks.service.BookmarksEntryServiceUtil;
26  
27  /**
28   * <a href="BookmarksEntryServiceHttp.java.html"><b><i>View Source</i></b></a>
29   *
30   * <p>
31   * ServiceBuilder generated this class. Modifications in this class will be
32   * overwritten the next time is generated.
33   * </p>
34   *
35   * <p>
36   * This class provides a HTTP utility for the
37   * {@link com.liferay.portlet.bookmarks.service.BookmarksEntryServiceUtil} service utility. The
38   * static methods of this class calls the same methods of the service utility.
39   * However, the signatures are different because it requires an additional
40   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
41   * </p>
42   *
43   * <p>
44   * The benefits of using the HTTP utility is that it is fast and allows for
45   * tunneling without the cost of serializing to text. The drawback is that it
46   * only works with Java.
47   * </p>
48   *
49   * <p>
50   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
51   * configure security.
52   * </p>
53   *
54   * <p>
55   * The HTTP utility is only generated for remote services.
56   * </p>
57   *
58   * @author    Brian Wing Shun Chan
59   * @see       BookmarksEntryServiceSoap
60   * @see       com.liferay.portal.security.auth.HttpPrincipal
61   * @see       com.liferay.portlet.bookmarks.service.BookmarksEntryServiceUtil
62   * @generated
63   */
64  public class BookmarksEntryServiceHttp {
65      public static com.liferay.portlet.bookmarks.model.BookmarksEntry addEntry(
66          HttpPrincipal httpPrincipal, long groupId, long folderId,
67          java.lang.String name, java.lang.String url, java.lang.String comments,
68          com.liferay.portal.service.ServiceContext serviceContext)
69          throws com.liferay.portal.kernel.exception.PortalException,
70              com.liferay.portal.kernel.exception.SystemException {
71          try {
72              Object paramObj0 = new LongWrapper(groupId);
73  
74              Object paramObj1 = new LongWrapper(folderId);
75  
76              Object paramObj2 = name;
77  
78              if (name == null) {
79                  paramObj2 = new NullWrapper("java.lang.String");
80              }
81  
82              Object paramObj3 = url;
83  
84              if (url == null) {
85                  paramObj3 = new NullWrapper("java.lang.String");
86              }
87  
88              Object paramObj4 = comments;
89  
90              if (comments == null) {
91                  paramObj4 = new NullWrapper("java.lang.String");
92              }
93  
94              Object paramObj5 = serviceContext;
95  
96              if (serviceContext == null) {
97                  paramObj5 = new NullWrapper(
98                          "com.liferay.portal.service.ServiceContext");
99              }
100 
101             MethodWrapper methodWrapper = new MethodWrapper(BookmarksEntryServiceUtil.class.getName(),
102                     "addEntry",
103                     new Object[] {
104                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
105                         paramObj5
106                     });
107 
108             Object returnObj = null;
109 
110             try {
111                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
112             }
113             catch (Exception e) {
114                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
115                     throw (com.liferay.portal.kernel.exception.PortalException)e;
116                 }
117 
118                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
119                     throw (com.liferay.portal.kernel.exception.SystemException)e;
120                 }
121 
122                 throw new com.liferay.portal.kernel.exception.SystemException(e);
123             }
124 
125             return (com.liferay.portlet.bookmarks.model.BookmarksEntry)returnObj;
126         }
127         catch (com.liferay.portal.kernel.exception.SystemException se) {
128             _log.error(se, se);
129 
130             throw se;
131         }
132     }
133 
134     public static void deleteEntry(HttpPrincipal httpPrincipal, long entryId)
135         throws com.liferay.portal.kernel.exception.PortalException,
136             com.liferay.portal.kernel.exception.SystemException {
137         try {
138             Object paramObj0 = new LongWrapper(entryId);
139 
140             MethodWrapper methodWrapper = new MethodWrapper(BookmarksEntryServiceUtil.class.getName(),
141                     "deleteEntry", new Object[] { paramObj0 });
142 
143             try {
144                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
145             }
146             catch (Exception e) {
147                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
148                     throw (com.liferay.portal.kernel.exception.PortalException)e;
149                 }
150 
151                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
152                     throw (com.liferay.portal.kernel.exception.SystemException)e;
153                 }
154 
155                 throw new com.liferay.portal.kernel.exception.SystemException(e);
156             }
157         }
158         catch (com.liferay.portal.kernel.exception.SystemException se) {
159             _log.error(se, se);
160 
161             throw se;
162         }
163     }
164 
165     public static com.liferay.portlet.bookmarks.model.BookmarksEntry getEntry(
166         HttpPrincipal httpPrincipal, long entryId)
167         throws com.liferay.portal.kernel.exception.PortalException,
168             com.liferay.portal.kernel.exception.SystemException {
169         try {
170             Object paramObj0 = new LongWrapper(entryId);
171 
172             MethodWrapper methodWrapper = new MethodWrapper(BookmarksEntryServiceUtil.class.getName(),
173                     "getEntry", new Object[] { paramObj0 });
174 
175             Object returnObj = null;
176 
177             try {
178                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
179             }
180             catch (Exception e) {
181                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
182                     throw (com.liferay.portal.kernel.exception.PortalException)e;
183                 }
184 
185                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
186                     throw (com.liferay.portal.kernel.exception.SystemException)e;
187                 }
188 
189                 throw new com.liferay.portal.kernel.exception.SystemException(e);
190             }
191 
192             return (com.liferay.portlet.bookmarks.model.BookmarksEntry)returnObj;
193         }
194         catch (com.liferay.portal.kernel.exception.SystemException se) {
195             _log.error(se, se);
196 
197             throw se;
198         }
199     }
200 
201     public static com.liferay.portlet.bookmarks.model.BookmarksEntry openEntry(
202         HttpPrincipal httpPrincipal, long entryId)
203         throws com.liferay.portal.kernel.exception.PortalException,
204             com.liferay.portal.kernel.exception.SystemException {
205         try {
206             Object paramObj0 = new LongWrapper(entryId);
207 
208             MethodWrapper methodWrapper = new MethodWrapper(BookmarksEntryServiceUtil.class.getName(),
209                     "openEntry", new Object[] { paramObj0 });
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.kernel.exception.PortalException) {
218                     throw (com.liferay.portal.kernel.exception.PortalException)e;
219                 }
220 
221                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
222                     throw (com.liferay.portal.kernel.exception.SystemException)e;
223                 }
224 
225                 throw new com.liferay.portal.kernel.exception.SystemException(e);
226             }
227 
228             return (com.liferay.portlet.bookmarks.model.BookmarksEntry)returnObj;
229         }
230         catch (com.liferay.portal.kernel.exception.SystemException se) {
231             _log.error(se, se);
232 
233             throw se;
234         }
235     }
236 
237     public static com.liferay.portlet.bookmarks.model.BookmarksEntry updateEntry(
238         HttpPrincipal httpPrincipal, long entryId, long groupId, long folderId,
239         java.lang.String name, java.lang.String url, java.lang.String comments,
240         com.liferay.portal.service.ServiceContext serviceContext)
241         throws com.liferay.portal.kernel.exception.PortalException,
242             com.liferay.portal.kernel.exception.SystemException {
243         try {
244             Object paramObj0 = new LongWrapper(entryId);
245 
246             Object paramObj1 = new LongWrapper(groupId);
247 
248             Object paramObj2 = new LongWrapper(folderId);
249 
250             Object paramObj3 = name;
251 
252             if (name == null) {
253                 paramObj3 = new NullWrapper("java.lang.String");
254             }
255 
256             Object paramObj4 = url;
257 
258             if (url == null) {
259                 paramObj4 = new NullWrapper("java.lang.String");
260             }
261 
262             Object paramObj5 = comments;
263 
264             if (comments == null) {
265                 paramObj5 = new NullWrapper("java.lang.String");
266             }
267 
268             Object paramObj6 = serviceContext;
269 
270             if (serviceContext == null) {
271                 paramObj6 = new NullWrapper(
272                         "com.liferay.portal.service.ServiceContext");
273             }
274 
275             MethodWrapper methodWrapper = new MethodWrapper(BookmarksEntryServiceUtil.class.getName(),
276                     "updateEntry",
277                     new Object[] {
278                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
279                         paramObj5, paramObj6
280                     });
281 
282             Object returnObj = null;
283 
284             try {
285                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
286             }
287             catch (Exception e) {
288                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
289                     throw (com.liferay.portal.kernel.exception.PortalException)e;
290                 }
291 
292                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
293                     throw (com.liferay.portal.kernel.exception.SystemException)e;
294                 }
295 
296                 throw new com.liferay.portal.kernel.exception.SystemException(e);
297             }
298 
299             return (com.liferay.portlet.bookmarks.model.BookmarksEntry)returnObj;
300         }
301         catch (com.liferay.portal.kernel.exception.SystemException se) {
302             _log.error(se, se);
303 
304             throw se;
305         }
306     }
307 
308     private static Log _log = LogFactoryUtil.getLog(BookmarksEntryServiceHttp.class);
309 }