1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
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 parentFolderId,
68          java.lang.String name, java.lang.String description,
69          com.liferay.portal.service.ServiceContext serviceContext)
70          throws com.liferay.portal.kernel.exception.PortalException,
71              com.liferay.portal.kernel.exception.SystemException {
72          try {
73              Object paramObj0 = new LongWrapper(parentFolderId);
74  
75              Object paramObj1 = name;
76  
77              if (name == null) {
78                  paramObj1 = new NullWrapper("java.lang.String");
79              }
80  
81              Object paramObj2 = description;
82  
83              if (description == null) {
84                  paramObj2 = new NullWrapper("java.lang.String");
85              }
86  
87              Object paramObj3 = serviceContext;
88  
89              if (serviceContext == null) {
90                  paramObj3 = new NullWrapper(
91                          "com.liferay.portal.service.ServiceContext");
92              }
93  
94              MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
95                      "addFolder",
96                      new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
97  
98              Object returnObj = null;
99  
100             try {
101                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
102             }
103             catch (Exception e) {
104                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
105                     throw (com.liferay.portal.kernel.exception.PortalException)e;
106                 }
107 
108                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
109                     throw (com.liferay.portal.kernel.exception.SystemException)e;
110                 }
111 
112                 throw new com.liferay.portal.kernel.exception.SystemException(e);
113             }
114 
115             return (com.liferay.portlet.imagegallery.model.IGFolder)returnObj;
116         }
117         catch (com.liferay.portal.kernel.exception.SystemException se) {
118             _log.error(se, se);
119 
120             throw se;
121         }
122     }
123 
124     public static com.liferay.portlet.imagegallery.model.IGFolder copyFolder(
125         HttpPrincipal httpPrincipal, long sourceFolderId, long parentFolderId,
126         java.lang.String name, java.lang.String description,
127         com.liferay.portal.service.ServiceContext serviceContext)
128         throws com.liferay.portal.kernel.exception.PortalException,
129             com.liferay.portal.kernel.exception.SystemException {
130         try {
131             Object paramObj0 = new LongWrapper(sourceFolderId);
132 
133             Object paramObj1 = new LongWrapper(parentFolderId);
134 
135             Object paramObj2 = name;
136 
137             if (name == null) {
138                 paramObj2 = new NullWrapper("java.lang.String");
139             }
140 
141             Object paramObj3 = description;
142 
143             if (description == null) {
144                 paramObj3 = new NullWrapper("java.lang.String");
145             }
146 
147             Object paramObj4 = serviceContext;
148 
149             if (serviceContext == null) {
150                 paramObj4 = new NullWrapper(
151                         "com.liferay.portal.service.ServiceContext");
152             }
153 
154             MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
155                     "copyFolder",
156                     new Object[] {
157                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
158                     });
159 
160             Object returnObj = null;
161 
162             try {
163                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
164             }
165             catch (Exception e) {
166                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
167                     throw (com.liferay.portal.kernel.exception.PortalException)e;
168                 }
169 
170                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
171                     throw (com.liferay.portal.kernel.exception.SystemException)e;
172                 }
173 
174                 throw new com.liferay.portal.kernel.exception.SystemException(e);
175             }
176 
177             return (com.liferay.portlet.imagegallery.model.IGFolder)returnObj;
178         }
179         catch (com.liferay.portal.kernel.exception.SystemException se) {
180             _log.error(se, se);
181 
182             throw se;
183         }
184     }
185 
186     public static void deleteFolder(HttpPrincipal httpPrincipal, long folderId)
187         throws com.liferay.portal.kernel.exception.PortalException,
188             com.liferay.portal.kernel.exception.SystemException {
189         try {
190             Object paramObj0 = new LongWrapper(folderId);
191 
192             MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
193                     "deleteFolder", new Object[] { paramObj0 });
194 
195             try {
196                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
197             }
198             catch (Exception e) {
199                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
200                     throw (com.liferay.portal.kernel.exception.PortalException)e;
201                 }
202 
203                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
204                     throw (com.liferay.portal.kernel.exception.SystemException)e;
205                 }
206 
207                 throw new com.liferay.portal.kernel.exception.SystemException(e);
208             }
209         }
210         catch (com.liferay.portal.kernel.exception.SystemException se) {
211             _log.error(se, se);
212 
213             throw se;
214         }
215     }
216 
217     public static com.liferay.portlet.imagegallery.model.IGFolder getFolder(
218         HttpPrincipal httpPrincipal, long folderId)
219         throws com.liferay.portal.kernel.exception.PortalException,
220             com.liferay.portal.kernel.exception.SystemException {
221         try {
222             Object paramObj0 = new LongWrapper(folderId);
223 
224             MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
225                     "getFolder", new Object[] { paramObj0 });
226 
227             Object returnObj = null;
228 
229             try {
230                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
231             }
232             catch (Exception e) {
233                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
234                     throw (com.liferay.portal.kernel.exception.PortalException)e;
235                 }
236 
237                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
238                     throw (com.liferay.portal.kernel.exception.SystemException)e;
239                 }
240 
241                 throw new com.liferay.portal.kernel.exception.SystemException(e);
242             }
243 
244             return (com.liferay.portlet.imagegallery.model.IGFolder)returnObj;
245         }
246         catch (com.liferay.portal.kernel.exception.SystemException se) {
247             _log.error(se, se);
248 
249             throw se;
250         }
251     }
252 
253     public static com.liferay.portlet.imagegallery.model.IGFolder getFolder(
254         HttpPrincipal httpPrincipal, long groupId, long parentFolderId,
255         java.lang.String name)
256         throws com.liferay.portal.kernel.exception.PortalException,
257             com.liferay.portal.kernel.exception.SystemException {
258         try {
259             Object paramObj0 = new LongWrapper(groupId);
260 
261             Object paramObj1 = new LongWrapper(parentFolderId);
262 
263             Object paramObj2 = name;
264 
265             if (name == null) {
266                 paramObj2 = new NullWrapper("java.lang.String");
267             }
268 
269             MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
270                     "getFolder",
271                     new Object[] { paramObj0, paramObj1, paramObj2 });
272 
273             Object returnObj = null;
274 
275             try {
276                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
277             }
278             catch (Exception e) {
279                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
280                     throw (com.liferay.portal.kernel.exception.PortalException)e;
281                 }
282 
283                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
284                     throw (com.liferay.portal.kernel.exception.SystemException)e;
285                 }
286 
287                 throw new com.liferay.portal.kernel.exception.SystemException(e);
288             }
289 
290             return (com.liferay.portlet.imagegallery.model.IGFolder)returnObj;
291         }
292         catch (com.liferay.portal.kernel.exception.SystemException se) {
293             _log.error(se, se);
294 
295             throw se;
296         }
297     }
298 
299     public static java.util.List<com.liferay.portlet.imagegallery.model.IGFolder> getFolders(
300         HttpPrincipal httpPrincipal, long groupId, long parentFolderId)
301         throws com.liferay.portal.kernel.exception.PortalException,
302             com.liferay.portal.kernel.exception.SystemException {
303         try {
304             Object paramObj0 = new LongWrapper(groupId);
305 
306             Object paramObj1 = new LongWrapper(parentFolderId);
307 
308             MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
309                     "getFolders", new Object[] { paramObj0, paramObj1 });
310 
311             Object returnObj = null;
312 
313             try {
314                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
315             }
316             catch (Exception e) {
317                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
318                     throw (com.liferay.portal.kernel.exception.PortalException)e;
319                 }
320 
321                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
322                     throw (com.liferay.portal.kernel.exception.SystemException)e;
323                 }
324 
325                 throw new com.liferay.portal.kernel.exception.SystemException(e);
326             }
327 
328             return (java.util.List<com.liferay.portlet.imagegallery.model.IGFolder>)returnObj;
329         }
330         catch (com.liferay.portal.kernel.exception.SystemException se) {
331             _log.error(se, se);
332 
333             throw se;
334         }
335     }
336 
337     public static com.liferay.portlet.imagegallery.model.IGFolder updateFolder(
338         HttpPrincipal httpPrincipal, long folderId, long parentFolderId,
339         java.lang.String name, java.lang.String description,
340         boolean mergeWithParentFolder,
341         com.liferay.portal.service.ServiceContext serviceContext)
342         throws com.liferay.portal.kernel.exception.PortalException,
343             com.liferay.portal.kernel.exception.SystemException {
344         try {
345             Object paramObj0 = new LongWrapper(folderId);
346 
347             Object paramObj1 = new LongWrapper(parentFolderId);
348 
349             Object paramObj2 = name;
350 
351             if (name == null) {
352                 paramObj2 = new NullWrapper("java.lang.String");
353             }
354 
355             Object paramObj3 = description;
356 
357             if (description == null) {
358                 paramObj3 = new NullWrapper("java.lang.String");
359             }
360 
361             Object paramObj4 = new BooleanWrapper(mergeWithParentFolder);
362 
363             Object paramObj5 = serviceContext;
364 
365             if (serviceContext == null) {
366                 paramObj5 = new NullWrapper(
367                         "com.liferay.portal.service.ServiceContext");
368             }
369 
370             MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
371                     "updateFolder",
372                     new Object[] {
373                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
374                         paramObj5
375                     });
376 
377             Object returnObj = null;
378 
379             try {
380                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
381             }
382             catch (Exception e) {
383                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
384                     throw (com.liferay.portal.kernel.exception.PortalException)e;
385                 }
386 
387                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
388                     throw (com.liferay.portal.kernel.exception.SystemException)e;
389                 }
390 
391                 throw new com.liferay.portal.kernel.exception.SystemException(e);
392             }
393 
394             return (com.liferay.portlet.imagegallery.model.IGFolder)returnObj;
395         }
396         catch (com.liferay.portal.kernel.exception.SystemException se) {
397             _log.error(se, se);
398 
399             throw se;
400         }
401     }
402 
403     private static Log _log = LogFactoryUtil.getLog(IGFolderServiceHttp.class);
404 }