1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions 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.imagegallery.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.imagegallery.service.IGFolderServiceUtil;
35  
36  /**
37   * <a href="IGFolderServiceHttp.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   * <code>com.liferay.portlet.imagegallery.service.IGFolderServiceUtil</code> service
47   * utility. The static methods of this class calls the same methods of the
48   * service utility. However, the signatures are different because it requires an
49   * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code>
50   * parameter.
51   * </p>
52   *
53   * <p>
54   * The benefits of using the HTTP utility is that it is fast and allows for
55   * tunneling without the cost of serializing to text. The drawback is that it
56   * only works with Java.
57   * </p>
58   *
59   * <p>
60   * Set the property <code>tunnel.servlet.hosts.allowed</code> in
61   * portal.properties to configure security.
62   * </p>
63   *
64   * <p>
65   * The HTTP utility is only generated for remote services.
66   * </p>
67   *
68   * @author Brian Wing Shun Chan
69   *
70   * @see com.liferay.portal.security.auth.HttpPrincipal
71   * @see com.liferay.portlet.imagegallery.service.IGFolderServiceUtil
72   * @see com.liferay.portlet.imagegallery.service.http.IGFolderServiceSoap
73   *
74   */
75  public class IGFolderServiceHttp {
76      public static com.liferay.portlet.imagegallery.model.IGFolder addFolder(
77          HttpPrincipal httpPrincipal, long parentFolderId,
78          java.lang.String name, java.lang.String description,
79          com.liferay.portal.service.ServiceContext serviceContext)
80          throws com.liferay.portal.PortalException,
81              com.liferay.portal.SystemException {
82          try {
83              Object paramObj0 = new LongWrapper(parentFolderId);
84  
85              Object paramObj1 = name;
86  
87              if (name == null) {
88                  paramObj1 = new NullWrapper("java.lang.String");
89              }
90  
91              Object paramObj2 = description;
92  
93              if (description == null) {
94                  paramObj2 = new NullWrapper("java.lang.String");
95              }
96  
97              Object paramObj3 = serviceContext;
98  
99              if (serviceContext == null) {
100                 paramObj3 = new NullWrapper(
101                         "com.liferay.portal.service.ServiceContext");
102             }
103 
104             MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
105                     "addFolder",
106                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
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.imagegallery.model.IGFolder)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.imagegallery.model.IGFolder copyFolder(
135         HttpPrincipal httpPrincipal, long sourceFolderId, long parentFolderId,
136         java.lang.String name, java.lang.String description,
137         com.liferay.portal.service.ServiceContext serviceContext)
138         throws com.liferay.portal.PortalException,
139             com.liferay.portal.SystemException {
140         try {
141             Object paramObj0 = new LongWrapper(sourceFolderId);
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 = serviceContext;
158 
159             if (serviceContext == null) {
160                 paramObj4 = new NullWrapper(
161                         "com.liferay.portal.service.ServiceContext");
162             }
163 
164             MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
165                     "copyFolder",
166                     new Object[] {
167                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
168                     });
169 
170             Object returnObj = null;
171 
172             try {
173                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
174             }
175             catch (Exception e) {
176                 if (e instanceof com.liferay.portal.PortalException) {
177                     throw (com.liferay.portal.PortalException)e;
178                 }
179 
180                 if (e instanceof com.liferay.portal.SystemException) {
181                     throw (com.liferay.portal.SystemException)e;
182                 }
183 
184                 throw new com.liferay.portal.SystemException(e);
185             }
186 
187             return (com.liferay.portlet.imagegallery.model.IGFolder)returnObj;
188         }
189         catch (com.liferay.portal.SystemException se) {
190             _log.error(se, se);
191 
192             throw se;
193         }
194     }
195 
196     public static void deleteFolder(HttpPrincipal httpPrincipal, long folderId)
197         throws com.liferay.portal.PortalException,
198             com.liferay.portal.SystemException {
199         try {
200             Object paramObj0 = new LongWrapper(folderId);
201 
202             MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
203                     "deleteFolder", new Object[] { paramObj0 });
204 
205             try {
206                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
207             }
208             catch (Exception e) {
209                 if (e instanceof com.liferay.portal.PortalException) {
210                     throw (com.liferay.portal.PortalException)e;
211                 }
212 
213                 if (e instanceof com.liferay.portal.SystemException) {
214                     throw (com.liferay.portal.SystemException)e;
215                 }
216 
217                 throw new com.liferay.portal.SystemException(e);
218             }
219         }
220         catch (com.liferay.portal.SystemException se) {
221             _log.error(se, se);
222 
223             throw se;
224         }
225     }
226 
227     public static com.liferay.portlet.imagegallery.model.IGFolder getFolder(
228         HttpPrincipal httpPrincipal, long folderId)
229         throws com.liferay.portal.PortalException,
230             com.liferay.portal.SystemException {
231         try {
232             Object paramObj0 = new LongWrapper(folderId);
233 
234             MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
235                     "getFolder", new Object[] { paramObj0 });
236 
237             Object returnObj = null;
238 
239             try {
240                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
241             }
242             catch (Exception e) {
243                 if (e instanceof com.liferay.portal.PortalException) {
244                     throw (com.liferay.portal.PortalException)e;
245                 }
246 
247                 if (e instanceof com.liferay.portal.SystemException) {
248                     throw (com.liferay.portal.SystemException)e;
249                 }
250 
251                 throw new com.liferay.portal.SystemException(e);
252             }
253 
254             return (com.liferay.portlet.imagegallery.model.IGFolder)returnObj;
255         }
256         catch (com.liferay.portal.SystemException se) {
257             _log.error(se, se);
258 
259             throw se;
260         }
261     }
262 
263     public static com.liferay.portlet.imagegallery.model.IGFolder getFolder(
264         HttpPrincipal httpPrincipal, long groupId, long parentFolderId,
265         java.lang.String name)
266         throws com.liferay.portal.PortalException,
267             com.liferay.portal.SystemException {
268         try {
269             Object paramObj0 = new LongWrapper(groupId);
270 
271             Object paramObj1 = new LongWrapper(parentFolderId);
272 
273             Object paramObj2 = name;
274 
275             if (name == null) {
276                 paramObj2 = new NullWrapper("java.lang.String");
277             }
278 
279             MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
280                     "getFolder",
281                     new Object[] { paramObj0, paramObj1, paramObj2 });
282 
283             Object returnObj = null;
284 
285             try {
286                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
287             }
288             catch (Exception e) {
289                 if (e instanceof com.liferay.portal.PortalException) {
290                     throw (com.liferay.portal.PortalException)e;
291                 }
292 
293                 if (e instanceof com.liferay.portal.SystemException) {
294                     throw (com.liferay.portal.SystemException)e;
295                 }
296 
297                 throw new com.liferay.portal.SystemException(e);
298             }
299 
300             return (com.liferay.portlet.imagegallery.model.IGFolder)returnObj;
301         }
302         catch (com.liferay.portal.SystemException se) {
303             _log.error(se, se);
304 
305             throw se;
306         }
307     }
308 
309     public static java.util.List<com.liferay.portlet.imagegallery.model.IGFolder> getFolders(
310         HttpPrincipal httpPrincipal, long groupId, long parentFolderId)
311         throws com.liferay.portal.PortalException,
312             com.liferay.portal.SystemException {
313         try {
314             Object paramObj0 = new LongWrapper(groupId);
315 
316             Object paramObj1 = new LongWrapper(parentFolderId);
317 
318             MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
319                     "getFolders", new Object[] { paramObj0, paramObj1 });
320 
321             Object returnObj = null;
322 
323             try {
324                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
325             }
326             catch (Exception e) {
327                 if (e instanceof com.liferay.portal.PortalException) {
328                     throw (com.liferay.portal.PortalException)e;
329                 }
330 
331                 if (e instanceof com.liferay.portal.SystemException) {
332                     throw (com.liferay.portal.SystemException)e;
333                 }
334 
335                 throw new com.liferay.portal.SystemException(e);
336             }
337 
338             return (java.util.List<com.liferay.portlet.imagegallery.model.IGFolder>)returnObj;
339         }
340         catch (com.liferay.portal.SystemException se) {
341             _log.error(se, se);
342 
343             throw se;
344         }
345     }
346 
347     public static com.liferay.portlet.imagegallery.model.IGFolder updateFolder(
348         HttpPrincipal httpPrincipal, long folderId, long parentFolderId,
349         java.lang.String name, java.lang.String description,
350         boolean mergeWithParentFolder)
351         throws com.liferay.portal.PortalException,
352             com.liferay.portal.SystemException {
353         try {
354             Object paramObj0 = new LongWrapper(folderId);
355 
356             Object paramObj1 = new LongWrapper(parentFolderId);
357 
358             Object paramObj2 = name;
359 
360             if (name == null) {
361                 paramObj2 = new NullWrapper("java.lang.String");
362             }
363 
364             Object paramObj3 = description;
365 
366             if (description == null) {
367                 paramObj3 = new NullWrapper("java.lang.String");
368             }
369 
370             Object paramObj4 = new BooleanWrapper(mergeWithParentFolder);
371 
372             MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
373                     "updateFolder",
374                     new Object[] {
375                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
376                     });
377 
378             Object returnObj = null;
379 
380             try {
381                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
382             }
383             catch (Exception e) {
384                 if (e instanceof com.liferay.portal.PortalException) {
385                     throw (com.liferay.portal.PortalException)e;
386                 }
387 
388                 if (e instanceof com.liferay.portal.SystemException) {
389                     throw (com.liferay.portal.SystemException)e;
390                 }
391 
392                 throw new com.liferay.portal.SystemException(e);
393             }
394 
395             return (com.liferay.portlet.imagegallery.model.IGFolder)returnObj;
396         }
397         catch (com.liferay.portal.SystemException se) {
398             _log.error(se, se);
399 
400             throw se;
401         }
402     }
403 
404     private static Log _log = LogFactoryUtil.getLog(IGFolderServiceHttp.class);
405 }