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