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.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 plid, long parentFolderId,
68          java.lang.String name, java.lang.String description,
69          boolean addCommunityPermissions, boolean addGuestPermissions)
70          throws com.liferay.portal.PortalException,
71              com.liferay.portal.SystemException {
72          try {
73              Object paramObj0 = new LongWrapper(plid);
74  
75              Object paramObj1 = new LongWrapper(parentFolderId);
76  
77              Object paramObj2 = name;
78  
79              if (name == null) {
80                  paramObj2 = new NullWrapper("java.lang.String");
81              }
82  
83              Object paramObj3 = description;
84  
85              if (description == null) {
86                  paramObj3 = new NullWrapper("java.lang.String");
87              }
88  
89              Object paramObj4 = new BooleanWrapper(addCommunityPermissions);
90  
91              Object paramObj5 = new BooleanWrapper(addGuestPermissions);
92  
93              MethodWrapper methodWrapper = new MethodWrapper(BookmarksFolderServiceUtil.class.getName(),
94                      "addFolder",
95                      new Object[] {
96                          paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
97                          paramObj5
98                      });
99  
100             Object returnObj = null;
101 
102             try {
103                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
104             }
105             catch (Exception e) {
106                 if (e instanceof com.liferay.portal.PortalException) {
107                     throw (com.liferay.portal.PortalException)e;
108                 }
109 
110                 if (e instanceof com.liferay.portal.SystemException) {
111                     throw (com.liferay.portal.SystemException)e;
112                 }
113 
114                 throw new com.liferay.portal.SystemException(e);
115             }
116 
117             return (com.liferay.portlet.bookmarks.model.BookmarksFolder)returnObj;
118         }
119         catch (com.liferay.portal.SystemException se) {
120             _log.error(se, se);
121 
122             throw se;
123         }
124     }
125 
126     public static com.liferay.portlet.bookmarks.model.BookmarksFolder addFolder(
127         HttpPrincipal httpPrincipal, long plid, long parentFolderId,
128         java.lang.String name, java.lang.String description,
129         java.lang.String[] communityPermissions,
130         java.lang.String[] guestPermissions)
131         throws com.liferay.portal.PortalException,
132             com.liferay.portal.SystemException {
133         try {
134             Object paramObj0 = new LongWrapper(plid);
135 
136             Object paramObj1 = new LongWrapper(parentFolderId);
137 
138             Object paramObj2 = name;
139 
140             if (name == null) {
141                 paramObj2 = new NullWrapper("java.lang.String");
142             }
143 
144             Object paramObj3 = description;
145 
146             if (description == null) {
147                 paramObj3 = new NullWrapper("java.lang.String");
148             }
149 
150             Object paramObj4 = communityPermissions;
151 
152             if (communityPermissions == null) {
153                 paramObj4 = new NullWrapper("[Ljava.lang.String;");
154             }
155 
156             Object paramObj5 = guestPermissions;
157 
158             if (guestPermissions == null) {
159                 paramObj5 = new NullWrapper("[Ljava.lang.String;");
160             }
161 
162             MethodWrapper methodWrapper = new MethodWrapper(BookmarksFolderServiceUtil.class.getName(),
163                     "addFolder",
164                     new Object[] {
165                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
166                         paramObj5
167                     });
168 
169             Object returnObj = null;
170 
171             try {
172                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
173             }
174             catch (Exception e) {
175                 if (e instanceof com.liferay.portal.PortalException) {
176                     throw (com.liferay.portal.PortalException)e;
177                 }
178 
179                 if (e instanceof com.liferay.portal.SystemException) {
180                     throw (com.liferay.portal.SystemException)e;
181                 }
182 
183                 throw new com.liferay.portal.SystemException(e);
184             }
185 
186             return (com.liferay.portlet.bookmarks.model.BookmarksFolder)returnObj;
187         }
188         catch (com.liferay.portal.SystemException se) {
189             _log.error(se, se);
190 
191             throw se;
192         }
193     }
194 
195     public static void deleteFolder(HttpPrincipal httpPrincipal, long folderId)
196         throws com.liferay.portal.PortalException,
197             com.liferay.portal.SystemException {
198         try {
199             Object paramObj0 = new LongWrapper(folderId);
200 
201             MethodWrapper methodWrapper = new MethodWrapper(BookmarksFolderServiceUtil.class.getName(),
202                     "deleteFolder", new Object[] { paramObj0 });
203 
204             try {
205                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
206             }
207             catch (Exception e) {
208                 if (e instanceof com.liferay.portal.PortalException) {
209                     throw (com.liferay.portal.PortalException)e;
210                 }
211 
212                 if (e instanceof com.liferay.portal.SystemException) {
213                     throw (com.liferay.portal.SystemException)e;
214                 }
215 
216                 throw new com.liferay.portal.SystemException(e);
217             }
218         }
219         catch (com.liferay.portal.SystemException se) {
220             _log.error(se, se);
221 
222             throw se;
223         }
224     }
225 
226     public static com.liferay.portlet.bookmarks.model.BookmarksFolder getFolder(
227         HttpPrincipal httpPrincipal, long folderId)
228         throws com.liferay.portal.PortalException,
229             com.liferay.portal.SystemException {
230         try {
231             Object paramObj0 = new LongWrapper(folderId);
232 
233             MethodWrapper methodWrapper = new MethodWrapper(BookmarksFolderServiceUtil.class.getName(),
234                     "getFolder", new Object[] { paramObj0 });
235 
236             Object returnObj = null;
237 
238             try {
239                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
240             }
241             catch (Exception e) {
242                 if (e instanceof com.liferay.portal.PortalException) {
243                     throw (com.liferay.portal.PortalException)e;
244                 }
245 
246                 if (e instanceof com.liferay.portal.SystemException) {
247                     throw (com.liferay.portal.SystemException)e;
248                 }
249 
250                 throw new com.liferay.portal.SystemException(e);
251             }
252 
253             return (com.liferay.portlet.bookmarks.model.BookmarksFolder)returnObj;
254         }
255         catch (com.liferay.portal.SystemException se) {
256             _log.error(se, se);
257 
258             throw se;
259         }
260     }
261 
262     public static com.liferay.portlet.bookmarks.model.BookmarksFolder updateFolder(
263         HttpPrincipal httpPrincipal, long folderId, long parentFolderId,
264         java.lang.String name, java.lang.String description,
265         boolean mergeWithParentFolder)
266         throws com.liferay.portal.PortalException,
267             com.liferay.portal.SystemException {
268         try {
269             Object paramObj0 = new LongWrapper(folderId);
270 
271             Object paramObj1 = new LongWrapper(parentFolderId);
272 
273             Object paramObj2 = name;
274 
275             if (name == null) {
276                 paramObj2 = new NullWrapper("java.lang.String");
277             }
278 
279             Object paramObj3 = description;
280 
281             if (description == null) {
282                 paramObj3 = new NullWrapper("java.lang.String");
283             }
284 
285             Object paramObj4 = new BooleanWrapper(mergeWithParentFolder);
286 
287             MethodWrapper methodWrapper = new MethodWrapper(BookmarksFolderServiceUtil.class.getName(),
288                     "updateFolder",
289                     new Object[] {
290                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
291                     });
292 
293             Object returnObj = null;
294 
295             try {
296                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
297             }
298             catch (Exception e) {
299                 if (e instanceof com.liferay.portal.PortalException) {
300                     throw (com.liferay.portal.PortalException)e;
301                 }
302 
303                 if (e instanceof com.liferay.portal.SystemException) {
304                     throw (com.liferay.portal.SystemException)e;
305                 }
306 
307                 throw new com.liferay.portal.SystemException(e);
308             }
309 
310             return (com.liferay.portlet.bookmarks.model.BookmarksFolder)returnObj;
311         }
312         catch (com.liferay.portal.SystemException se) {
313             _log.error(se, se);
314 
315             throw se;
316         }
317     }
318 
319     private static Log _log = LogFactoryUtil.getLog(BookmarksFolderServiceHttp.class);
320 }