1   /**
2    * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions 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.documentlibrary.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.documentlibrary.service.DLFolderServiceUtil;
35  
36  /**
37   * <a href="DLFolderServiceHttp.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   * <code>com.liferay.portlet.documentlibrary.service.DLFolderServiceUtil</code> service
47   * utility. The static methods of this class calls the same methods of the
48   * service utility. However, the signatures are different because it requires an
49   * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code>
50   * parameter.
51   * </p>
52   *
53   * <p>
54   * The benefits of using the HTTP utility is that it is fast and allows for
55   * tunneling without the cost of serializing to text. The drawback is that it
56   * only works with Java.
57   * </p>
58   *
59   * <p>
60   * Set the property <code>tunnel.servlet.hosts.allowed</code> in
61   * portal.properties to configure security.
62   * </p>
63   *
64   * <p>
65   * The HTTP utility is only generated for remote services.
66   * </p>
67   *
68   * @author Brian Wing Shun Chan
69   *
70   * @see com.liferay.portal.security.auth.HttpPrincipal
71   * @see com.liferay.portlet.documentlibrary.service.DLFolderServiceUtil
72   * @see com.liferay.portlet.documentlibrary.service.http.DLFolderServiceSoap
73   *
74   */
75  public class DLFolderServiceHttp {
76      public static com.liferay.portlet.documentlibrary.model.DLFolder addFolder(
77          HttpPrincipal httpPrincipal, long plid, long parentFolderId,
78          java.lang.String name, java.lang.String description,
79          boolean addCommunityPermissions, boolean addGuestPermissions)
80          throws com.liferay.portal.SystemException,
81              com.liferay.portal.PortalException {
82          try {
83              Object paramObj0 = new LongWrapper(plid);
84  
85              Object paramObj1 = new LongWrapper(parentFolderId);
86  
87              Object paramObj2 = name;
88  
89              if (name == null) {
90                  paramObj2 = new NullWrapper("java.lang.String");
91              }
92  
93              Object paramObj3 = description;
94  
95              if (description == null) {
96                  paramObj3 = new NullWrapper("java.lang.String");
97              }
98  
99              Object paramObj4 = new BooleanWrapper(addCommunityPermissions);
100 
101             Object paramObj5 = new BooleanWrapper(addGuestPermissions);
102 
103             MethodWrapper methodWrapper = new MethodWrapper(DLFolderServiceUtil.class.getName(),
104                     "addFolder",
105                     new Object[] {
106                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
107                         paramObj5
108                     });
109 
110             Object returnObj = null;
111 
112             try {
113                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
114             }
115             catch (Exception e) {
116                 if (e instanceof com.liferay.portal.SystemException) {
117                     throw (com.liferay.portal.SystemException)e;
118                 }
119 
120                 if (e instanceof com.liferay.portal.PortalException) {
121                     throw (com.liferay.portal.PortalException)e;
122                 }
123 
124                 throw new com.liferay.portal.SystemException(e);
125             }
126 
127             return (com.liferay.portlet.documentlibrary.model.DLFolder)returnObj;
128         }
129         catch (com.liferay.portal.SystemException se) {
130             _log.error(se, se);
131 
132             throw se;
133         }
134     }
135 
136     public static com.liferay.portlet.documentlibrary.model.DLFolder addFolder(
137         HttpPrincipal httpPrincipal, long plid, long parentFolderId,
138         java.lang.String name, java.lang.String description,
139         java.lang.String[] communityPermissions,
140         java.lang.String[] guestPermissions)
141         throws com.liferay.portal.SystemException,
142             com.liferay.portal.PortalException {
143         try {
144             Object paramObj0 = new LongWrapper(plid);
145 
146             Object paramObj1 = new LongWrapper(parentFolderId);
147 
148             Object paramObj2 = name;
149 
150             if (name == null) {
151                 paramObj2 = new NullWrapper("java.lang.String");
152             }
153 
154             Object paramObj3 = description;
155 
156             if (description == null) {
157                 paramObj3 = new NullWrapper("java.lang.String");
158             }
159 
160             Object paramObj4 = communityPermissions;
161 
162             if (communityPermissions == null) {
163                 paramObj4 = new NullWrapper("[Ljava.lang.String;");
164             }
165 
166             Object paramObj5 = guestPermissions;
167 
168             if (guestPermissions == null) {
169                 paramObj5 = new NullWrapper("[Ljava.lang.String;");
170             }
171 
172             MethodWrapper methodWrapper = new MethodWrapper(DLFolderServiceUtil.class.getName(),
173                     "addFolder",
174                     new Object[] {
175                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
176                         paramObj5
177                     });
178 
179             Object returnObj = null;
180 
181             try {
182                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
183             }
184             catch (Exception e) {
185                 if (e instanceof com.liferay.portal.SystemException) {
186                     throw (com.liferay.portal.SystemException)e;
187                 }
188 
189                 if (e instanceof com.liferay.portal.PortalException) {
190                     throw (com.liferay.portal.PortalException)e;
191                 }
192 
193                 throw new com.liferay.portal.SystemException(e);
194             }
195 
196             return (com.liferay.portlet.documentlibrary.model.DLFolder)returnObj;
197         }
198         catch (com.liferay.portal.SystemException se) {
199             _log.error(se, se);
200 
201             throw se;
202         }
203     }
204 
205     public static com.liferay.portlet.documentlibrary.model.DLFolder copyFolder(
206         HttpPrincipal httpPrincipal, long plid, long sourceFolderId,
207         long parentFolderId, java.lang.String name,
208         java.lang.String description, boolean addCommunityPermissions,
209         boolean addGuestPermissions)
210         throws com.liferay.portal.SystemException,
211             com.liferay.portal.PortalException, java.rmi.RemoteException {
212         try {
213             Object paramObj0 = new LongWrapper(plid);
214 
215             Object paramObj1 = new LongWrapper(sourceFolderId);
216 
217             Object paramObj2 = new LongWrapper(parentFolderId);
218 
219             Object paramObj3 = name;
220 
221             if (name == null) {
222                 paramObj3 = new NullWrapper("java.lang.String");
223             }
224 
225             Object paramObj4 = description;
226 
227             if (description == null) {
228                 paramObj4 = new NullWrapper("java.lang.String");
229             }
230 
231             Object paramObj5 = new BooleanWrapper(addCommunityPermissions);
232 
233             Object paramObj6 = new BooleanWrapper(addGuestPermissions);
234 
235             MethodWrapper methodWrapper = new MethodWrapper(DLFolderServiceUtil.class.getName(),
236                     "copyFolder",
237                     new Object[] {
238                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
239                         paramObj5, paramObj6
240                     });
241 
242             Object returnObj = null;
243 
244             try {
245                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
246             }
247             catch (Exception e) {
248                 if (e instanceof com.liferay.portal.SystemException) {
249                     throw (com.liferay.portal.SystemException)e;
250                 }
251 
252                 if (e instanceof com.liferay.portal.PortalException) {
253                     throw (com.liferay.portal.PortalException)e;
254                 }
255 
256                 if (e instanceof java.rmi.RemoteException) {
257                     throw (java.rmi.RemoteException)e;
258                 }
259 
260                 throw new com.liferay.portal.SystemException(e);
261             }
262 
263             return (com.liferay.portlet.documentlibrary.model.DLFolder)returnObj;
264         }
265         catch (com.liferay.portal.SystemException se) {
266             _log.error(se, se);
267 
268             throw se;
269         }
270     }
271 
272     public static void deleteFolder(HttpPrincipal httpPrincipal, long folderId)
273         throws com.liferay.portal.SystemException,
274             com.liferay.portal.PortalException {
275         try {
276             Object paramObj0 = new LongWrapper(folderId);
277 
278             MethodWrapper methodWrapper = new MethodWrapper(DLFolderServiceUtil.class.getName(),
279                     "deleteFolder", new Object[] { paramObj0 });
280 
281             try {
282                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
283             }
284             catch (Exception e) {
285                 if (e instanceof com.liferay.portal.SystemException) {
286                     throw (com.liferay.portal.SystemException)e;
287                 }
288 
289                 if (e instanceof com.liferay.portal.PortalException) {
290                     throw (com.liferay.portal.PortalException)e;
291                 }
292 
293                 throw new com.liferay.portal.SystemException(e);
294             }
295         }
296         catch (com.liferay.portal.SystemException se) {
297             _log.error(se, se);
298 
299             throw se;
300         }
301     }
302 
303     public static void deleteFolder(HttpPrincipal httpPrincipal, long groupId,
304         long parentFolderId, java.lang.String name)
305         throws com.liferay.portal.SystemException,
306             com.liferay.portal.PortalException {
307         try {
308             Object paramObj0 = new LongWrapper(groupId);
309 
310             Object paramObj1 = new LongWrapper(parentFolderId);
311 
312             Object paramObj2 = name;
313 
314             if (name == null) {
315                 paramObj2 = new NullWrapper("java.lang.String");
316             }
317 
318             MethodWrapper methodWrapper = new MethodWrapper(DLFolderServiceUtil.class.getName(),
319                     "deleteFolder",
320                     new Object[] { paramObj0, paramObj1, paramObj2 });
321 
322             try {
323                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
324             }
325             catch (Exception e) {
326                 if (e instanceof com.liferay.portal.SystemException) {
327                     throw (com.liferay.portal.SystemException)e;
328                 }
329 
330                 if (e instanceof com.liferay.portal.PortalException) {
331                     throw (com.liferay.portal.PortalException)e;
332                 }
333 
334                 throw new com.liferay.portal.SystemException(e);
335             }
336         }
337         catch (com.liferay.portal.SystemException se) {
338             _log.error(se, se);
339 
340             throw se;
341         }
342     }
343 
344     public static com.liferay.portlet.documentlibrary.model.DLFolder getFolder(
345         HttpPrincipal httpPrincipal, long folderId)
346         throws com.liferay.portal.SystemException,
347             com.liferay.portal.PortalException {
348         try {
349             Object paramObj0 = new LongWrapper(folderId);
350 
351             MethodWrapper methodWrapper = new MethodWrapper(DLFolderServiceUtil.class.getName(),
352                     "getFolder", new Object[] { paramObj0 });
353 
354             Object returnObj = null;
355 
356             try {
357                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
358             }
359             catch (Exception e) {
360                 if (e instanceof com.liferay.portal.SystemException) {
361                     throw (com.liferay.portal.SystemException)e;
362                 }
363 
364                 if (e instanceof com.liferay.portal.PortalException) {
365                     throw (com.liferay.portal.PortalException)e;
366                 }
367 
368                 throw new com.liferay.portal.SystemException(e);
369             }
370 
371             return (com.liferay.portlet.documentlibrary.model.DLFolder)returnObj;
372         }
373         catch (com.liferay.portal.SystemException se) {
374             _log.error(se, se);
375 
376             throw se;
377         }
378     }
379 
380     public static com.liferay.portlet.documentlibrary.model.DLFolder getFolder(
381         HttpPrincipal httpPrincipal, long groupId, long parentFolderId,
382         java.lang.String name)
383         throws com.liferay.portal.SystemException,
384             com.liferay.portal.PortalException {
385         try {
386             Object paramObj0 = new LongWrapper(groupId);
387 
388             Object paramObj1 = new LongWrapper(parentFolderId);
389 
390             Object paramObj2 = name;
391 
392             if (name == null) {
393                 paramObj2 = new NullWrapper("java.lang.String");
394             }
395 
396             MethodWrapper methodWrapper = new MethodWrapper(DLFolderServiceUtil.class.getName(),
397                     "getFolder",
398                     new Object[] { paramObj0, paramObj1, paramObj2 });
399 
400             Object returnObj = null;
401 
402             try {
403                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
404             }
405             catch (Exception e) {
406                 if (e instanceof com.liferay.portal.SystemException) {
407                     throw (com.liferay.portal.SystemException)e;
408                 }
409 
410                 if (e instanceof com.liferay.portal.PortalException) {
411                     throw (com.liferay.portal.PortalException)e;
412                 }
413 
414                 throw new com.liferay.portal.SystemException(e);
415             }
416 
417             return (com.liferay.portlet.documentlibrary.model.DLFolder)returnObj;
418         }
419         catch (com.liferay.portal.SystemException se) {
420             _log.error(se, se);
421 
422             throw se;
423         }
424     }
425 
426     public static long getFolderId(HttpPrincipal httpPrincipal, long groupId,
427         long parentFolderId, java.lang.String name)
428         throws com.liferay.portal.SystemException,
429             com.liferay.portal.PortalException {
430         try {
431             Object paramObj0 = new LongWrapper(groupId);
432 
433             Object paramObj1 = new LongWrapper(parentFolderId);
434 
435             Object paramObj2 = name;
436 
437             if (name == null) {
438                 paramObj2 = new NullWrapper("java.lang.String");
439             }
440 
441             MethodWrapper methodWrapper = new MethodWrapper(DLFolderServiceUtil.class.getName(),
442                     "getFolderId",
443                     new Object[] { paramObj0, paramObj1, paramObj2 });
444 
445             Object returnObj = null;
446 
447             try {
448                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
449             }
450             catch (Exception e) {
451                 if (e instanceof com.liferay.portal.SystemException) {
452                     throw (com.liferay.portal.SystemException)e;
453                 }
454 
455                 if (e instanceof com.liferay.portal.PortalException) {
456                     throw (com.liferay.portal.PortalException)e;
457                 }
458 
459                 throw new com.liferay.portal.SystemException(e);
460             }
461 
462             return ((Long)returnObj).longValue();
463         }
464         catch (com.liferay.portal.SystemException se) {
465             _log.error(se, se);
466 
467             throw se;
468         }
469     }
470 
471     public static java.util.List<com.liferay.portlet.documentlibrary.model.DLFolder> getFolders(
472         HttpPrincipal httpPrincipal, long groupId, long parentFolderId)
473         throws com.liferay.portal.SystemException,
474             com.liferay.portal.PortalException {
475         try {
476             Object paramObj0 = new LongWrapper(groupId);
477 
478             Object paramObj1 = new LongWrapper(parentFolderId);
479 
480             MethodWrapper methodWrapper = new MethodWrapper(DLFolderServiceUtil.class.getName(),
481                     "getFolders", new Object[] { paramObj0, paramObj1 });
482 
483             Object returnObj = null;
484 
485             try {
486                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
487             }
488             catch (Exception e) {
489                 if (e instanceof com.liferay.portal.SystemException) {
490                     throw (com.liferay.portal.SystemException)e;
491                 }
492 
493                 if (e instanceof com.liferay.portal.PortalException) {
494                     throw (com.liferay.portal.PortalException)e;
495                 }
496 
497                 throw new com.liferay.portal.SystemException(e);
498             }
499 
500             return (java.util.List<com.liferay.portlet.documentlibrary.model.DLFolder>)returnObj;
501         }
502         catch (com.liferay.portal.SystemException se) {
503             _log.error(se, se);
504 
505             throw se;
506         }
507     }
508 
509     public static void reIndexSearch(HttpPrincipal httpPrincipal, long companyId)
510         throws com.liferay.portal.SystemException,
511             com.liferay.portal.PortalException {
512         try {
513             Object paramObj0 = new LongWrapper(companyId);
514 
515             MethodWrapper methodWrapper = new MethodWrapper(DLFolderServiceUtil.class.getName(),
516                     "reIndexSearch", new Object[] { paramObj0 });
517 
518             try {
519                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
520             }
521             catch (Exception e) {
522                 if (e instanceof com.liferay.portal.SystemException) {
523                     throw (com.liferay.portal.SystemException)e;
524                 }
525 
526                 if (e instanceof com.liferay.portal.PortalException) {
527                     throw (com.liferay.portal.PortalException)e;
528                 }
529 
530                 throw new com.liferay.portal.SystemException(e);
531             }
532         }
533         catch (com.liferay.portal.SystemException se) {
534             _log.error(se, se);
535 
536             throw se;
537         }
538     }
539 
540     public static com.liferay.portlet.documentlibrary.model.DLFolder updateFolder(
541         HttpPrincipal httpPrincipal, long folderId, long parentFolderId,
542         java.lang.String name, java.lang.String description)
543         throws com.liferay.portal.SystemException,
544             com.liferay.portal.PortalException {
545         try {
546             Object paramObj0 = new LongWrapper(folderId);
547 
548             Object paramObj1 = new LongWrapper(parentFolderId);
549 
550             Object paramObj2 = name;
551 
552             if (name == null) {
553                 paramObj2 = new NullWrapper("java.lang.String");
554             }
555 
556             Object paramObj3 = description;
557 
558             if (description == null) {
559                 paramObj3 = new NullWrapper("java.lang.String");
560             }
561 
562             MethodWrapper methodWrapper = new MethodWrapper(DLFolderServiceUtil.class.getName(),
563                     "updateFolder",
564                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
565 
566             Object returnObj = null;
567 
568             try {
569                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
570             }
571             catch (Exception e) {
572                 if (e instanceof com.liferay.portal.SystemException) {
573                     throw (com.liferay.portal.SystemException)e;
574                 }
575 
576                 if (e instanceof com.liferay.portal.PortalException) {
577                     throw (com.liferay.portal.PortalException)e;
578                 }
579 
580                 throw new com.liferay.portal.SystemException(e);
581             }
582 
583             return (com.liferay.portlet.documentlibrary.model.DLFolder)returnObj;
584         }
585         catch (com.liferay.portal.SystemException se) {
586             _log.error(se, se);
587 
588             throw se;
589         }
590     }
591 
592     private static Log _log = LogFactoryUtil.getLog(DLFolderServiceHttp.class);
593 }