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