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