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