1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
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.BooleanWrapper;
20  import com.liferay.portal.kernel.util.LongWrapper;
21  import com.liferay.portal.kernel.util.MethodWrapper;
22  import com.liferay.portal.kernel.util.NullWrapper;
23  import com.liferay.portal.security.auth.HttpPrincipal;
24  import com.liferay.portal.service.http.TunnelUtil;
25  
26  import com.liferay.portlet.bookmarks.service.BookmarksFolderServiceUtil;
27  
28  /**
29   * <a href="BookmarksFolderServiceHttp.java.html"><b><i>View Source</i></b></a>
30   *
31   * <p>
32   * ServiceBuilder generated this class. Modifications in this class will be
33   * overwritten the next time is generated.
34   * </p>
35   *
36   * <p>
37   * This class provides a HTTP utility for the
38   * {@link com.liferay.portlet.bookmarks.service.BookmarksFolderServiceUtil} service utility. The
39   * static methods of this class calls the same methods of the service utility.
40   * However, the signatures are different because it requires an additional
41   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
42   * </p>
43   *
44   * <p>
45   * The benefits of using the HTTP utility is that it is fast and allows for
46   * tunneling without the cost of serializing to text. The drawback is that it
47   * only works with Java.
48   * </p>
49   *
50   * <p>
51   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
52   * configure security.
53   * </p>
54   *
55   * <p>
56   * The HTTP utility is only generated for remote services.
57   * </p>
58   *
59   * @author    Brian Wing Shun Chan
60   * @see       BookmarksFolderServiceSoap
61   * @see       com.liferay.portal.security.auth.HttpPrincipal
62   * @see       com.liferay.portlet.bookmarks.service.BookmarksFolderServiceUtil
63   * @generated
64   */
65  public class BookmarksFolderServiceHttp {
66      public static com.liferay.portlet.bookmarks.model.BookmarksFolder addFolder(
67          HttpPrincipal httpPrincipal, long parentFolderId,
68          java.lang.String name, java.lang.String description,
69          com.liferay.portal.service.ServiceContext serviceContext)
70          throws com.liferay.portal.kernel.exception.PortalException,
71              com.liferay.portal.kernel.exception.SystemException {
72          try {
73              Object paramObj0 = new LongWrapper(parentFolderId);
74  
75              Object paramObj1 = name;
76  
77              if (name == null) {
78                  paramObj1 = new NullWrapper("java.lang.String");
79              }
80  
81              Object paramObj2 = description;
82  
83              if (description == null) {
84                  paramObj2 = new NullWrapper("java.lang.String");
85              }
86  
87              Object paramObj3 = serviceContext;
88  
89              if (serviceContext == null) {
90                  paramObj3 = new NullWrapper(
91                          "com.liferay.portal.service.ServiceContext");
92              }
93  
94              MethodWrapper methodWrapper = new MethodWrapper(BookmarksFolderServiceUtil.class.getName(),
95                      "addFolder",
96                      new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
97  
98              Object returnObj = null;
99  
100             try {
101                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
102             }
103             catch (Exception e) {
104                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
105                     throw (com.liferay.portal.kernel.exception.PortalException)e;
106                 }
107 
108                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
109                     throw (com.liferay.portal.kernel.exception.SystemException)e;
110                 }
111 
112                 throw new com.liferay.portal.kernel.exception.SystemException(e);
113             }
114 
115             return (com.liferay.portlet.bookmarks.model.BookmarksFolder)returnObj;
116         }
117         catch (com.liferay.portal.kernel.exception.SystemException se) {
118             _log.error(se, se);
119 
120             throw se;
121         }
122     }
123 
124     public static void deleteFolder(HttpPrincipal httpPrincipal, long folderId)
125         throws com.liferay.portal.kernel.exception.PortalException,
126             com.liferay.portal.kernel.exception.SystemException {
127         try {
128             Object paramObj0 = new LongWrapper(folderId);
129 
130             MethodWrapper methodWrapper = new MethodWrapper(BookmarksFolderServiceUtil.class.getName(),
131                     "deleteFolder", new Object[] { paramObj0 });
132 
133             try {
134                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
135             }
136             catch (Exception e) {
137                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
138                     throw (com.liferay.portal.kernel.exception.PortalException)e;
139                 }
140 
141                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
142                     throw (com.liferay.portal.kernel.exception.SystemException)e;
143                 }
144 
145                 throw new com.liferay.portal.kernel.exception.SystemException(e);
146             }
147         }
148         catch (com.liferay.portal.kernel.exception.SystemException se) {
149             _log.error(se, se);
150 
151             throw se;
152         }
153     }
154 
155     public static com.liferay.portlet.bookmarks.model.BookmarksFolder getFolder(
156         HttpPrincipal httpPrincipal, long folderId)
157         throws com.liferay.portal.kernel.exception.PortalException,
158             com.liferay.portal.kernel.exception.SystemException {
159         try {
160             Object paramObj0 = new LongWrapper(folderId);
161 
162             MethodWrapper methodWrapper = new MethodWrapper(BookmarksFolderServiceUtil.class.getName(),
163                     "getFolder", new Object[] { paramObj0 });
164 
165             Object returnObj = null;
166 
167             try {
168                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
169             }
170             catch (Exception e) {
171                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
172                     throw (com.liferay.portal.kernel.exception.PortalException)e;
173                 }
174 
175                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
176                     throw (com.liferay.portal.kernel.exception.SystemException)e;
177                 }
178 
179                 throw new com.liferay.portal.kernel.exception.SystemException(e);
180             }
181 
182             return (com.liferay.portlet.bookmarks.model.BookmarksFolder)returnObj;
183         }
184         catch (com.liferay.portal.kernel.exception.SystemException se) {
185             _log.error(se, se);
186 
187             throw se;
188         }
189     }
190 
191     public static com.liferay.portlet.bookmarks.model.BookmarksFolder updateFolder(
192         HttpPrincipal httpPrincipal, long folderId, long parentFolderId,
193         java.lang.String name, java.lang.String description,
194         boolean mergeWithParentFolder,
195         com.liferay.portal.service.ServiceContext serviceContext)
196         throws com.liferay.portal.kernel.exception.PortalException,
197             com.liferay.portal.kernel.exception.SystemException {
198         try {
199             Object paramObj0 = new LongWrapper(folderId);
200 
201             Object paramObj1 = new LongWrapper(parentFolderId);
202 
203             Object paramObj2 = name;
204 
205             if (name == null) {
206                 paramObj2 = new NullWrapper("java.lang.String");
207             }
208 
209             Object paramObj3 = description;
210 
211             if (description == null) {
212                 paramObj3 = new NullWrapper("java.lang.String");
213             }
214 
215             Object paramObj4 = new BooleanWrapper(mergeWithParentFolder);
216 
217             Object paramObj5 = serviceContext;
218 
219             if (serviceContext == null) {
220                 paramObj5 = new NullWrapper(
221                         "com.liferay.portal.service.ServiceContext");
222             }
223 
224             MethodWrapper methodWrapper = new MethodWrapper(BookmarksFolderServiceUtil.class.getName(),
225                     "updateFolder",
226                     new Object[] {
227                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
228                         paramObj5
229                     });
230 
231             Object returnObj = null;
232 
233             try {
234                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
235             }
236             catch (Exception e) {
237                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
238                     throw (com.liferay.portal.kernel.exception.PortalException)e;
239                 }
240 
241                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
242                     throw (com.liferay.portal.kernel.exception.SystemException)e;
243                 }
244 
245                 throw new com.liferay.portal.kernel.exception.SystemException(e);
246             }
247 
248             return (com.liferay.portlet.bookmarks.model.BookmarksFolder)returnObj;
249         }
250         catch (com.liferay.portal.kernel.exception.SystemException se) {
251             _log.error(se, se);
252 
253             throw se;
254         }
255     }
256 
257     private static Log _log = LogFactoryUtil.getLog(BookmarksFolderServiceHttp.class);
258 }