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