001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.bookmarks.service.http;
016    
017    import com.liferay.portal.kernel.log.Log;
018    import com.liferay.portal.kernel.log.LogFactoryUtil;
019    import com.liferay.portal.kernel.util.LongWrapper;
020    import com.liferay.portal.kernel.util.MethodWrapper;
021    import com.liferay.portal.kernel.util.NullWrapper;
022    import com.liferay.portal.security.auth.HttpPrincipal;
023    import com.liferay.portal.service.http.TunnelUtil;
024    
025    import com.liferay.portlet.bookmarks.service.BookmarksEntryServiceUtil;
026    
027    /**
028     * <p>
029     * This class provides a HTTP utility for the
030     * {@link com.liferay.portlet.bookmarks.service.BookmarksEntryServiceUtil} service utility. The
031     * static methods of this class calls the same methods of the service utility.
032     * However, the signatures are different because it requires an additional
033     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
034     * </p>
035     *
036     * <p>
037     * The benefits of using the HTTP utility is that it is fast and allows for
038     * tunneling without the cost of serializing to text. The drawback is that it
039     * only works with Java.
040     * </p>
041     *
042     * <p>
043     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
044     * configure security.
045     * </p>
046     *
047     * <p>
048     * The HTTP utility is only generated for remote services.
049     * </p>
050     *
051     * @author    Brian Wing Shun Chan
052     * @see       BookmarksEntryServiceSoap
053     * @see       com.liferay.portal.security.auth.HttpPrincipal
054     * @see       com.liferay.portlet.bookmarks.service.BookmarksEntryServiceUtil
055     * @generated
056     */
057    public class BookmarksEntryServiceHttp {
058            public static com.liferay.portlet.bookmarks.model.BookmarksEntry addEntry(
059                    HttpPrincipal httpPrincipal, long groupId, long folderId,
060                    java.lang.String name, java.lang.String url, java.lang.String comments,
061                    com.liferay.portal.service.ServiceContext serviceContext)
062                    throws com.liferay.portal.kernel.exception.PortalException,
063                            com.liferay.portal.kernel.exception.SystemException {
064                    try {
065                            Object paramObj0 = new LongWrapper(groupId);
066    
067                            Object paramObj1 = new LongWrapper(folderId);
068    
069                            Object paramObj2 = name;
070    
071                            if (name == null) {
072                                    paramObj2 = new NullWrapper("java.lang.String");
073                            }
074    
075                            Object paramObj3 = url;
076    
077                            if (url == null) {
078                                    paramObj3 = new NullWrapper("java.lang.String");
079                            }
080    
081                            Object paramObj4 = comments;
082    
083                            if (comments == null) {
084                                    paramObj4 = new NullWrapper("java.lang.String");
085                            }
086    
087                            Object paramObj5 = serviceContext;
088    
089                            if (serviceContext == null) {
090                                    paramObj5 = new NullWrapper(
091                                                    "com.liferay.portal.service.ServiceContext");
092                            }
093    
094                            MethodWrapper methodWrapper = new MethodWrapper(BookmarksEntryServiceUtil.class.getName(),
095                                            "addEntry",
096                                            new Object[] {
097                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
098                                                    paramObj5
099                                            });
100    
101                            Object returnObj = null;
102    
103                            try {
104                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
105                            }
106                            catch (Exception e) {
107                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
108                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
109                                    }
110    
111                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
112                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
113                                    }
114    
115                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
116                            }
117    
118                            return (com.liferay.portlet.bookmarks.model.BookmarksEntry)returnObj;
119                    }
120                    catch (com.liferay.portal.kernel.exception.SystemException se) {
121                            _log.error(se, se);
122    
123                            throw se;
124                    }
125            }
126    
127            public static void deleteEntry(HttpPrincipal httpPrincipal, long entryId)
128                    throws com.liferay.portal.kernel.exception.PortalException,
129                            com.liferay.portal.kernel.exception.SystemException {
130                    try {
131                            Object paramObj0 = new LongWrapper(entryId);
132    
133                            MethodWrapper methodWrapper = new MethodWrapper(BookmarksEntryServiceUtil.class.getName(),
134                                            "deleteEntry", new Object[] { paramObj0 });
135    
136                            try {
137                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
138                            }
139                            catch (Exception e) {
140                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
141                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
142                                    }
143    
144                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
145                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
146                                    }
147    
148                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
149                            }
150                    }
151                    catch (com.liferay.portal.kernel.exception.SystemException se) {
152                            _log.error(se, se);
153    
154                            throw se;
155                    }
156            }
157    
158            public static com.liferay.portlet.bookmarks.model.BookmarksEntry getEntry(
159                    HttpPrincipal httpPrincipal, long entryId)
160                    throws com.liferay.portal.kernel.exception.PortalException,
161                            com.liferay.portal.kernel.exception.SystemException {
162                    try {
163                            Object paramObj0 = new LongWrapper(entryId);
164    
165                            MethodWrapper methodWrapper = new MethodWrapper(BookmarksEntryServiceUtil.class.getName(),
166                                            "getEntry", new Object[] { paramObj0 });
167    
168                            Object returnObj = null;
169    
170                            try {
171                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
172                            }
173                            catch (Exception e) {
174                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
175                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
176                                    }
177    
178                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
179                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
180                                    }
181    
182                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
183                            }
184    
185                            return (com.liferay.portlet.bookmarks.model.BookmarksEntry)returnObj;
186                    }
187                    catch (com.liferay.portal.kernel.exception.SystemException se) {
188                            _log.error(se, se);
189    
190                            throw se;
191                    }
192            }
193    
194            public static com.liferay.portlet.bookmarks.model.BookmarksEntry openEntry(
195                    HttpPrincipal httpPrincipal, long entryId)
196                    throws com.liferay.portal.kernel.exception.PortalException,
197                            com.liferay.portal.kernel.exception.SystemException {
198                    try {
199                            Object paramObj0 = new LongWrapper(entryId);
200    
201                            MethodWrapper methodWrapper = new MethodWrapper(BookmarksEntryServiceUtil.class.getName(),
202                                            "openEntry", new Object[] { paramObj0 });
203    
204                            Object returnObj = null;
205    
206                            try {
207                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
208                            }
209                            catch (Exception e) {
210                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
211                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
212                                    }
213    
214                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
215                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
216                                    }
217    
218                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
219                            }
220    
221                            return (com.liferay.portlet.bookmarks.model.BookmarksEntry)returnObj;
222                    }
223                    catch (com.liferay.portal.kernel.exception.SystemException se) {
224                            _log.error(se, se);
225    
226                            throw se;
227                    }
228            }
229    
230            public static com.liferay.portlet.bookmarks.model.BookmarksEntry updateEntry(
231                    HttpPrincipal httpPrincipal, long entryId, long groupId, long folderId,
232                    java.lang.String name, java.lang.String url, java.lang.String comments,
233                    com.liferay.portal.service.ServiceContext serviceContext)
234                    throws com.liferay.portal.kernel.exception.PortalException,
235                            com.liferay.portal.kernel.exception.SystemException {
236                    try {
237                            Object paramObj0 = new LongWrapper(entryId);
238    
239                            Object paramObj1 = new LongWrapper(groupId);
240    
241                            Object paramObj2 = new LongWrapper(folderId);
242    
243                            Object paramObj3 = name;
244    
245                            if (name == null) {
246                                    paramObj3 = new NullWrapper("java.lang.String");
247                            }
248    
249                            Object paramObj4 = url;
250    
251                            if (url == null) {
252                                    paramObj4 = new NullWrapper("java.lang.String");
253                            }
254    
255                            Object paramObj5 = comments;
256    
257                            if (comments == null) {
258                                    paramObj5 = new NullWrapper("java.lang.String");
259                            }
260    
261                            Object paramObj6 = serviceContext;
262    
263                            if (serviceContext == null) {
264                                    paramObj6 = new NullWrapper(
265                                                    "com.liferay.portal.service.ServiceContext");
266                            }
267    
268                            MethodWrapper methodWrapper = new MethodWrapper(BookmarksEntryServiceUtil.class.getName(),
269                                            "updateEntry",
270                                            new Object[] {
271                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
272                                                    paramObj5, paramObj6
273                                            });
274    
275                            Object returnObj = null;
276    
277                            try {
278                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
279                            }
280                            catch (Exception e) {
281                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
282                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
283                                    }
284    
285                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
286                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
287                                    }
288    
289                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
290                            }
291    
292                            return (com.liferay.portlet.bookmarks.model.BookmarksEntry)returnObj;
293                    }
294                    catch (com.liferay.portal.kernel.exception.SystemException se) {
295                            _log.error(se, se);
296    
297                            throw se;
298                    }
299            }
300    
301            private static Log _log = LogFactoryUtil.getLog(BookmarksEntryServiceHttp.class);
302    }