1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portlet.bookmarks.service.http;
24  
25  import com.liferay.portal.kernel.log.Log;
26  import com.liferay.portal.kernel.log.LogFactoryUtil;
27  import com.liferay.portal.kernel.util.BooleanWrapper;
28  import com.liferay.portal.kernel.util.LongWrapper;
29  import com.liferay.portal.kernel.util.MethodWrapper;
30  import com.liferay.portal.kernel.util.NullWrapper;
31  import com.liferay.portal.security.auth.HttpPrincipal;
32  import com.liferay.portal.service.http.TunnelUtil;
33  
34  import com.liferay.portlet.bookmarks.service.BookmarksFolderServiceUtil;
35  
36  /**
37   * <a href="BookmarksFolderServiceHttp.java.html"><b><i>View Source</i></b></a>
38   *
39   * <p>
40   * ServiceBuilder generated this class. Modifications in this class will be
41   * overwritten the next time is generated.
42   * </p>
43   *
44   * <p>
45   * This class provides a HTTP utility for the
46   * {@link com.liferay.portlet.bookmarks.service.BookmarksFolderServiceUtil} service utility. The
47   * static methods of this class calls the same methods of the service utility.
48   * However, the signatures are different because it requires an additional
49   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
50   * </p>
51   *
52   * <p>
53   * The benefits of using the HTTP utility is that it is fast and allows for
54   * tunneling without the cost of serializing to text. The drawback is that it
55   * only works with Java.
56   * </p>
57   *
58   * <p>
59   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
60   * configure security.
61   * </p>
62   *
63   * <p>
64   * The HTTP utility is only generated for remote services.
65   * </p>
66   *
67   * @author    Brian Wing Shun Chan
68   * @see       BookmarksFolderServiceSoap
69   * @see       com.liferay.portal.security.auth.HttpPrincipal
70   * @see       com.liferay.portlet.bookmarks.service.BookmarksFolderServiceUtil
71   * @generated
72   */
73  public class BookmarksFolderServiceHttp {
74      public static com.liferay.portlet.bookmarks.model.BookmarksFolder addFolder(
75          HttpPrincipal httpPrincipal, long plid, long parentFolderId,
76          java.lang.String name, java.lang.String description,
77          boolean addCommunityPermissions, boolean addGuestPermissions)
78          throws com.liferay.portal.PortalException,
79              com.liferay.portal.SystemException {
80          try {
81              Object paramObj0 = new LongWrapper(plid);
82  
83              Object paramObj1 = new LongWrapper(parentFolderId);
84  
85              Object paramObj2 = name;
86  
87              if (name == null) {
88                  paramObj2 = new NullWrapper("java.lang.String");
89              }
90  
91              Object paramObj3 = description;
92  
93              if (description == null) {
94                  paramObj3 = new NullWrapper("java.lang.String");
95              }
96  
97              Object paramObj4 = new BooleanWrapper(addCommunityPermissions);
98  
99              Object paramObj5 = new BooleanWrapper(addGuestPermissions);
100 
101             MethodWrapper methodWrapper = new MethodWrapper(BookmarksFolderServiceUtil.class.getName(),
102                     "addFolder",
103                     new Object[] {
104                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
105                         paramObj5
106                     });
107 
108             Object returnObj = null;
109 
110             try {
111                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
112             }
113             catch (Exception e) {
114                 if (e instanceof com.liferay.portal.PortalException) {
115                     throw (com.liferay.portal.PortalException)e;
116                 }
117 
118                 if (e instanceof com.liferay.portal.SystemException) {
119                     throw (com.liferay.portal.SystemException)e;
120                 }
121 
122                 throw new com.liferay.portal.SystemException(e);
123             }
124 
125             return (com.liferay.portlet.bookmarks.model.BookmarksFolder)returnObj;
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 addFolder(
135         HttpPrincipal httpPrincipal, long plid, long parentFolderId,
136         java.lang.String name, java.lang.String description,
137         java.lang.String[] communityPermissions,
138         java.lang.String[] guestPermissions)
139         throws com.liferay.portal.PortalException,
140             com.liferay.portal.SystemException {
141         try {
142             Object paramObj0 = new LongWrapper(plid);
143 
144             Object paramObj1 = new LongWrapper(parentFolderId);
145 
146             Object paramObj2 = name;
147 
148             if (name == null) {
149                 paramObj2 = new NullWrapper("java.lang.String");
150             }
151 
152             Object paramObj3 = description;
153 
154             if (description == null) {
155                 paramObj3 = new NullWrapper("java.lang.String");
156             }
157 
158             Object paramObj4 = communityPermissions;
159 
160             if (communityPermissions == null) {
161                 paramObj4 = new NullWrapper("[Ljava.lang.String;");
162             }
163 
164             Object paramObj5 = guestPermissions;
165 
166             if (guestPermissions == null) {
167                 paramObj5 = new NullWrapper("[Ljava.lang.String;");
168             }
169 
170             MethodWrapper methodWrapper = new MethodWrapper(BookmarksFolderServiceUtil.class.getName(),
171                     "addFolder",
172                     new Object[] {
173                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
174                         paramObj5
175                     });
176 
177             Object returnObj = null;
178 
179             try {
180                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
181             }
182             catch (Exception e) {
183                 if (e instanceof com.liferay.portal.PortalException) {
184                     throw (com.liferay.portal.PortalException)e;
185                 }
186 
187                 if (e instanceof com.liferay.portal.SystemException) {
188                     throw (com.liferay.portal.SystemException)e;
189                 }
190 
191                 throw new com.liferay.portal.SystemException(e);
192             }
193 
194             return (com.liferay.portlet.bookmarks.model.BookmarksFolder)returnObj;
195         }
196         catch (com.liferay.portal.SystemException se) {
197             _log.error(se, se);
198 
199             throw se;
200         }
201     }
202 
203     public static void deleteFolder(HttpPrincipal httpPrincipal, long folderId)
204         throws com.liferay.portal.PortalException,
205             com.liferay.portal.SystemException {
206         try {
207             Object paramObj0 = new LongWrapper(folderId);
208 
209             MethodWrapper methodWrapper = new MethodWrapper(BookmarksFolderServiceUtil.class.getName(),
210                     "deleteFolder", new Object[] { paramObj0 });
211 
212             try {
213                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
214             }
215             catch (Exception e) {
216                 if (e instanceof com.liferay.portal.PortalException) {
217                     throw (com.liferay.portal.PortalException)e;
218                 }
219 
220                 if (e instanceof com.liferay.portal.SystemException) {
221                     throw (com.liferay.portal.SystemException)e;
222                 }
223 
224                 throw new com.liferay.portal.SystemException(e);
225             }
226         }
227         catch (com.liferay.portal.SystemException se) {
228             _log.error(se, se);
229 
230             throw se;
231         }
232     }
233 
234     public static com.liferay.portlet.bookmarks.model.BookmarksFolder getFolder(
235         HttpPrincipal httpPrincipal, long folderId)
236         throws com.liferay.portal.PortalException,
237             com.liferay.portal.SystemException {
238         try {
239             Object paramObj0 = new LongWrapper(folderId);
240 
241             MethodWrapper methodWrapper = new MethodWrapper(BookmarksFolderServiceUtil.class.getName(),
242                     "getFolder", new Object[] { paramObj0 });
243 
244             Object returnObj = null;
245 
246             try {
247                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
248             }
249             catch (Exception e) {
250                 if (e instanceof com.liferay.portal.PortalException) {
251                     throw (com.liferay.portal.PortalException)e;
252                 }
253 
254                 if (e instanceof com.liferay.portal.SystemException) {
255                     throw (com.liferay.portal.SystemException)e;
256                 }
257 
258                 throw new com.liferay.portal.SystemException(e);
259             }
260 
261             return (com.liferay.portlet.bookmarks.model.BookmarksFolder)returnObj;
262         }
263         catch (com.liferay.portal.SystemException se) {
264             _log.error(se, se);
265 
266             throw se;
267         }
268     }
269 
270     public static com.liferay.portlet.bookmarks.model.BookmarksFolder updateFolder(
271         HttpPrincipal httpPrincipal, long folderId, long parentFolderId,
272         java.lang.String name, java.lang.String description,
273         boolean mergeWithParentFolder)
274         throws com.liferay.portal.PortalException,
275             com.liferay.portal.SystemException {
276         try {
277             Object paramObj0 = new LongWrapper(folderId);
278 
279             Object paramObj1 = new LongWrapper(parentFolderId);
280 
281             Object paramObj2 = name;
282 
283             if (name == null) {
284                 paramObj2 = new NullWrapper("java.lang.String");
285             }
286 
287             Object paramObj3 = description;
288 
289             if (description == null) {
290                 paramObj3 = new NullWrapper("java.lang.String");
291             }
292 
293             Object paramObj4 = new BooleanWrapper(mergeWithParentFolder);
294 
295             MethodWrapper methodWrapper = new MethodWrapper(BookmarksFolderServiceUtil.class.getName(),
296                     "updateFolder",
297                     new Object[] {
298                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
299                     });
300 
301             Object returnObj = null;
302 
303             try {
304                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
305             }
306             catch (Exception e) {
307                 if (e instanceof com.liferay.portal.PortalException) {
308                     throw (com.liferay.portal.PortalException)e;
309                 }
310 
311                 if (e instanceof com.liferay.portal.SystemException) {
312                     throw (com.liferay.portal.SystemException)e;
313                 }
314 
315                 throw new com.liferay.portal.SystemException(e);
316             }
317 
318             return (com.liferay.portlet.bookmarks.model.BookmarksFolder)returnObj;
319         }
320         catch (com.liferay.portal.SystemException se) {
321             _log.error(se, se);
322 
323             throw se;
324         }
325     }
326 
327     private static Log _log = LogFactoryUtil.getLog(BookmarksFolderServiceHttp.class);
328 }