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.BooleanWrapper;
020    import com.liferay.portal.kernel.util.LongWrapper;
021    import com.liferay.portal.kernel.util.MethodWrapper;
022    import com.liferay.portal.kernel.util.NullWrapper;
023    import com.liferay.portal.security.auth.HttpPrincipal;
024    import com.liferay.portal.service.http.TunnelUtil;
025    
026    import com.liferay.portlet.bookmarks.service.BookmarksFolderServiceUtil;
027    
028    /**
029     * <p>
030     * This class provides a HTTP utility for the
031     * {@link com.liferay.portlet.bookmarks.service.BookmarksFolderServiceUtil} service utility. The
032     * static methods of this class calls the same methods of the service utility.
033     * However, the signatures are different because it requires an additional
034     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
035     * </p>
036     *
037     * <p>
038     * The benefits of using the HTTP utility is that it is fast and allows for
039     * tunneling without the cost of serializing to text. The drawback is that it
040     * only works with Java.
041     * </p>
042     *
043     * <p>
044     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
045     * configure security.
046     * </p>
047     *
048     * <p>
049     * The HTTP utility is only generated for remote services.
050     * </p>
051     *
052     * @author    Brian Wing Shun Chan
053     * @see       BookmarksFolderServiceSoap
054     * @see       com.liferay.portal.security.auth.HttpPrincipal
055     * @see       com.liferay.portlet.bookmarks.service.BookmarksFolderServiceUtil
056     * @generated
057     */
058    public class BookmarksFolderServiceHttp {
059            public static com.liferay.portlet.bookmarks.model.BookmarksFolder addFolder(
060                    HttpPrincipal httpPrincipal, long parentFolderId,
061                    java.lang.String name, java.lang.String description,
062                    com.liferay.portal.service.ServiceContext serviceContext)
063                    throws com.liferay.portal.kernel.exception.PortalException,
064                            com.liferay.portal.kernel.exception.SystemException {
065                    try {
066                            Object paramObj0 = new LongWrapper(parentFolderId);
067    
068                            Object paramObj1 = name;
069    
070                            if (name == null) {
071                                    paramObj1 = new NullWrapper("java.lang.String");
072                            }
073    
074                            Object paramObj2 = description;
075    
076                            if (description == null) {
077                                    paramObj2 = new NullWrapper("java.lang.String");
078                            }
079    
080                            Object paramObj3 = serviceContext;
081    
082                            if (serviceContext == null) {
083                                    paramObj3 = new NullWrapper(
084                                                    "com.liferay.portal.service.ServiceContext");
085                            }
086    
087                            MethodWrapper methodWrapper = new MethodWrapper(BookmarksFolderServiceUtil.class.getName(),
088                                            "addFolder",
089                                            new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
090    
091                            Object returnObj = null;
092    
093                            try {
094                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
095                            }
096                            catch (Exception e) {
097                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
098                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
099                                    }
100    
101                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
102                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
103                                    }
104    
105                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
106                            }
107    
108                            return (com.liferay.portlet.bookmarks.model.BookmarksFolder)returnObj;
109                    }
110                    catch (com.liferay.portal.kernel.exception.SystemException se) {
111                            _log.error(se, se);
112    
113                            throw se;
114                    }
115            }
116    
117            public static void deleteFolder(HttpPrincipal httpPrincipal, long folderId)
118                    throws com.liferay.portal.kernel.exception.PortalException,
119                            com.liferay.portal.kernel.exception.SystemException {
120                    try {
121                            Object paramObj0 = new LongWrapper(folderId);
122    
123                            MethodWrapper methodWrapper = new MethodWrapper(BookmarksFolderServiceUtil.class.getName(),
124                                            "deleteFolder", new Object[] { paramObj0 });
125    
126                            try {
127                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
128                            }
129                            catch (Exception e) {
130                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
131                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
132                                    }
133    
134                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
135                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
136                                    }
137    
138                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
139                            }
140                    }
141                    catch (com.liferay.portal.kernel.exception.SystemException se) {
142                            _log.error(se, se);
143    
144                            throw se;
145                    }
146            }
147    
148            public static com.liferay.portlet.bookmarks.model.BookmarksFolder getFolder(
149                    HttpPrincipal httpPrincipal, long folderId)
150                    throws com.liferay.portal.kernel.exception.PortalException,
151                            com.liferay.portal.kernel.exception.SystemException {
152                    try {
153                            Object paramObj0 = new LongWrapper(folderId);
154    
155                            MethodWrapper methodWrapper = new MethodWrapper(BookmarksFolderServiceUtil.class.getName(),
156                                            "getFolder", new Object[] { paramObj0 });
157    
158                            Object returnObj = null;
159    
160                            try {
161                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
162                            }
163                            catch (Exception e) {
164                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
165                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
166                                    }
167    
168                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
169                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
170                                    }
171    
172                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
173                            }
174    
175                            return (com.liferay.portlet.bookmarks.model.BookmarksFolder)returnObj;
176                    }
177                    catch (com.liferay.portal.kernel.exception.SystemException se) {
178                            _log.error(se, se);
179    
180                            throw se;
181                    }
182            }
183    
184            public static com.liferay.portlet.bookmarks.model.BookmarksFolder updateFolder(
185                    HttpPrincipal httpPrincipal, long folderId, long parentFolderId,
186                    java.lang.String name, java.lang.String description,
187                    boolean mergeWithParentFolder,
188                    com.liferay.portal.service.ServiceContext serviceContext)
189                    throws com.liferay.portal.kernel.exception.PortalException,
190                            com.liferay.portal.kernel.exception.SystemException {
191                    try {
192                            Object paramObj0 = new LongWrapper(folderId);
193    
194                            Object paramObj1 = new LongWrapper(parentFolderId);
195    
196                            Object paramObj2 = name;
197    
198                            if (name == null) {
199                                    paramObj2 = new NullWrapper("java.lang.String");
200                            }
201    
202                            Object paramObj3 = description;
203    
204                            if (description == null) {
205                                    paramObj3 = new NullWrapper("java.lang.String");
206                            }
207    
208                            Object paramObj4 = new BooleanWrapper(mergeWithParentFolder);
209    
210                            Object paramObj5 = serviceContext;
211    
212                            if (serviceContext == null) {
213                                    paramObj5 = new NullWrapper(
214                                                    "com.liferay.portal.service.ServiceContext");
215                            }
216    
217                            MethodWrapper methodWrapper = new MethodWrapper(BookmarksFolderServiceUtil.class.getName(),
218                                            "updateFolder",
219                                            new Object[] {
220                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
221                                                    paramObj5
222                                            });
223    
224                            Object returnObj = null;
225    
226                            try {
227                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
228                            }
229                            catch (Exception e) {
230                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
231                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
232                                    }
233    
234                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
235                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
236                                    }
237    
238                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
239                            }
240    
241                            return (com.liferay.portlet.bookmarks.model.BookmarksFolder)returnObj;
242                    }
243                    catch (com.liferay.portal.kernel.exception.SystemException se) {
244                            _log.error(se, se);
245    
246                            throw se;
247                    }
248            }
249    
250            private static Log _log = LogFactoryUtil.getLog(BookmarksFolderServiceHttp.class);
251    }