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.imagegallery.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.imagegallery.service.IGFolderServiceUtil;
27  
28  /**
29   * <a href="IGFolderServiceHttp.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.imagegallery.service.IGFolderServiceUtil} 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       IGFolderServiceSoap
61   * @see       com.liferay.portal.security.auth.HttpPrincipal
62   * @see       com.liferay.portlet.imagegallery.service.IGFolderServiceUtil
63   * @generated
64   */
65  public class IGFolderServiceHttp {
66      public static com.liferay.portlet.imagegallery.model.IGFolder 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(IGFolderServiceUtil.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.imagegallery.model.IGFolder)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.imagegallery.model.IGFolder 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(IGFolderServiceUtil.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.imagegallery.model.IGFolder)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.imagegallery.model.IGFolder 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(IGFolderServiceUtil.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.imagegallery.model.IGFolder)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(IGFolderServiceUtil.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 com.liferay.portlet.imagegallery.model.IGFolder getFolder(
294         HttpPrincipal httpPrincipal, long folderId)
295         throws com.liferay.portal.PortalException,
296             com.liferay.portal.SystemException {
297         try {
298             Object paramObj0 = new LongWrapper(folderId);
299 
300             MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
301                     "getFolder", new Object[] { paramObj0 });
302 
303             Object returnObj = null;
304 
305             try {
306                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
307             }
308             catch (Exception e) {
309                 if (e instanceof com.liferay.portal.PortalException) {
310                     throw (com.liferay.portal.PortalException)e;
311                 }
312 
313                 if (e instanceof com.liferay.portal.SystemException) {
314                     throw (com.liferay.portal.SystemException)e;
315                 }
316 
317                 throw new com.liferay.portal.SystemException(e);
318             }
319 
320             return (com.liferay.portlet.imagegallery.model.IGFolder)returnObj;
321         }
322         catch (com.liferay.portal.SystemException se) {
323             _log.error(se, se);
324 
325             throw se;
326         }
327     }
328 
329     public static com.liferay.portlet.imagegallery.model.IGFolder getFolder(
330         HttpPrincipal httpPrincipal, long groupId, long parentFolderId,
331         java.lang.String name)
332         throws com.liferay.portal.PortalException,
333             com.liferay.portal.SystemException {
334         try {
335             Object paramObj0 = new LongWrapper(groupId);
336 
337             Object paramObj1 = new LongWrapper(parentFolderId);
338 
339             Object paramObj2 = name;
340 
341             if (name == null) {
342                 paramObj2 = new NullWrapper("java.lang.String");
343             }
344 
345             MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
346                     "getFolder",
347                     new Object[] { paramObj0, paramObj1, paramObj2 });
348 
349             Object returnObj = null;
350 
351             try {
352                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
353             }
354             catch (Exception e) {
355                 if (e instanceof com.liferay.portal.PortalException) {
356                     throw (com.liferay.portal.PortalException)e;
357                 }
358 
359                 if (e instanceof com.liferay.portal.SystemException) {
360                     throw (com.liferay.portal.SystemException)e;
361                 }
362 
363                 throw new com.liferay.portal.SystemException(e);
364             }
365 
366             return (com.liferay.portlet.imagegallery.model.IGFolder)returnObj;
367         }
368         catch (com.liferay.portal.SystemException se) {
369             _log.error(se, se);
370 
371             throw se;
372         }
373     }
374 
375     public static java.util.List<com.liferay.portlet.imagegallery.model.IGFolder> getFolders(
376         HttpPrincipal httpPrincipal, long groupId, long parentFolderId)
377         throws com.liferay.portal.PortalException,
378             com.liferay.portal.SystemException {
379         try {
380             Object paramObj0 = new LongWrapper(groupId);
381 
382             Object paramObj1 = new LongWrapper(parentFolderId);
383 
384             MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
385                     "getFolders", new Object[] { paramObj0, paramObj1 });
386 
387             Object returnObj = null;
388 
389             try {
390                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
391             }
392             catch (Exception e) {
393                 if (e instanceof com.liferay.portal.PortalException) {
394                     throw (com.liferay.portal.PortalException)e;
395                 }
396 
397                 if (e instanceof com.liferay.portal.SystemException) {
398                     throw (com.liferay.portal.SystemException)e;
399                 }
400 
401                 throw new com.liferay.portal.SystemException(e);
402             }
403 
404             return (java.util.List<com.liferay.portlet.imagegallery.model.IGFolder>)returnObj;
405         }
406         catch (com.liferay.portal.SystemException se) {
407             _log.error(se, se);
408 
409             throw se;
410         }
411     }
412 
413     public static com.liferay.portlet.imagegallery.model.IGFolder updateFolder(
414         HttpPrincipal httpPrincipal, long folderId, long parentFolderId,
415         java.lang.String name, java.lang.String description,
416         boolean mergeWithParentFolder)
417         throws com.liferay.portal.PortalException,
418             com.liferay.portal.SystemException {
419         try {
420             Object paramObj0 = new LongWrapper(folderId);
421 
422             Object paramObj1 = new LongWrapper(parentFolderId);
423 
424             Object paramObj2 = name;
425 
426             if (name == null) {
427                 paramObj2 = new NullWrapper("java.lang.String");
428             }
429 
430             Object paramObj3 = description;
431 
432             if (description == null) {
433                 paramObj3 = new NullWrapper("java.lang.String");
434             }
435 
436             Object paramObj4 = new BooleanWrapper(mergeWithParentFolder);
437 
438             MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
439                     "updateFolder",
440                     new Object[] {
441                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
442                     });
443 
444             Object returnObj = null;
445 
446             try {
447                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
448             }
449             catch (Exception e) {
450                 if (e instanceof com.liferay.portal.PortalException) {
451                     throw (com.liferay.portal.PortalException)e;
452                 }
453 
454                 if (e instanceof com.liferay.portal.SystemException) {
455                     throw (com.liferay.portal.SystemException)e;
456                 }
457 
458                 throw new com.liferay.portal.SystemException(e);
459             }
460 
461             return (com.liferay.portlet.imagegallery.model.IGFolder)returnObj;
462         }
463         catch (com.liferay.portal.SystemException se) {
464             _log.error(se, se);
465 
466             throw se;
467         }
468     }
469 
470     private static Log _log = LogFactoryUtil.getLog(IGFolderServiceHttp.class);
471 }