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