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