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.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 folderId, java.lang.String name,
67          java.lang.String url, java.lang.String comments,
68          com.liferay.portal.service.ServiceContext serviceContext)
69          throws com.liferay.portal.PortalException,
70              com.liferay.portal.SystemException {
71          try {
72              Object paramObj0 = new LongWrapper(folderId);
73  
74              Object paramObj1 = name;
75  
76              if (name == null) {
77                  paramObj1 = new NullWrapper("java.lang.String");
78              }
79  
80              Object paramObj2 = url;
81  
82              if (url == null) {
83                  paramObj2 = new NullWrapper("java.lang.String");
84              }
85  
86              Object paramObj3 = comments;
87  
88              if (comments == null) {
89                  paramObj3 = new NullWrapper("java.lang.String");
90              }
91  
92              Object paramObj4 = serviceContext;
93  
94              if (serviceContext == null) {
95                  paramObj4 = new NullWrapper(
96                          "com.liferay.portal.service.ServiceContext");
97              }
98  
99              MethodWrapper methodWrapper = new MethodWrapper(BookmarksEntryServiceUtil.class.getName(),
100                     "addEntry",
101                     new Object[] {
102                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
103                     });
104 
105             Object returnObj = null;
106 
107             try {
108                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
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.portlet.bookmarks.model.BookmarksEntry)returnObj;
123         }
124         catch (com.liferay.portal.SystemException se) {
125             _log.error(se, se);
126 
127             throw se;
128         }
129     }
130 
131     public static void deleteEntry(HttpPrincipal httpPrincipal, long entryId)
132         throws com.liferay.portal.PortalException,
133             com.liferay.portal.SystemException {
134         try {
135             Object paramObj0 = new LongWrapper(entryId);
136 
137             MethodWrapper methodWrapper = new MethodWrapper(BookmarksEntryServiceUtil.class.getName(),
138                     "deleteEntry", new Object[] { paramObj0 });
139 
140             try {
141                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
142             }
143             catch (Exception e) {
144                 if (e instanceof com.liferay.portal.PortalException) {
145                     throw (com.liferay.portal.PortalException)e;
146                 }
147 
148                 if (e instanceof com.liferay.portal.SystemException) {
149                     throw (com.liferay.portal.SystemException)e;
150                 }
151 
152                 throw new com.liferay.portal.SystemException(e);
153             }
154         }
155         catch (com.liferay.portal.SystemException se) {
156             _log.error(se, se);
157 
158             throw se;
159         }
160     }
161 
162     public static com.liferay.portlet.bookmarks.model.BookmarksEntry getEntry(
163         HttpPrincipal httpPrincipal, long entryId)
164         throws com.liferay.portal.PortalException,
165             com.liferay.portal.SystemException {
166         try {
167             Object paramObj0 = new LongWrapper(entryId);
168 
169             MethodWrapper methodWrapper = new MethodWrapper(BookmarksEntryServiceUtil.class.getName(),
170                     "getEntry", new Object[] { paramObj0 });
171 
172             Object returnObj = null;
173 
174             try {
175                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
176             }
177             catch (Exception e) {
178                 if (e instanceof com.liferay.portal.PortalException) {
179                     throw (com.liferay.portal.PortalException)e;
180                 }
181 
182                 if (e instanceof com.liferay.portal.SystemException) {
183                     throw (com.liferay.portal.SystemException)e;
184                 }
185 
186                 throw new com.liferay.portal.SystemException(e);
187             }
188 
189             return (com.liferay.portlet.bookmarks.model.BookmarksEntry)returnObj;
190         }
191         catch (com.liferay.portal.SystemException se) {
192             _log.error(se, se);
193 
194             throw se;
195         }
196     }
197 
198     public static com.liferay.portlet.bookmarks.model.BookmarksEntry openEntry(
199         HttpPrincipal httpPrincipal, long entryId)
200         throws com.liferay.portal.PortalException,
201             com.liferay.portal.SystemException {
202         try {
203             Object paramObj0 = new LongWrapper(entryId);
204 
205             MethodWrapper methodWrapper = new MethodWrapper(BookmarksEntryServiceUtil.class.getName(),
206                     "openEntry", new Object[] { paramObj0 });
207 
208             Object returnObj = null;
209 
210             try {
211                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
212             }
213             catch (Exception e) {
214                 if (e instanceof com.liferay.portal.PortalException) {
215                     throw (com.liferay.portal.PortalException)e;
216                 }
217 
218                 if (e instanceof com.liferay.portal.SystemException) {
219                     throw (com.liferay.portal.SystemException)e;
220                 }
221 
222                 throw new com.liferay.portal.SystemException(e);
223             }
224 
225             return (com.liferay.portlet.bookmarks.model.BookmarksEntry)returnObj;
226         }
227         catch (com.liferay.portal.SystemException se) {
228             _log.error(se, se);
229 
230             throw se;
231         }
232     }
233 
234     public static com.liferay.portlet.bookmarks.model.BookmarksEntry updateEntry(
235         HttpPrincipal httpPrincipal, long entryId, long folderId,
236         java.lang.String name, java.lang.String url, java.lang.String comments,
237         com.liferay.portal.service.ServiceContext serviceContext)
238         throws com.liferay.portal.PortalException,
239             com.liferay.portal.SystemException {
240         try {
241             Object paramObj0 = new LongWrapper(entryId);
242 
243             Object paramObj1 = new LongWrapper(folderId);
244 
245             Object paramObj2 = name;
246 
247             if (name == null) {
248                 paramObj2 = new NullWrapper("java.lang.String");
249             }
250 
251             Object paramObj3 = url;
252 
253             if (url == null) {
254                 paramObj3 = new NullWrapper("java.lang.String");
255             }
256 
257             Object paramObj4 = comments;
258 
259             if (comments == null) {
260                 paramObj4 = new NullWrapper("java.lang.String");
261             }
262 
263             Object paramObj5 = serviceContext;
264 
265             if (serviceContext == null) {
266                 paramObj5 = new NullWrapper(
267                         "com.liferay.portal.service.ServiceContext");
268             }
269 
270             MethodWrapper methodWrapper = new MethodWrapper(BookmarksEntryServiceUtil.class.getName(),
271                     "updateEntry",
272                     new Object[] {
273                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
274                         paramObj5
275                     });
276 
277             Object returnObj = null;
278 
279             try {
280                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
281             }
282             catch (Exception e) {
283                 if (e instanceof com.liferay.portal.PortalException) {
284                     throw (com.liferay.portal.PortalException)e;
285                 }
286 
287                 if (e instanceof com.liferay.portal.SystemException) {
288                     throw (com.liferay.portal.SystemException)e;
289                 }
290 
291                 throw new com.liferay.portal.SystemException(e);
292             }
293 
294             return (com.liferay.portlet.bookmarks.model.BookmarksEntry)returnObj;
295         }
296         catch (com.liferay.portal.SystemException se) {
297             _log.error(se, se);
298 
299             throw se;
300         }
301     }
302 
303     private static Log _log = LogFactoryUtil.getLog(BookmarksEntryServiceHttp.class);
304 }