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.LongWrapper;
20  import com.liferay.portal.kernel.util.MethodWrapper;
21  import com.liferay.portal.kernel.util.NullWrapper;
22  import com.liferay.portal.security.auth.HttpPrincipal;
23  import com.liferay.portal.service.http.TunnelUtil;
24  
25  import com.liferay.portlet.imagegallery.service.IGImageServiceUtil;
26  
27  /**
28   * <a href="IGImageServiceHttp.java.html"><b><i>View Source</i></b></a>
29   *
30   * <p>
31   * ServiceBuilder generated this class. Modifications in this class will be
32   * overwritten the next time is generated.
33   * </p>
34   *
35   * <p>
36   * This class provides a HTTP utility for the
37   * {@link com.liferay.portlet.imagegallery.service.IGImageServiceUtil} service utility. The
38   * static methods of this class calls the same methods of the service utility.
39   * However, the signatures are different because it requires an additional
40   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
41   * </p>
42   *
43   * <p>
44   * The benefits of using the HTTP utility is that it is fast and allows for
45   * tunneling without the cost of serializing to text. The drawback is that it
46   * only works with Java.
47   * </p>
48   *
49   * <p>
50   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
51   * configure security.
52   * </p>
53   *
54   * <p>
55   * The HTTP utility is only generated for remote services.
56   * </p>
57   *
58   * @author    Brian Wing Shun Chan
59   * @see       IGImageServiceSoap
60   * @see       com.liferay.portal.security.auth.HttpPrincipal
61   * @see       com.liferay.portlet.imagegallery.service.IGImageServiceUtil
62   * @generated
63   */
64  public class IGImageServiceHttp {
65      public static com.liferay.portlet.imagegallery.model.IGImage addImage(
66          HttpPrincipal httpPrincipal, long groupId, long folderId,
67          java.lang.String name, java.lang.String description, java.io.File file,
68          java.lang.String contentType,
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(groupId);
74  
75              Object paramObj1 = new LongWrapper(folderId);
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 = file;
90  
91              if (file == null) {
92                  paramObj4 = new NullWrapper("java.io.File");
93              }
94  
95              Object paramObj5 = contentType;
96  
97              if (contentType == null) {
98                  paramObj5 = new NullWrapper("java.lang.String");
99              }
100 
101             Object paramObj6 = serviceContext;
102 
103             if (serviceContext == null) {
104                 paramObj6 = new NullWrapper(
105                         "com.liferay.portal.service.ServiceContext");
106             }
107 
108             MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
109                     "addImage",
110                     new Object[] {
111                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
112                         paramObj5, paramObj6
113                     });
114 
115             Object returnObj = null;
116 
117             try {
118                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
119             }
120             catch (Exception e) {
121                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
122                     throw (com.liferay.portal.kernel.exception.PortalException)e;
123                 }
124 
125                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
126                     throw (com.liferay.portal.kernel.exception.SystemException)e;
127                 }
128 
129                 throw new com.liferay.portal.kernel.exception.SystemException(e);
130             }
131 
132             return (com.liferay.portlet.imagegallery.model.IGImage)returnObj;
133         }
134         catch (com.liferay.portal.kernel.exception.SystemException se) {
135             _log.error(se, se);
136 
137             throw se;
138         }
139     }
140 
141     public static void deleteImage(HttpPrincipal httpPrincipal, long imageId)
142         throws com.liferay.portal.kernel.exception.PortalException,
143             com.liferay.portal.kernel.exception.SystemException {
144         try {
145             Object paramObj0 = new LongWrapper(imageId);
146 
147             MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
148                     "deleteImage", new Object[] { paramObj0 });
149 
150             try {
151                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
152             }
153             catch (Exception e) {
154                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
155                     throw (com.liferay.portal.kernel.exception.PortalException)e;
156                 }
157 
158                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
159                     throw (com.liferay.portal.kernel.exception.SystemException)e;
160                 }
161 
162                 throw new com.liferay.portal.kernel.exception.SystemException(e);
163             }
164         }
165         catch (com.liferay.portal.kernel.exception.SystemException se) {
166             _log.error(se, se);
167 
168             throw se;
169         }
170     }
171 
172     public static void deleteImageByFolderIdAndNameWithExtension(
173         HttpPrincipal httpPrincipal, long groupId, long folderId,
174         java.lang.String nameWithExtension)
175         throws com.liferay.portal.kernel.exception.PortalException,
176             com.liferay.portal.kernel.exception.SystemException {
177         try {
178             Object paramObj0 = new LongWrapper(groupId);
179 
180             Object paramObj1 = new LongWrapper(folderId);
181 
182             Object paramObj2 = nameWithExtension;
183 
184             if (nameWithExtension == null) {
185                 paramObj2 = new NullWrapper("java.lang.String");
186             }
187 
188             MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
189                     "deleteImageByFolderIdAndNameWithExtension",
190                     new Object[] { paramObj0, paramObj1, paramObj2 });
191 
192             try {
193                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
194             }
195             catch (Exception e) {
196                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
197                     throw (com.liferay.portal.kernel.exception.PortalException)e;
198                 }
199 
200                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
201                     throw (com.liferay.portal.kernel.exception.SystemException)e;
202                 }
203 
204                 throw new com.liferay.portal.kernel.exception.SystemException(e);
205             }
206         }
207         catch (com.liferay.portal.kernel.exception.SystemException se) {
208             _log.error(se, se);
209 
210             throw se;
211         }
212     }
213 
214     public static com.liferay.portlet.imagegallery.model.IGImage getImage(
215         HttpPrincipal httpPrincipal, long imageId)
216         throws com.liferay.portal.kernel.exception.PortalException,
217             com.liferay.portal.kernel.exception.SystemException {
218         try {
219             Object paramObj0 = new LongWrapper(imageId);
220 
221             MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
222                     "getImage", new Object[] { paramObj0 });
223 
224             Object returnObj = null;
225 
226             try {
227                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
228             }
229             catch (Exception e) {
230                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
231                     throw (com.liferay.portal.kernel.exception.PortalException)e;
232                 }
233 
234                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
235                     throw (com.liferay.portal.kernel.exception.SystemException)e;
236                 }
237 
238                 throw new com.liferay.portal.kernel.exception.SystemException(e);
239             }
240 
241             return (com.liferay.portlet.imagegallery.model.IGImage)returnObj;
242         }
243         catch (com.liferay.portal.kernel.exception.SystemException se) {
244             _log.error(se, se);
245 
246             throw se;
247         }
248     }
249 
250     public static com.liferay.portlet.imagegallery.model.IGImage getImageByFolderIdAndNameWithExtension(
251         HttpPrincipal httpPrincipal, long groupId, long folderId,
252         java.lang.String nameWithExtension)
253         throws com.liferay.portal.kernel.exception.PortalException,
254             com.liferay.portal.kernel.exception.SystemException {
255         try {
256             Object paramObj0 = new LongWrapper(groupId);
257 
258             Object paramObj1 = new LongWrapper(folderId);
259 
260             Object paramObj2 = nameWithExtension;
261 
262             if (nameWithExtension == null) {
263                 paramObj2 = new NullWrapper("java.lang.String");
264             }
265 
266             MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
267                     "getImageByFolderIdAndNameWithExtension",
268                     new Object[] { paramObj0, paramObj1, paramObj2 });
269 
270             Object returnObj = null;
271 
272             try {
273                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
274             }
275             catch (Exception e) {
276                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
277                     throw (com.liferay.portal.kernel.exception.PortalException)e;
278                 }
279 
280                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
281                     throw (com.liferay.portal.kernel.exception.SystemException)e;
282                 }
283 
284                 throw new com.liferay.portal.kernel.exception.SystemException(e);
285             }
286 
287             return (com.liferay.portlet.imagegallery.model.IGImage)returnObj;
288         }
289         catch (com.liferay.portal.kernel.exception.SystemException se) {
290             _log.error(se, se);
291 
292             throw se;
293         }
294     }
295 
296     public static com.liferay.portlet.imagegallery.model.IGImage getImageByLargeImageId(
297         HttpPrincipal httpPrincipal, long largeImageId)
298         throws com.liferay.portal.kernel.exception.PortalException,
299             com.liferay.portal.kernel.exception.SystemException {
300         try {
301             Object paramObj0 = new LongWrapper(largeImageId);
302 
303             MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
304                     "getImageByLargeImageId", new Object[] { paramObj0 });
305 
306             Object returnObj = null;
307 
308             try {
309                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
310             }
311             catch (Exception e) {
312                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
313                     throw (com.liferay.portal.kernel.exception.PortalException)e;
314                 }
315 
316                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
317                     throw (com.liferay.portal.kernel.exception.SystemException)e;
318                 }
319 
320                 throw new com.liferay.portal.kernel.exception.SystemException(e);
321             }
322 
323             return (com.liferay.portlet.imagegallery.model.IGImage)returnObj;
324         }
325         catch (com.liferay.portal.kernel.exception.SystemException se) {
326             _log.error(se, se);
327 
328             throw se;
329         }
330     }
331 
332     public static com.liferay.portlet.imagegallery.model.IGImage getImageBySmallImageId(
333         HttpPrincipal httpPrincipal, long smallImageId)
334         throws com.liferay.portal.kernel.exception.PortalException,
335             com.liferay.portal.kernel.exception.SystemException {
336         try {
337             Object paramObj0 = new LongWrapper(smallImageId);
338 
339             MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
340                     "getImageBySmallImageId", new Object[] { paramObj0 });
341 
342             Object returnObj = null;
343 
344             try {
345                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
346             }
347             catch (Exception e) {
348                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
349                     throw (com.liferay.portal.kernel.exception.PortalException)e;
350                 }
351 
352                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
353                     throw (com.liferay.portal.kernel.exception.SystemException)e;
354                 }
355 
356                 throw new com.liferay.portal.kernel.exception.SystemException(e);
357             }
358 
359             return (com.liferay.portlet.imagegallery.model.IGImage)returnObj;
360         }
361         catch (com.liferay.portal.kernel.exception.SystemException se) {
362             _log.error(se, se);
363 
364             throw se;
365         }
366     }
367 
368     public static java.util.List<com.liferay.portlet.imagegallery.model.IGImage> getImages(
369         HttpPrincipal httpPrincipal, long groupId, long folderId)
370         throws com.liferay.portal.kernel.exception.PortalException,
371             com.liferay.portal.kernel.exception.SystemException {
372         try {
373             Object paramObj0 = new LongWrapper(groupId);
374 
375             Object paramObj1 = new LongWrapper(folderId);
376 
377             MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
378                     "getImages", new Object[] { paramObj0, paramObj1 });
379 
380             Object returnObj = null;
381 
382             try {
383                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
384             }
385             catch (Exception e) {
386                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
387                     throw (com.liferay.portal.kernel.exception.PortalException)e;
388                 }
389 
390                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
391                     throw (com.liferay.portal.kernel.exception.SystemException)e;
392                 }
393 
394                 throw new com.liferay.portal.kernel.exception.SystemException(e);
395             }
396 
397             return (java.util.List<com.liferay.portlet.imagegallery.model.IGImage>)returnObj;
398         }
399         catch (com.liferay.portal.kernel.exception.SystemException se) {
400             _log.error(se, se);
401 
402             throw se;
403         }
404     }
405 
406     public static com.liferay.portlet.imagegallery.model.IGImage updateImage(
407         HttpPrincipal httpPrincipal, long imageId, long groupId, long folderId,
408         java.lang.String name, java.lang.String description, java.io.File file,
409         java.lang.String contentType,
410         com.liferay.portal.service.ServiceContext serviceContext)
411         throws com.liferay.portal.kernel.exception.PortalException,
412             com.liferay.portal.kernel.exception.SystemException {
413         try {
414             Object paramObj0 = new LongWrapper(imageId);
415 
416             Object paramObj1 = new LongWrapper(groupId);
417 
418             Object paramObj2 = new LongWrapper(folderId);
419 
420             Object paramObj3 = name;
421 
422             if (name == null) {
423                 paramObj3 = new NullWrapper("java.lang.String");
424             }
425 
426             Object paramObj4 = description;
427 
428             if (description == null) {
429                 paramObj4 = new NullWrapper("java.lang.String");
430             }
431 
432             Object paramObj5 = file;
433 
434             if (file == null) {
435                 paramObj5 = new NullWrapper("java.io.File");
436             }
437 
438             Object paramObj6 = contentType;
439 
440             if (contentType == null) {
441                 paramObj6 = new NullWrapper("java.lang.String");
442             }
443 
444             Object paramObj7 = serviceContext;
445 
446             if (serviceContext == null) {
447                 paramObj7 = new NullWrapper(
448                         "com.liferay.portal.service.ServiceContext");
449             }
450 
451             MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
452                     "updateImage",
453                     new Object[] {
454                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
455                         paramObj5, paramObj6, paramObj7
456                     });
457 
458             Object returnObj = null;
459 
460             try {
461                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
462             }
463             catch (Exception e) {
464                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
465                     throw (com.liferay.portal.kernel.exception.PortalException)e;
466                 }
467 
468                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
469                     throw (com.liferay.portal.kernel.exception.SystemException)e;
470                 }
471 
472                 throw new com.liferay.portal.kernel.exception.SystemException(e);
473             }
474 
475             return (com.liferay.portlet.imagegallery.model.IGImage)returnObj;
476         }
477         catch (com.liferay.portal.kernel.exception.SystemException se) {
478             _log.error(se, se);
479 
480             throw se;
481         }
482     }
483 
484     private static Log _log = LogFactoryUtil.getLog(IGImageServiceHttp.class);
485 }