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.BookmarksFolderServiceUtil;
25  
26  /**
27   * <a href="BookmarksFolderServiceHttp.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.BookmarksFolderServiceUtil} 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       BookmarksFolderServiceSoap
59   * @see       com.liferay.portal.security.auth.HttpPrincipal
60   * @see       com.liferay.portlet.bookmarks.service.BookmarksFolderServiceUtil
61   * @generated
62   */
63  public class BookmarksFolderServiceHttp {
64      public static com.liferay.portlet.bookmarks.model.BookmarksFolder addFolder(
65          HttpPrincipal httpPrincipal, long parentFolderId,
66          java.lang.String name, java.lang.String description,
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(BookmarksFolderServiceUtil.class.getName(),
72                      "addFolder", _addFolderParameterTypes0);
73  
74              MethodHandler methodHandler = new MethodHandler(methodKey,
75                      parentFolderId, name, description, 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.BookmarksFolder)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 deleteFolder(HttpPrincipal httpPrincipal, long folderId)
104         throws com.liferay.portal.PortalException,
105             com.liferay.portal.SystemException {
106         try {
107             MethodKey methodKey = new MethodKey(BookmarksFolderServiceUtil.class.getName(),
108                     "deleteFolder", _deleteFolderParameterTypes1);
109 
110             MethodHandler methodHandler = new MethodHandler(methodKey, folderId);
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.BookmarksFolder getFolder(
135         HttpPrincipal httpPrincipal, long folderId)
136         throws com.liferay.portal.PortalException,
137             com.liferay.portal.SystemException {
138         try {
139             MethodKey methodKey = new MethodKey(BookmarksFolderServiceUtil.class.getName(),
140                     "getFolder", _getFolderParameterTypes2);
141 
142             MethodHandler methodHandler = new MethodHandler(methodKey, folderId);
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.BookmarksFolder)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.BookmarksFolder updateFolder(
171         HttpPrincipal httpPrincipal, long folderId, long parentFolderId,
172         java.lang.String name, java.lang.String description,
173         boolean mergeWithParentFolder,
174         com.liferay.portal.service.ServiceContext serviceContext)
175         throws com.liferay.portal.PortalException,
176             com.liferay.portal.SystemException {
177         try {
178             MethodKey methodKey = new MethodKey(BookmarksFolderServiceUtil.class.getName(),
179                     "updateFolder", _updateFolderParameterTypes3);
180 
181             MethodHandler methodHandler = new MethodHandler(methodKey,
182                     folderId, parentFolderId, name, description,
183                     mergeWithParentFolder, serviceContext);
184 
185             Object returnObj = null;
186 
187             try {
188                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
189             }
190             catch (Exception e) {
191                 if (e instanceof com.liferay.portal.PortalException) {
192                     throw (com.liferay.portal.PortalException)e;
193                 }
194 
195                 if (e instanceof com.liferay.portal.SystemException) {
196                     throw (com.liferay.portal.SystemException)e;
197                 }
198 
199                 throw new com.liferay.portal.SystemException(e);
200             }
201 
202             return (com.liferay.portlet.bookmarks.model.BookmarksFolder)returnObj;
203         }
204         catch (com.liferay.portal.SystemException se) {
205             _log.error(se, se);
206 
207             throw se;
208         }
209     }
210 
211     private static Log _log = LogFactoryUtil.getLog(BookmarksFolderServiceHttp.class);
212     private static final Class<?>[] _addFolderParameterTypes0 = new Class[] {
213             long.class, java.lang.String.class, java.lang.String.class,
214             com.liferay.portal.service.ServiceContext.class
215         };
216     private static final Class<?>[] _deleteFolderParameterTypes1 = new Class[] {
217             long.class
218         };
219     private static final Class<?>[] _getFolderParameterTypes2 = new Class[] {
220             long.class
221         };
222     private static final Class<?>[] _updateFolderParameterTypes3 = new Class[] {
223             long.class, long.class, java.lang.String.class,
224             java.lang.String.class, boolean.class,
225             com.liferay.portal.service.ServiceContext.class
226         };
227 }