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.LongWrapper;
28  import com.liferay.portal.kernel.util.MethodWrapper;
29  import com.liferay.portal.kernel.util.NullWrapper;
30  import com.liferay.portal.security.auth.HttpPrincipal;
31  import com.liferay.portal.service.http.TunnelUtil;
32  
33  import com.liferay.portlet.bookmarks.service.BookmarksEntryServiceUtil;
34  
35  /**
36   * <a href="BookmarksEntryServiceHttp.java.html"><b><i>View Source</i></b></a>
37   *
38   * <p>
39   * ServiceBuilder generated this class. Modifications in this class will be
40   * overwritten the next time is generated.
41   * </p>
42   *
43   * <p>
44   * This class provides a HTTP utility for the
45   * {@link com.liferay.portlet.bookmarks.service.BookmarksEntryServiceUtil} service utility. The
46   * static methods of this class calls the same methods of the service utility.
47   * However, the signatures are different because it requires an additional
48   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
49   * </p>
50   *
51   * <p>
52   * The benefits of using the HTTP utility is that it is fast and allows for
53   * tunneling without the cost of serializing to text. The drawback is that it
54   * only works with Java.
55   * </p>
56   *
57   * <p>
58   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
59   * configure security.
60   * </p>
61   *
62   * <p>
63   * The HTTP utility is only generated for remote services.
64   * </p>
65   *
66   * @author    Brian Wing Shun Chan
67   * @see       BookmarksEntryServiceSoap
68   * @see       com.liferay.portal.security.auth.HttpPrincipal
69   * @see       com.liferay.portlet.bookmarks.service.BookmarksEntryServiceUtil
70   * @generated
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          com.liferay.portal.service.ServiceContext serviceContext)
77          throws com.liferay.portal.PortalException,
78              com.liferay.portal.SystemException {
79          try {
80              Object paramObj0 = new LongWrapper(folderId);
81  
82              Object paramObj1 = name;
83  
84              if (name == null) {
85                  paramObj1 = new NullWrapper("java.lang.String");
86              }
87  
88              Object paramObj2 = url;
89  
90              if (url == null) {
91                  paramObj2 = new NullWrapper("java.lang.String");
92              }
93  
94              Object paramObj3 = comments;
95  
96              if (comments == null) {
97                  paramObj3 = new NullWrapper("java.lang.String");
98              }
99  
100             Object paramObj4 = serviceContext;
101 
102             if (serviceContext == null) {
103                 paramObj4 = new NullWrapper(
104                         "com.liferay.portal.service.ServiceContext");
105             }
106 
107             MethodWrapper methodWrapper = new MethodWrapper(BookmarksEntryServiceUtil.class.getName(),
108                     "addEntry",
109                     new Object[] {
110                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
111                     });
112 
113             Object returnObj = null;
114 
115             try {
116                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
117             }
118             catch (Exception e) {
119                 if (e instanceof com.liferay.portal.PortalException) {
120                     throw (com.liferay.portal.PortalException)e;
121                 }
122 
123                 if (e instanceof com.liferay.portal.SystemException) {
124                     throw (com.liferay.portal.SystemException)e;
125                 }
126 
127                 throw new com.liferay.portal.SystemException(e);
128             }
129 
130             return (com.liferay.portlet.bookmarks.model.BookmarksEntry)returnObj;
131         }
132         catch (com.liferay.portal.SystemException se) {
133             _log.error(se, se);
134 
135             throw se;
136         }
137     }
138 
139     public static void deleteEntry(HttpPrincipal httpPrincipal, long entryId)
140         throws com.liferay.portal.PortalException,
141             com.liferay.portal.SystemException {
142         try {
143             Object paramObj0 = new LongWrapper(entryId);
144 
145             MethodWrapper methodWrapper = new MethodWrapper(BookmarksEntryServiceUtil.class.getName(),
146                     "deleteEntry", new Object[] { paramObj0 });
147 
148             try {
149                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
150             }
151             catch (Exception e) {
152                 if (e instanceof com.liferay.portal.PortalException) {
153                     throw (com.liferay.portal.PortalException)e;
154                 }
155 
156                 if (e instanceof com.liferay.portal.SystemException) {
157                     throw (com.liferay.portal.SystemException)e;
158                 }
159 
160                 throw new com.liferay.portal.SystemException(e);
161             }
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 getEntry(
171         HttpPrincipal httpPrincipal, long entryId)
172         throws com.liferay.portal.PortalException,
173             com.liferay.portal.SystemException {
174         try {
175             Object paramObj0 = new LongWrapper(entryId);
176 
177             MethodWrapper methodWrapper = new MethodWrapper(BookmarksEntryServiceUtil.class.getName(),
178                     "getEntry", new Object[] { paramObj0 });
179 
180             Object returnObj = null;
181 
182             try {
183                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
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 openEntry(
207         HttpPrincipal httpPrincipal, long entryId)
208         throws com.liferay.portal.PortalException,
209             com.liferay.portal.SystemException {
210         try {
211             Object paramObj0 = new LongWrapper(entryId);
212 
213             MethodWrapper methodWrapper = new MethodWrapper(BookmarksEntryServiceUtil.class.getName(),
214                     "openEntry", new Object[] { paramObj0 });
215 
216             Object returnObj = null;
217 
218             try {
219                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
220             }
221             catch (Exception e) {
222                 if (e instanceof com.liferay.portal.PortalException) {
223                     throw (com.liferay.portal.PortalException)e;
224                 }
225 
226                 if (e instanceof com.liferay.portal.SystemException) {
227                     throw (com.liferay.portal.SystemException)e;
228                 }
229 
230                 throw new com.liferay.portal.SystemException(e);
231             }
232 
233             return (com.liferay.portlet.bookmarks.model.BookmarksEntry)returnObj;
234         }
235         catch (com.liferay.portal.SystemException se) {
236             _log.error(se, se);
237 
238             throw se;
239         }
240     }
241 
242     public static com.liferay.portlet.bookmarks.model.BookmarksEntry updateEntry(
243         HttpPrincipal httpPrincipal, long entryId, long folderId,
244         java.lang.String name, java.lang.String url, java.lang.String comments,
245         com.liferay.portal.service.ServiceContext serviceContext)
246         throws com.liferay.portal.PortalException,
247             com.liferay.portal.SystemException {
248         try {
249             Object paramObj0 = new LongWrapper(entryId);
250 
251             Object paramObj1 = new LongWrapper(folderId);
252 
253             Object paramObj2 = name;
254 
255             if (name == null) {
256                 paramObj2 = new NullWrapper("java.lang.String");
257             }
258 
259             Object paramObj3 = url;
260 
261             if (url == null) {
262                 paramObj3 = new NullWrapper("java.lang.String");
263             }
264 
265             Object paramObj4 = comments;
266 
267             if (comments == null) {
268                 paramObj4 = new NullWrapper("java.lang.String");
269             }
270 
271             Object paramObj5 = serviceContext;
272 
273             if (serviceContext == null) {
274                 paramObj5 = new NullWrapper(
275                         "com.liferay.portal.service.ServiceContext");
276             }
277 
278             MethodWrapper methodWrapper = new MethodWrapper(BookmarksEntryServiceUtil.class.getName(),
279                     "updateEntry",
280                     new Object[] {
281                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
282                         paramObj5
283                     });
284 
285             Object returnObj = null;
286 
287             try {
288                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
289             }
290             catch (Exception e) {
291                 if (e instanceof com.liferay.portal.PortalException) {
292                     throw (com.liferay.portal.PortalException)e;
293                 }
294 
295                 if (e instanceof com.liferay.portal.SystemException) {
296                     throw (com.liferay.portal.SystemException)e;
297                 }
298 
299                 throw new com.liferay.portal.SystemException(e);
300             }
301 
302             return (com.liferay.portlet.bookmarks.model.BookmarksEntry)returnObj;
303         }
304         catch (com.liferay.portal.SystemException se) {
305             _log.error(se, se);
306 
307             throw se;
308         }
309     }
310 
311     private static Log _log = LogFactoryUtil.getLog(BookmarksEntryServiceHttp.class);
312 }