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.MethodHandler;
20  import com.liferay.portal.kernel.util.MethodKey;
21  import com.liferay.portal.security.auth.HttpPrincipal;
22  import com.liferay.portal.service.http.TunnelUtil;
23  
24  import com.liferay.portlet.bookmarks.service.BookmarksEntryServiceUtil;
25  
26  /**
27   * <a href="BookmarksEntryServiceHttp.java.html"><b><i>View Source</i></b></a>
28   *
29   * <p>
30   * ServiceBuilder generated this class. Modifications in this class will be
31   * overwritten the next time is generated.
32   * </p>
33   *
34   * <p>
35   * This class provides a HTTP utility for the
36   * {@link com.liferay.portlet.bookmarks.service.BookmarksEntryServiceUtil} service utility. The
37   * static methods of this class calls the same methods of the service utility.
38   * However, the signatures are different because it requires an additional
39   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
40   * </p>
41   *
42   * <p>
43   * The benefits of using the HTTP utility is that it is fast and allows for
44   * tunneling without the cost of serializing to text. The drawback is that it
45   * only works with Java.
46   * </p>
47   *
48   * <p>
49   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
50   * configure security.
51   * </p>
52   *
53   * <p>
54   * The HTTP utility is only generated for remote services.
55   * </p>
56   *
57   * @author    Brian Wing Shun Chan
58   * @see       BookmarksEntryServiceSoap
59   * @see       com.liferay.portal.security.auth.HttpPrincipal
60   * @see       com.liferay.portlet.bookmarks.service.BookmarksEntryServiceUtil
61   * @generated
62   */
63  public class BookmarksEntryServiceHttp {
64      public static com.liferay.portlet.bookmarks.model.BookmarksEntry addEntry(
65          HttpPrincipal httpPrincipal, long folderId, java.lang.String name,
66          java.lang.String url, java.lang.String comments,
67          com.liferay.portal.service.ServiceContext serviceContext)
68          throws com.liferay.portal.PortalException,
69              com.liferay.portal.SystemException {
70          try {
71              MethodKey methodKey = new MethodKey(BookmarksEntryServiceUtil.class.getName(),
72                      "addEntry", _addEntryParameterTypes0);
73  
74              MethodHandler methodHandler = new MethodHandler(methodKey,
75                      folderId, name, url, comments, serviceContext);
76  
77              Object returnObj = null;
78  
79              try {
80                  returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
81              }
82              catch (Exception e) {
83                  if (e instanceof com.liferay.portal.PortalException) {
84                      throw (com.liferay.portal.PortalException)e;
85                  }
86  
87                  if (e instanceof com.liferay.portal.SystemException) {
88                      throw (com.liferay.portal.SystemException)e;
89                  }
90  
91                  throw new com.liferay.portal.SystemException(e);
92              }
93  
94              return (com.liferay.portlet.bookmarks.model.BookmarksEntry)returnObj;
95          }
96          catch (com.liferay.portal.SystemException se) {
97              _log.error(se, se);
98  
99              throw se;
100         }
101     }
102 
103     public static void deleteEntry(HttpPrincipal httpPrincipal, long entryId)
104         throws com.liferay.portal.PortalException,
105             com.liferay.portal.SystemException {
106         try {
107             MethodKey methodKey = new MethodKey(BookmarksEntryServiceUtil.class.getName(),
108                     "deleteEntry", _deleteEntryParameterTypes1);
109 
110             MethodHandler methodHandler = new MethodHandler(methodKey, entryId);
111 
112             try {
113                 TunnelUtil.invoke(httpPrincipal, methodHandler);
114             }
115             catch (Exception e) {
116                 if (e instanceof com.liferay.portal.PortalException) {
117                     throw (com.liferay.portal.PortalException)e;
118                 }
119 
120                 if (e instanceof com.liferay.portal.SystemException) {
121                     throw (com.liferay.portal.SystemException)e;
122                 }
123 
124                 throw new com.liferay.portal.SystemException(e);
125             }
126         }
127         catch (com.liferay.portal.SystemException se) {
128             _log.error(se, se);
129 
130             throw se;
131         }
132     }
133 
134     public static com.liferay.portlet.bookmarks.model.BookmarksEntry getEntry(
135         HttpPrincipal httpPrincipal, long entryId)
136         throws com.liferay.portal.PortalException,
137             com.liferay.portal.SystemException {
138         try {
139             MethodKey methodKey = new MethodKey(BookmarksEntryServiceUtil.class.getName(),
140                     "getEntry", _getEntryParameterTypes2);
141 
142             MethodHandler methodHandler = new MethodHandler(methodKey, entryId);
143 
144             Object returnObj = null;
145 
146             try {
147                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
148             }
149             catch (Exception e) {
150                 if (e instanceof com.liferay.portal.PortalException) {
151                     throw (com.liferay.portal.PortalException)e;
152                 }
153 
154                 if (e instanceof com.liferay.portal.SystemException) {
155                     throw (com.liferay.portal.SystemException)e;
156                 }
157 
158                 throw new com.liferay.portal.SystemException(e);
159             }
160 
161             return (com.liferay.portlet.bookmarks.model.BookmarksEntry)returnObj;
162         }
163         catch (com.liferay.portal.SystemException se) {
164             _log.error(se, se);
165 
166             throw se;
167         }
168     }
169 
170     public static com.liferay.portlet.bookmarks.model.BookmarksEntry openEntry(
171         HttpPrincipal httpPrincipal, long entryId)
172         throws com.liferay.portal.PortalException,
173             com.liferay.portal.SystemException {
174         try {
175             MethodKey methodKey = new MethodKey(BookmarksEntryServiceUtil.class.getName(),
176                     "openEntry", _openEntryParameterTypes3);
177 
178             MethodHandler methodHandler = new MethodHandler(methodKey, entryId);
179 
180             Object returnObj = null;
181 
182             try {
183                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
184             }
185             catch (Exception e) {
186                 if (e instanceof com.liferay.portal.PortalException) {
187                     throw (com.liferay.portal.PortalException)e;
188                 }
189 
190                 if (e instanceof com.liferay.portal.SystemException) {
191                     throw (com.liferay.portal.SystemException)e;
192                 }
193 
194                 throw new com.liferay.portal.SystemException(e);
195             }
196 
197             return (com.liferay.portlet.bookmarks.model.BookmarksEntry)returnObj;
198         }
199         catch (com.liferay.portal.SystemException se) {
200             _log.error(se, se);
201 
202             throw se;
203         }
204     }
205 
206     public static com.liferay.portlet.bookmarks.model.BookmarksEntry updateEntry(
207         HttpPrincipal httpPrincipal, long entryId, long folderId,
208         java.lang.String name, java.lang.String url, java.lang.String comments,
209         com.liferay.portal.service.ServiceContext serviceContext)
210         throws com.liferay.portal.PortalException,
211             com.liferay.portal.SystemException {
212         try {
213             MethodKey methodKey = new MethodKey(BookmarksEntryServiceUtil.class.getName(),
214                     "updateEntry", _updateEntryParameterTypes4);
215 
216             MethodHandler methodHandler = new MethodHandler(methodKey, entryId,
217                     folderId, name, url, comments, serviceContext);
218 
219             Object returnObj = null;
220 
221             try {
222                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
223             }
224             catch (Exception e) {
225                 if (e instanceof com.liferay.portal.PortalException) {
226                     throw (com.liferay.portal.PortalException)e;
227                 }
228 
229                 if (e instanceof com.liferay.portal.SystemException) {
230                     throw (com.liferay.portal.SystemException)e;
231                 }
232 
233                 throw new com.liferay.portal.SystemException(e);
234             }
235 
236             return (com.liferay.portlet.bookmarks.model.BookmarksEntry)returnObj;
237         }
238         catch (com.liferay.portal.SystemException se) {
239             _log.error(se, se);
240 
241             throw se;
242         }
243     }
244 
245     private static Log _log = LogFactoryUtil.getLog(BookmarksEntryServiceHttp.class);
246     private static final Class<?>[] _addEntryParameterTypes0 = new Class[] {
247             long.class, java.lang.String.class, java.lang.String.class,
248             java.lang.String.class,
249             com.liferay.portal.service.ServiceContext.class
250         };
251     private static final Class<?>[] _deleteEntryParameterTypes1 = new Class[] {
252             long.class
253         };
254     private static final Class<?>[] _getEntryParameterTypes2 = new Class[] {
255             long.class
256         };
257     private static final Class<?>[] _openEntryParameterTypes3 = new Class[] {
258             long.class
259         };
260     private static final Class<?>[] _updateEntryParameterTypes4 = new Class[] {
261             long.class, long.class, java.lang.String.class,
262             java.lang.String.class, java.lang.String.class,
263             com.liferay.portal.service.ServiceContext.class
264         };
265 }