001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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.MethodHandler;
020    import com.liferay.portal.kernel.util.MethodKey;
021    import com.liferay.portal.security.auth.HttpPrincipal;
022    import com.liferay.portal.service.http.TunnelUtil;
023    
024    import com.liferay.portlet.bookmarks.service.BookmarksEntryServiceUtil;
025    
026    /**
027     * <p>
028     * This class provides a HTTP utility for the
029     * {@link com.liferay.portlet.bookmarks.service.BookmarksEntryServiceUtil} service utility. The
030     * static methods of this class calls the same methods of the service utility.
031     * However, the signatures are different because it requires an additional
032     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
033     * </p>
034     *
035     * <p>
036     * The benefits of using the HTTP utility is that it is fast and allows for
037     * tunneling without the cost of serializing to text. The drawback is that it
038     * only works with Java.
039     * </p>
040     *
041     * <p>
042     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
043     * configure security.
044     * </p>
045     *
046     * <p>
047     * The HTTP utility is only generated for remote services.
048     * </p>
049     *
050     * @author    Brian Wing Shun Chan
051     * @see       BookmarksEntryServiceSoap
052     * @see       com.liferay.portal.security.auth.HttpPrincipal
053     * @see       com.liferay.portlet.bookmarks.service.BookmarksEntryServiceUtil
054     * @generated
055     */
056    public class BookmarksEntryServiceHttp {
057            public static com.liferay.portlet.bookmarks.model.BookmarksEntry addEntry(
058                    HttpPrincipal httpPrincipal, long groupId, long folderId,
059                    java.lang.String name, java.lang.String url, java.lang.String comments,
060                    com.liferay.portal.service.ServiceContext serviceContext)
061                    throws com.liferay.portal.kernel.exception.PortalException,
062                            com.liferay.portal.kernel.exception.SystemException {
063                    try {
064                            MethodKey methodKey = new MethodKey(BookmarksEntryServiceUtil.class.getName(),
065                                            "addEntry", _addEntryParameterTypes0);
066    
067                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
068                                            folderId, name, url, comments, serviceContext);
069    
070                            Object returnObj = null;
071    
072                            try {
073                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
074                            }
075                            catch (Exception e) {
076                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
077                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
078                                    }
079    
080                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
081                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
082                                    }
083    
084                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
085                            }
086    
087                            return (com.liferay.portlet.bookmarks.model.BookmarksEntry)returnObj;
088                    }
089                    catch (com.liferay.portal.kernel.exception.SystemException se) {
090                            _log.error(se, se);
091    
092                            throw se;
093                    }
094            }
095    
096            public static void deleteEntry(HttpPrincipal httpPrincipal, long entryId)
097                    throws com.liferay.portal.kernel.exception.PortalException,
098                            com.liferay.portal.kernel.exception.SystemException {
099                    try {
100                            MethodKey methodKey = new MethodKey(BookmarksEntryServiceUtil.class.getName(),
101                                            "deleteEntry", _deleteEntryParameterTypes1);
102    
103                            MethodHandler methodHandler = new MethodHandler(methodKey, entryId);
104    
105                            try {
106                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
107                            }
108                            catch (Exception e) {
109                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
110                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
111                                    }
112    
113                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
114                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
115                                    }
116    
117                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
118                            }
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 com.liferay.portlet.bookmarks.model.BookmarksEntry getEntry(
128                    HttpPrincipal httpPrincipal, long entryId)
129                    throws com.liferay.portal.kernel.exception.PortalException,
130                            com.liferay.portal.kernel.exception.SystemException {
131                    try {
132                            MethodKey methodKey = new MethodKey(BookmarksEntryServiceUtil.class.getName(),
133                                            "getEntry", _getEntryParameterTypes2);
134    
135                            MethodHandler methodHandler = new MethodHandler(methodKey, entryId);
136    
137                            Object returnObj = null;
138    
139                            try {
140                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
141                            }
142                            catch (Exception e) {
143                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
144                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
145                                    }
146    
147                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
148                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
149                                    }
150    
151                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
152                            }
153    
154                            return (com.liferay.portlet.bookmarks.model.BookmarksEntry)returnObj;
155                    }
156                    catch (com.liferay.portal.kernel.exception.SystemException se) {
157                            _log.error(se, se);
158    
159                            throw se;
160                    }
161            }
162    
163            public static com.liferay.portlet.bookmarks.model.BookmarksEntry openEntry(
164                    HttpPrincipal httpPrincipal, long entryId)
165                    throws com.liferay.portal.kernel.exception.PortalException,
166                            com.liferay.portal.kernel.exception.SystemException {
167                    try {
168                            MethodKey methodKey = new MethodKey(BookmarksEntryServiceUtil.class.getName(),
169                                            "openEntry", _openEntryParameterTypes3);
170    
171                            MethodHandler methodHandler = new MethodHandler(methodKey, entryId);
172    
173                            Object returnObj = null;
174    
175                            try {
176                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
177                            }
178                            catch (Exception e) {
179                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
180                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
181                                    }
182    
183                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
184                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
185                                    }
186    
187                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
188                            }
189    
190                            return (com.liferay.portlet.bookmarks.model.BookmarksEntry)returnObj;
191                    }
192                    catch (com.liferay.portal.kernel.exception.SystemException se) {
193                            _log.error(se, se);
194    
195                            throw se;
196                    }
197            }
198    
199            public static com.liferay.portlet.bookmarks.model.BookmarksEntry updateEntry(
200                    HttpPrincipal httpPrincipal, long entryId, long groupId, long folderId,
201                    java.lang.String name, java.lang.String url, java.lang.String comments,
202                    com.liferay.portal.service.ServiceContext serviceContext)
203                    throws com.liferay.portal.kernel.exception.PortalException,
204                            com.liferay.portal.kernel.exception.SystemException {
205                    try {
206                            MethodKey methodKey = new MethodKey(BookmarksEntryServiceUtil.class.getName(),
207                                            "updateEntry", _updateEntryParameterTypes4);
208    
209                            MethodHandler methodHandler = new MethodHandler(methodKey, entryId,
210                                            groupId, folderId, name, url, comments, serviceContext);
211    
212                            Object returnObj = null;
213    
214                            try {
215                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
216                            }
217                            catch (Exception e) {
218                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
219                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
220                                    }
221    
222                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
223                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
224                                    }
225    
226                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
227                            }
228    
229                            return (com.liferay.portlet.bookmarks.model.BookmarksEntry)returnObj;
230                    }
231                    catch (com.liferay.portal.kernel.exception.SystemException se) {
232                            _log.error(se, se);
233    
234                            throw se;
235                    }
236            }
237    
238            private static Log _log = LogFactoryUtil.getLog(BookmarksEntryServiceHttp.class);
239            private static final Class<?>[] _addEntryParameterTypes0 = new Class[] {
240                            long.class, long.class, java.lang.String.class,
241                            java.lang.String.class, java.lang.String.class,
242                            com.liferay.portal.service.ServiceContext.class
243                    };
244            private static final Class<?>[] _deleteEntryParameterTypes1 = new Class[] {
245                            long.class
246                    };
247            private static final Class<?>[] _getEntryParameterTypes2 = new Class[] {
248                            long.class
249                    };
250            private static final Class<?>[] _openEntryParameterTypes3 = new Class[] {
251                            long.class
252                    };
253            private static final Class<?>[] _updateEntryParameterTypes4 = new Class[] {
254                            long.class, long.class, long.class, java.lang.String.class,
255                            java.lang.String.class, java.lang.String.class,
256                            com.liferay.portal.service.ServiceContext.class
257                    };
258    }