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.BooleanWrapper;
20  import com.liferay.portal.kernel.util.LongWrapper;
21  import com.liferay.portal.kernel.util.MethodWrapper;
22  import com.liferay.portal.kernel.util.NullWrapper;
23  import com.liferay.portal.security.auth.HttpPrincipal;
24  import com.liferay.portal.service.http.TunnelUtil;
25  
26  import com.liferay.portlet.bookmarks.service.BookmarksEntryServiceUtil;
27  
28  /**
29   * <a href="BookmarksEntryServiceHttp.java.html"><b><i>View Source</i></b></a>
30   *
31   * <p>
32   * ServiceBuilder generated this class. Modifications in this class will be
33   * overwritten the next time is generated.
34   * </p>
35   *
36   * <p>
37   * This class provides a HTTP utility for the
38   * {@link com.liferay.portlet.bookmarks.service.BookmarksEntryServiceUtil} service utility. The
39   * static methods of this class calls the same methods of the service utility.
40   * However, the signatures are different because it requires an additional
41   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
42   * </p>
43   *
44   * <p>
45   * The benefits of using the HTTP utility is that it is fast and allows for
46   * tunneling without the cost of serializing to text. The drawback is that it
47   * only works with Java.
48   * </p>
49   *
50   * <p>
51   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
52   * configure security.
53   * </p>
54   *
55   * <p>
56   * The HTTP utility is only generated for remote services.
57   * </p>
58   *
59   * @author    Brian Wing Shun Chan
60   * @see       BookmarksEntryServiceSoap
61   * @see       com.liferay.portal.security.auth.HttpPrincipal
62   * @see       com.liferay.portlet.bookmarks.service.BookmarksEntryServiceUtil
63   * @generated
64   */
65  public class BookmarksEntryServiceHttp {
66      public static com.liferay.portlet.bookmarks.model.BookmarksEntry addEntry(
67          HttpPrincipal httpPrincipal, long folderId, java.lang.String name,
68          java.lang.String url, java.lang.String comments,
69          java.lang.String[] tagsEntries, boolean addCommunityPermissions,
70          boolean addGuestPermissions)
71          throws com.liferay.portal.PortalException,
72              com.liferay.portal.SystemException {
73          try {
74              Object paramObj0 = new LongWrapper(folderId);
75  
76              Object paramObj1 = name;
77  
78              if (name == null) {
79                  paramObj1 = new NullWrapper("java.lang.String");
80              }
81  
82              Object paramObj2 = url;
83  
84              if (url == null) {
85                  paramObj2 = new NullWrapper("java.lang.String");
86              }
87  
88              Object paramObj3 = comments;
89  
90              if (comments == null) {
91                  paramObj3 = new NullWrapper("java.lang.String");
92              }
93  
94              Object paramObj4 = tagsEntries;
95  
96              if (tagsEntries == null) {
97                  paramObj4 = new NullWrapper("[Ljava.lang.String;");
98              }
99  
100             Object paramObj5 = new BooleanWrapper(addCommunityPermissions);
101 
102             Object paramObj6 = new BooleanWrapper(addGuestPermissions);
103 
104             MethodWrapper methodWrapper = new MethodWrapper(BookmarksEntryServiceUtil.class.getName(),
105                     "addEntry",
106                     new Object[] {
107                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
108                         paramObj5, paramObj6
109                     });
110 
111             Object returnObj = null;
112 
113             try {
114                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
115             }
116             catch (Exception e) {
117                 if (e instanceof com.liferay.portal.PortalException) {
118                     throw (com.liferay.portal.PortalException)e;
119                 }
120 
121                 if (e instanceof com.liferay.portal.SystemException) {
122                     throw (com.liferay.portal.SystemException)e;
123                 }
124 
125                 throw new com.liferay.portal.SystemException(e);
126             }
127 
128             return (com.liferay.portlet.bookmarks.model.BookmarksEntry)returnObj;
129         }
130         catch (com.liferay.portal.SystemException se) {
131             _log.error(se, se);
132 
133             throw se;
134         }
135     }
136 
137     public static com.liferay.portlet.bookmarks.model.BookmarksEntry addEntry(
138         HttpPrincipal httpPrincipal, long folderId, java.lang.String name,
139         java.lang.String url, java.lang.String comments,
140         java.lang.String[] tagsEntries,
141         java.lang.String[] communityPermissions,
142         java.lang.String[] guestPermissions)
143         throws com.liferay.portal.PortalException,
144             com.liferay.portal.SystemException {
145         try {
146             Object paramObj0 = new LongWrapper(folderId);
147 
148             Object paramObj1 = name;
149 
150             if (name == null) {
151                 paramObj1 = new NullWrapper("java.lang.String");
152             }
153 
154             Object paramObj2 = url;
155 
156             if (url == null) {
157                 paramObj2 = new NullWrapper("java.lang.String");
158             }
159 
160             Object paramObj3 = comments;
161 
162             if (comments == null) {
163                 paramObj3 = new NullWrapper("java.lang.String");
164             }
165 
166             Object paramObj4 = tagsEntries;
167 
168             if (tagsEntries == null) {
169                 paramObj4 = new NullWrapper("[Ljava.lang.String;");
170             }
171 
172             Object paramObj5 = communityPermissions;
173 
174             if (communityPermissions == null) {
175                 paramObj5 = new NullWrapper("[Ljava.lang.String;");
176             }
177 
178             Object paramObj6 = guestPermissions;
179 
180             if (guestPermissions == null) {
181                 paramObj6 = new NullWrapper("[Ljava.lang.String;");
182             }
183 
184             MethodWrapper methodWrapper = new MethodWrapper(BookmarksEntryServiceUtil.class.getName(),
185                     "addEntry",
186                     new Object[] {
187                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
188                         paramObj5, paramObj6
189                     });
190 
191             Object returnObj = null;
192 
193             try {
194                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
195             }
196             catch (Exception e) {
197                 if (e instanceof com.liferay.portal.PortalException) {
198                     throw (com.liferay.portal.PortalException)e;
199                 }
200 
201                 if (e instanceof com.liferay.portal.SystemException) {
202                     throw (com.liferay.portal.SystemException)e;
203                 }
204 
205                 throw new com.liferay.portal.SystemException(e);
206             }
207 
208             return (com.liferay.portlet.bookmarks.model.BookmarksEntry)returnObj;
209         }
210         catch (com.liferay.portal.SystemException se) {
211             _log.error(se, se);
212 
213             throw se;
214         }
215     }
216 
217     public static void deleteEntry(HttpPrincipal httpPrincipal, long entryId)
218         throws com.liferay.portal.PortalException,
219             com.liferay.portal.SystemException {
220         try {
221             Object paramObj0 = new LongWrapper(entryId);
222 
223             MethodWrapper methodWrapper = new MethodWrapper(BookmarksEntryServiceUtil.class.getName(),
224                     "deleteEntry", new Object[] { paramObj0 });
225 
226             try {
227                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
228             }
229             catch (Exception e) {
230                 if (e instanceof com.liferay.portal.PortalException) {
231                     throw (com.liferay.portal.PortalException)e;
232                 }
233 
234                 if (e instanceof com.liferay.portal.SystemException) {
235                     throw (com.liferay.portal.SystemException)e;
236                 }
237 
238                 throw new com.liferay.portal.SystemException(e);
239             }
240         }
241         catch (com.liferay.portal.SystemException se) {
242             _log.error(se, se);
243 
244             throw se;
245         }
246     }
247 
248     public static com.liferay.portlet.bookmarks.model.BookmarksEntry getEntry(
249         HttpPrincipal httpPrincipal, long entryId)
250         throws com.liferay.portal.PortalException,
251             com.liferay.portal.SystemException {
252         try {
253             Object paramObj0 = new LongWrapper(entryId);
254 
255             MethodWrapper methodWrapper = new MethodWrapper(BookmarksEntryServiceUtil.class.getName(),
256                     "getEntry", new Object[] { paramObj0 });
257 
258             Object returnObj = null;
259 
260             try {
261                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
262             }
263             catch (Exception e) {
264                 if (e instanceof com.liferay.portal.PortalException) {
265                     throw (com.liferay.portal.PortalException)e;
266                 }
267 
268                 if (e instanceof com.liferay.portal.SystemException) {
269                     throw (com.liferay.portal.SystemException)e;
270                 }
271 
272                 throw new com.liferay.portal.SystemException(e);
273             }
274 
275             return (com.liferay.portlet.bookmarks.model.BookmarksEntry)returnObj;
276         }
277         catch (com.liferay.portal.SystemException se) {
278             _log.error(se, se);
279 
280             throw se;
281         }
282     }
283 
284     public static com.liferay.portlet.bookmarks.model.BookmarksEntry openEntry(
285         HttpPrincipal httpPrincipal, long entryId)
286         throws com.liferay.portal.PortalException,
287             com.liferay.portal.SystemException {
288         try {
289             Object paramObj0 = new LongWrapper(entryId);
290 
291             MethodWrapper methodWrapper = new MethodWrapper(BookmarksEntryServiceUtil.class.getName(),
292                     "openEntry", new Object[] { paramObj0 });
293 
294             Object returnObj = null;
295 
296             try {
297                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
298             }
299             catch (Exception e) {
300                 if (e instanceof com.liferay.portal.PortalException) {
301                     throw (com.liferay.portal.PortalException)e;
302                 }
303 
304                 if (e instanceof com.liferay.portal.SystemException) {
305                     throw (com.liferay.portal.SystemException)e;
306                 }
307 
308                 throw new com.liferay.portal.SystemException(e);
309             }
310 
311             return (com.liferay.portlet.bookmarks.model.BookmarksEntry)returnObj;
312         }
313         catch (com.liferay.portal.SystemException se) {
314             _log.error(se, se);
315 
316             throw se;
317         }
318     }
319 
320     public static com.liferay.portlet.bookmarks.model.BookmarksEntry updateEntry(
321         HttpPrincipal httpPrincipal, long entryId, long folderId,
322         java.lang.String name, java.lang.String url, java.lang.String comments,
323         java.lang.String[] tagsEntries)
324         throws com.liferay.portal.PortalException,
325             com.liferay.portal.SystemException {
326         try {
327             Object paramObj0 = new LongWrapper(entryId);
328 
329             Object paramObj1 = new LongWrapper(folderId);
330 
331             Object paramObj2 = name;
332 
333             if (name == null) {
334                 paramObj2 = new NullWrapper("java.lang.String");
335             }
336 
337             Object paramObj3 = url;
338 
339             if (url == null) {
340                 paramObj3 = new NullWrapper("java.lang.String");
341             }
342 
343             Object paramObj4 = comments;
344 
345             if (comments == null) {
346                 paramObj4 = new NullWrapper("java.lang.String");
347             }
348 
349             Object paramObj5 = tagsEntries;
350 
351             if (tagsEntries == null) {
352                 paramObj5 = new NullWrapper("[Ljava.lang.String;");
353             }
354 
355             MethodWrapper methodWrapper = new MethodWrapper(BookmarksEntryServiceUtil.class.getName(),
356                     "updateEntry",
357                     new Object[] {
358                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
359                         paramObj5
360                     });
361 
362             Object returnObj = null;
363 
364             try {
365                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
366             }
367             catch (Exception e) {
368                 if (e instanceof com.liferay.portal.PortalException) {
369                     throw (com.liferay.portal.PortalException)e;
370                 }
371 
372                 if (e instanceof com.liferay.portal.SystemException) {
373                     throw (com.liferay.portal.SystemException)e;
374                 }
375 
376                 throw new com.liferay.portal.SystemException(e);
377             }
378 
379             return (com.liferay.portlet.bookmarks.model.BookmarksEntry)returnObj;
380         }
381         catch (com.liferay.portal.SystemException se) {
382             _log.error(se, se);
383 
384             throw se;
385         }
386     }
387 
388     private static Log _log = LogFactoryUtil.getLog(BookmarksEntryServiceHttp.class);
389 }