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.documentlibrary.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.documentlibrary.service.DLFolderServiceUtil;
27  
28  /**
29   * <a href="DLFolderServiceHttp.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.documentlibrary.service.DLFolderServiceUtil} 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       DLFolderServiceSoap
61   * @see       com.liferay.portal.security.auth.HttpPrincipal
62   * @see       com.liferay.portlet.documentlibrary.service.DLFolderServiceUtil
63   * @generated
64   */
65  public class DLFolderServiceHttp {
66      public static com.liferay.portlet.documentlibrary.model.DLFolder 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(DLFolderServiceUtil.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.documentlibrary.model.DLFolder)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.documentlibrary.model.DLFolder 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(DLFolderServiceUtil.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.documentlibrary.model.DLFolder)returnObj;
187         }
188         catch (com.liferay.portal.SystemException se) {
189             _log.error(se, se);
190 
191             throw se;
192         }
193     }
194 
195     public static com.liferay.portlet.documentlibrary.model.DLFolder copyFolder(
196         HttpPrincipal httpPrincipal, long plid, long sourceFolderId,
197         long parentFolderId, java.lang.String name,
198         java.lang.String description, boolean addCommunityPermissions,
199         boolean addGuestPermissions)
200         throws com.liferay.portal.PortalException,
201             com.liferay.portal.SystemException, java.rmi.RemoteException {
202         try {
203             Object paramObj0 = new LongWrapper(plid);
204 
205             Object paramObj1 = new LongWrapper(sourceFolderId);
206 
207             Object paramObj2 = new LongWrapper(parentFolderId);
208 
209             Object paramObj3 = name;
210 
211             if (name == null) {
212                 paramObj3 = new NullWrapper("java.lang.String");
213             }
214 
215             Object paramObj4 = description;
216 
217             if (description == null) {
218                 paramObj4 = new NullWrapper("java.lang.String");
219             }
220 
221             Object paramObj5 = new BooleanWrapper(addCommunityPermissions);
222 
223             Object paramObj6 = new BooleanWrapper(addGuestPermissions);
224 
225             MethodWrapper methodWrapper = new MethodWrapper(DLFolderServiceUtil.class.getName(),
226                     "copyFolder",
227                     new Object[] {
228                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
229                         paramObj5, paramObj6
230                     });
231 
232             Object returnObj = null;
233 
234             try {
235                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
236             }
237             catch (Exception e) {
238                 if (e instanceof com.liferay.portal.PortalException) {
239                     throw (com.liferay.portal.PortalException)e;
240                 }
241 
242                 if (e instanceof com.liferay.portal.SystemException) {
243                     throw (com.liferay.portal.SystemException)e;
244                 }
245 
246                 if (e instanceof java.rmi.RemoteException) {
247                     throw (java.rmi.RemoteException)e;
248                 }
249 
250                 throw new com.liferay.portal.SystemException(e);
251             }
252 
253             return (com.liferay.portlet.documentlibrary.model.DLFolder)returnObj;
254         }
255         catch (com.liferay.portal.SystemException se) {
256             _log.error(se, se);
257 
258             throw se;
259         }
260     }
261 
262     public static void deleteFolder(HttpPrincipal httpPrincipal, long folderId)
263         throws com.liferay.portal.PortalException,
264             com.liferay.portal.SystemException {
265         try {
266             Object paramObj0 = new LongWrapper(folderId);
267 
268             MethodWrapper methodWrapper = new MethodWrapper(DLFolderServiceUtil.class.getName(),
269                     "deleteFolder", new Object[] { paramObj0 });
270 
271             try {
272                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
273             }
274             catch (Exception e) {
275                 if (e instanceof com.liferay.portal.PortalException) {
276                     throw (com.liferay.portal.PortalException)e;
277                 }
278 
279                 if (e instanceof com.liferay.portal.SystemException) {
280                     throw (com.liferay.portal.SystemException)e;
281                 }
282 
283                 throw new com.liferay.portal.SystemException(e);
284             }
285         }
286         catch (com.liferay.portal.SystemException se) {
287             _log.error(se, se);
288 
289             throw se;
290         }
291     }
292 
293     public static void deleteFolder(HttpPrincipal httpPrincipal, long groupId,
294         long parentFolderId, java.lang.String name)
295         throws com.liferay.portal.PortalException,
296             com.liferay.portal.SystemException {
297         try {
298             Object paramObj0 = new LongWrapper(groupId);
299 
300             Object paramObj1 = new LongWrapper(parentFolderId);
301 
302             Object paramObj2 = name;
303 
304             if (name == null) {
305                 paramObj2 = new NullWrapper("java.lang.String");
306             }
307 
308             MethodWrapper methodWrapper = new MethodWrapper(DLFolderServiceUtil.class.getName(),
309                     "deleteFolder",
310                     new Object[] { paramObj0, paramObj1, paramObj2 });
311 
312             try {
313                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
314             }
315             catch (Exception e) {
316                 if (e instanceof com.liferay.portal.PortalException) {
317                     throw (com.liferay.portal.PortalException)e;
318                 }
319 
320                 if (e instanceof com.liferay.portal.SystemException) {
321                     throw (com.liferay.portal.SystemException)e;
322                 }
323 
324                 throw new com.liferay.portal.SystemException(e);
325             }
326         }
327         catch (com.liferay.portal.SystemException se) {
328             _log.error(se, se);
329 
330             throw se;
331         }
332     }
333 
334     public static com.liferay.portlet.documentlibrary.model.DLFolder getFolder(
335         HttpPrincipal httpPrincipal, long folderId)
336         throws com.liferay.portal.PortalException,
337             com.liferay.portal.SystemException {
338         try {
339             Object paramObj0 = new LongWrapper(folderId);
340 
341             MethodWrapper methodWrapper = new MethodWrapper(DLFolderServiceUtil.class.getName(),
342                     "getFolder", new Object[] { paramObj0 });
343 
344             Object returnObj = null;
345 
346             try {
347                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
348             }
349             catch (Exception e) {
350                 if (e instanceof com.liferay.portal.PortalException) {
351                     throw (com.liferay.portal.PortalException)e;
352                 }
353 
354                 if (e instanceof com.liferay.portal.SystemException) {
355                     throw (com.liferay.portal.SystemException)e;
356                 }
357 
358                 throw new com.liferay.portal.SystemException(e);
359             }
360 
361             return (com.liferay.portlet.documentlibrary.model.DLFolder)returnObj;
362         }
363         catch (com.liferay.portal.SystemException se) {
364             _log.error(se, se);
365 
366             throw se;
367         }
368     }
369 
370     public static com.liferay.portlet.documentlibrary.model.DLFolder getFolder(
371         HttpPrincipal httpPrincipal, long groupId, long parentFolderId,
372         java.lang.String name)
373         throws com.liferay.portal.PortalException,
374             com.liferay.portal.SystemException {
375         try {
376             Object paramObj0 = new LongWrapper(groupId);
377 
378             Object paramObj1 = new LongWrapper(parentFolderId);
379 
380             Object paramObj2 = name;
381 
382             if (name == null) {
383                 paramObj2 = new NullWrapper("java.lang.String");
384             }
385 
386             MethodWrapper methodWrapper = new MethodWrapper(DLFolderServiceUtil.class.getName(),
387                     "getFolder",
388                     new Object[] { paramObj0, paramObj1, paramObj2 });
389 
390             Object returnObj = null;
391 
392             try {
393                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
394             }
395             catch (Exception e) {
396                 if (e instanceof com.liferay.portal.PortalException) {
397                     throw (com.liferay.portal.PortalException)e;
398                 }
399 
400                 if (e instanceof com.liferay.portal.SystemException) {
401                     throw (com.liferay.portal.SystemException)e;
402                 }
403 
404                 throw new com.liferay.portal.SystemException(e);
405             }
406 
407             return (com.liferay.portlet.documentlibrary.model.DLFolder)returnObj;
408         }
409         catch (com.liferay.portal.SystemException se) {
410             _log.error(se, se);
411 
412             throw se;
413         }
414     }
415 
416     public static long getFolderId(HttpPrincipal httpPrincipal, long groupId,
417         long parentFolderId, java.lang.String name)
418         throws com.liferay.portal.PortalException,
419             com.liferay.portal.SystemException {
420         try {
421             Object paramObj0 = new LongWrapper(groupId);
422 
423             Object paramObj1 = new LongWrapper(parentFolderId);
424 
425             Object paramObj2 = name;
426 
427             if (name == null) {
428                 paramObj2 = new NullWrapper("java.lang.String");
429             }
430 
431             MethodWrapper methodWrapper = new MethodWrapper(DLFolderServiceUtil.class.getName(),
432                     "getFolderId",
433                     new Object[] { paramObj0, paramObj1, paramObj2 });
434 
435             Object returnObj = null;
436 
437             try {
438                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
439             }
440             catch (Exception e) {
441                 if (e instanceof com.liferay.portal.PortalException) {
442                     throw (com.liferay.portal.PortalException)e;
443                 }
444 
445                 if (e instanceof com.liferay.portal.SystemException) {
446                     throw (com.liferay.portal.SystemException)e;
447                 }
448 
449                 throw new com.liferay.portal.SystemException(e);
450             }
451 
452             return ((Long)returnObj).longValue();
453         }
454         catch (com.liferay.portal.SystemException se) {
455             _log.error(se, se);
456 
457             throw se;
458         }
459     }
460 
461     public static java.util.List<com.liferay.portlet.documentlibrary.model.DLFolder> getFolders(
462         HttpPrincipal httpPrincipal, long groupId, long parentFolderId)
463         throws com.liferay.portal.PortalException,
464             com.liferay.portal.SystemException {
465         try {
466             Object paramObj0 = new LongWrapper(groupId);
467 
468             Object paramObj1 = new LongWrapper(parentFolderId);
469 
470             MethodWrapper methodWrapper = new MethodWrapper(DLFolderServiceUtil.class.getName(),
471                     "getFolders", new Object[] { paramObj0, paramObj1 });
472 
473             Object returnObj = null;
474 
475             try {
476                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
477             }
478             catch (Exception e) {
479                 if (e instanceof com.liferay.portal.PortalException) {
480                     throw (com.liferay.portal.PortalException)e;
481                 }
482 
483                 if (e instanceof com.liferay.portal.SystemException) {
484                     throw (com.liferay.portal.SystemException)e;
485                 }
486 
487                 throw new com.liferay.portal.SystemException(e);
488             }
489 
490             return (java.util.List<com.liferay.portlet.documentlibrary.model.DLFolder>)returnObj;
491         }
492         catch (com.liferay.portal.SystemException se) {
493             _log.error(se, se);
494 
495             throw se;
496         }
497     }
498 
499     public static void reIndexSearch(HttpPrincipal httpPrincipal, long companyId)
500         throws com.liferay.portal.PortalException,
501             com.liferay.portal.SystemException {
502         try {
503             Object paramObj0 = new LongWrapper(companyId);
504 
505             MethodWrapper methodWrapper = new MethodWrapper(DLFolderServiceUtil.class.getName(),
506                     "reIndexSearch", new Object[] { paramObj0 });
507 
508             try {
509                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
510             }
511             catch (Exception e) {
512                 if (e instanceof com.liferay.portal.PortalException) {
513                     throw (com.liferay.portal.PortalException)e;
514                 }
515 
516                 if (e instanceof com.liferay.portal.SystemException) {
517                     throw (com.liferay.portal.SystemException)e;
518                 }
519 
520                 throw new com.liferay.portal.SystemException(e);
521             }
522         }
523         catch (com.liferay.portal.SystemException se) {
524             _log.error(se, se);
525 
526             throw se;
527         }
528     }
529 
530     public static com.liferay.portlet.documentlibrary.model.DLFolder updateFolder(
531         HttpPrincipal httpPrincipal, long folderId, long parentFolderId,
532         java.lang.String name, java.lang.String description)
533         throws com.liferay.portal.PortalException,
534             com.liferay.portal.SystemException {
535         try {
536             Object paramObj0 = new LongWrapper(folderId);
537 
538             Object paramObj1 = new LongWrapper(parentFolderId);
539 
540             Object paramObj2 = name;
541 
542             if (name == null) {
543                 paramObj2 = new NullWrapper("java.lang.String");
544             }
545 
546             Object paramObj3 = description;
547 
548             if (description == null) {
549                 paramObj3 = new NullWrapper("java.lang.String");
550             }
551 
552             MethodWrapper methodWrapper = new MethodWrapper(DLFolderServiceUtil.class.getName(),
553                     "updateFolder",
554                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
555 
556             Object returnObj = null;
557 
558             try {
559                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
560             }
561             catch (Exception e) {
562                 if (e instanceof com.liferay.portal.PortalException) {
563                     throw (com.liferay.portal.PortalException)e;
564                 }
565 
566                 if (e instanceof com.liferay.portal.SystemException) {
567                     throw (com.liferay.portal.SystemException)e;
568                 }
569 
570                 throw new com.liferay.portal.SystemException(e);
571             }
572 
573             return (com.liferay.portlet.documentlibrary.model.DLFolder)returnObj;
574         }
575         catch (com.liferay.portal.SystemException se) {
576             _log.error(se, se);
577 
578             throw se;
579         }
580     }
581 
582     private static Log _log = LogFactoryUtil.getLog(DLFolderServiceHttp.class);
583 }