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.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 folderId, java.lang.String name,
67          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.PortalException,
71              com.liferay.portal.SystemException {
72          try {
73              Object paramObj0 = new LongWrapper(folderId);
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 = file;
88  
89              if (file == null) {
90                  paramObj3 = new NullWrapper("java.io.File");
91              }
92  
93              Object paramObj4 = contentType;
94  
95              if (contentType == null) {
96                  paramObj4 = new NullWrapper("java.lang.String");
97              }
98  
99              Object paramObj5 = serviceContext;
100 
101             if (serviceContext == null) {
102                 paramObj5 = new NullWrapper(
103                         "com.liferay.portal.service.ServiceContext");
104             }
105 
106             MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
107                     "addImage",
108                     new Object[] {
109                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
110                         paramObj5
111                     });
112 
113             Object returnObj = null;
114 
115             try {
116                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
117             }
118             catch (Exception e) {
119                 if (e instanceof com.liferay.portal.PortalException) {
120                     throw (com.liferay.portal.PortalException)e;
121                 }
122 
123                 if (e instanceof com.liferay.portal.SystemException) {
124                     throw (com.liferay.portal.SystemException)e;
125                 }
126 
127                 throw new com.liferay.portal.SystemException(e);
128             }
129 
130             return (com.liferay.portlet.imagegallery.model.IGImage)returnObj;
131         }
132         catch (com.liferay.portal.SystemException se) {
133             _log.error(se, se);
134 
135             throw se;
136         }
137     }
138 
139     public static void deleteImage(HttpPrincipal httpPrincipal, long imageId)
140         throws com.liferay.portal.PortalException,
141             com.liferay.portal.SystemException {
142         try {
143             Object paramObj0 = new LongWrapper(imageId);
144 
145             MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
146                     "deleteImage", new Object[] { paramObj0 });
147 
148             try {
149                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
150             }
151             catch (Exception e) {
152                 if (e instanceof com.liferay.portal.PortalException) {
153                     throw (com.liferay.portal.PortalException)e;
154                 }
155 
156                 if (e instanceof com.liferay.portal.SystemException) {
157                     throw (com.liferay.portal.SystemException)e;
158                 }
159 
160                 throw new com.liferay.portal.SystemException(e);
161             }
162         }
163         catch (com.liferay.portal.SystemException se) {
164             _log.error(se, se);
165 
166             throw se;
167         }
168     }
169 
170     public static void deleteImageByFolderIdAndNameWithExtension(
171         HttpPrincipal httpPrincipal, long folderId,
172         java.lang.String nameWithExtension)
173         throws com.liferay.portal.PortalException,
174             com.liferay.portal.SystemException {
175         try {
176             Object paramObj0 = new LongWrapper(folderId);
177 
178             Object paramObj1 = nameWithExtension;
179 
180             if (nameWithExtension == null) {
181                 paramObj1 = new NullWrapper("java.lang.String");
182             }
183 
184             MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
185                     "deleteImageByFolderIdAndNameWithExtension",
186                     new Object[] { paramObj0, paramObj1 });
187 
188             try {
189                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
190             }
191             catch (Exception e) {
192                 if (e instanceof com.liferay.portal.PortalException) {
193                     throw (com.liferay.portal.PortalException)e;
194                 }
195 
196                 if (e instanceof com.liferay.portal.SystemException) {
197                     throw (com.liferay.portal.SystemException)e;
198                 }
199 
200                 throw new com.liferay.portal.SystemException(e);
201             }
202         }
203         catch (com.liferay.portal.SystemException se) {
204             _log.error(se, se);
205 
206             throw se;
207         }
208     }
209 
210     public static com.liferay.portlet.imagegallery.model.IGImage getImage(
211         HttpPrincipal httpPrincipal, long imageId)
212         throws com.liferay.portal.PortalException,
213             com.liferay.portal.SystemException {
214         try {
215             Object paramObj0 = new LongWrapper(imageId);
216 
217             MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
218                     "getImage", new Object[] { paramObj0 });
219 
220             Object returnObj = null;
221 
222             try {
223                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
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 getImageByFolderIdAndNameWithExtension(
247         HttpPrincipal httpPrincipal, long folderId,
248         java.lang.String nameWithExtension)
249         throws com.liferay.portal.PortalException,
250             com.liferay.portal.SystemException {
251         try {
252             Object paramObj0 = new LongWrapper(folderId);
253 
254             Object paramObj1 = nameWithExtension;
255 
256             if (nameWithExtension == null) {
257                 paramObj1 = new NullWrapper("java.lang.String");
258             }
259 
260             MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
261                     "getImageByFolderIdAndNameWithExtension",
262                     new Object[] { paramObj0, paramObj1 });
263 
264             Object returnObj = null;
265 
266             try {
267                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
268             }
269             catch (Exception e) {
270                 if (e instanceof com.liferay.portal.PortalException) {
271                     throw (com.liferay.portal.PortalException)e;
272                 }
273 
274                 if (e instanceof com.liferay.portal.SystemException) {
275                     throw (com.liferay.portal.SystemException)e;
276                 }
277 
278                 throw new com.liferay.portal.SystemException(e);
279             }
280 
281             return (com.liferay.portlet.imagegallery.model.IGImage)returnObj;
282         }
283         catch (com.liferay.portal.SystemException se) {
284             _log.error(se, se);
285 
286             throw se;
287         }
288     }
289 
290     public static com.liferay.portlet.imagegallery.model.IGImage getImageByLargeImageId(
291         HttpPrincipal httpPrincipal, long largeImageId)
292         throws com.liferay.portal.PortalException,
293             com.liferay.portal.SystemException {
294         try {
295             Object paramObj0 = new LongWrapper(largeImageId);
296 
297             MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
298                     "getImageByLargeImageId", new Object[] { paramObj0 });
299 
300             Object returnObj = null;
301 
302             try {
303                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
304             }
305             catch (Exception e) {
306                 if (e instanceof com.liferay.portal.PortalException) {
307                     throw (com.liferay.portal.PortalException)e;
308                 }
309 
310                 if (e instanceof com.liferay.portal.SystemException) {
311                     throw (com.liferay.portal.SystemException)e;
312                 }
313 
314                 throw new com.liferay.portal.SystemException(e);
315             }
316 
317             return (com.liferay.portlet.imagegallery.model.IGImage)returnObj;
318         }
319         catch (com.liferay.portal.SystemException se) {
320             _log.error(se, se);
321 
322             throw se;
323         }
324     }
325 
326     public static com.liferay.portlet.imagegallery.model.IGImage getImageBySmallImageId(
327         HttpPrincipal httpPrincipal, long smallImageId)
328         throws com.liferay.portal.PortalException,
329             com.liferay.portal.SystemException {
330         try {
331             Object paramObj0 = new LongWrapper(smallImageId);
332 
333             MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
334                     "getImageBySmallImageId", new Object[] { paramObj0 });
335 
336             Object returnObj = null;
337 
338             try {
339                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
340             }
341             catch (Exception e) {
342                 if (e instanceof com.liferay.portal.PortalException) {
343                     throw (com.liferay.portal.PortalException)e;
344                 }
345 
346                 if (e instanceof com.liferay.portal.SystemException) {
347                     throw (com.liferay.portal.SystemException)e;
348                 }
349 
350                 throw new com.liferay.portal.SystemException(e);
351             }
352 
353             return (com.liferay.portlet.imagegallery.model.IGImage)returnObj;
354         }
355         catch (com.liferay.portal.SystemException se) {
356             _log.error(se, se);
357 
358             throw se;
359         }
360     }
361 
362     public static java.util.List<com.liferay.portlet.imagegallery.model.IGImage> getImages(
363         HttpPrincipal httpPrincipal, long folderId)
364         throws com.liferay.portal.PortalException,
365             com.liferay.portal.SystemException {
366         try {
367             Object paramObj0 = new LongWrapper(folderId);
368 
369             MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
370                     "getImages", new Object[] { paramObj0 });
371 
372             Object returnObj = null;
373 
374             try {
375                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
376             }
377             catch (Exception e) {
378                 if (e instanceof com.liferay.portal.PortalException) {
379                     throw (com.liferay.portal.PortalException)e;
380                 }
381 
382                 if (e instanceof com.liferay.portal.SystemException) {
383                     throw (com.liferay.portal.SystemException)e;
384                 }
385 
386                 throw new com.liferay.portal.SystemException(e);
387             }
388 
389             return (java.util.List<com.liferay.portlet.imagegallery.model.IGImage>)returnObj;
390         }
391         catch (com.liferay.portal.SystemException se) {
392             _log.error(se, se);
393 
394             throw se;
395         }
396     }
397 
398     public static com.liferay.portlet.imagegallery.model.IGImage updateImage(
399         HttpPrincipal httpPrincipal, long imageId, long folderId,
400         java.lang.String name, java.lang.String description, java.io.File file,
401         java.lang.String contentType,
402         com.liferay.portal.service.ServiceContext serviceContext)
403         throws com.liferay.portal.PortalException,
404             com.liferay.portal.SystemException {
405         try {
406             Object paramObj0 = new LongWrapper(imageId);
407 
408             Object paramObj1 = new LongWrapper(folderId);
409 
410             Object paramObj2 = name;
411 
412             if (name == null) {
413                 paramObj2 = new NullWrapper("java.lang.String");
414             }
415 
416             Object paramObj3 = description;
417 
418             if (description == null) {
419                 paramObj3 = new NullWrapper("java.lang.String");
420             }
421 
422             Object paramObj4 = file;
423 
424             if (file == null) {
425                 paramObj4 = new NullWrapper("java.io.File");
426             }
427 
428             Object paramObj5 = contentType;
429 
430             if (contentType == null) {
431                 paramObj5 = new NullWrapper("java.lang.String");
432             }
433 
434             Object paramObj6 = serviceContext;
435 
436             if (serviceContext == null) {
437                 paramObj6 = new NullWrapper(
438                         "com.liferay.portal.service.ServiceContext");
439             }
440 
441             MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
442                     "updateImage",
443                     new Object[] {
444                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
445                         paramObj5, paramObj6
446                     });
447 
448             Object returnObj = null;
449 
450             try {
451                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
452             }
453             catch (Exception e) {
454                 if (e instanceof com.liferay.portal.PortalException) {
455                     throw (com.liferay.portal.PortalException)e;
456                 }
457 
458                 if (e instanceof com.liferay.portal.SystemException) {
459                     throw (com.liferay.portal.SystemException)e;
460                 }
461 
462                 throw new com.liferay.portal.SystemException(e);
463             }
464 
465             return (com.liferay.portlet.imagegallery.model.IGImage)returnObj;
466         }
467         catch (com.liferay.portal.SystemException se) {
468             _log.error(se, se);
469 
470             throw se;
471         }
472     }
473 
474     private static Log _log = LogFactoryUtil.getLog(IGImageServiceHttp.class);
475 }