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.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.IGImageServiceUtil;
27  
28  /**
29   * <a href="IGImageServiceHttp.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.IGImageServiceUtil} 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       IGImageServiceSoap
61   * @see       com.liferay.portal.security.auth.HttpPrincipal
62   * @see       com.liferay.portlet.imagegallery.service.IGImageServiceUtil
63   * @generated
64   */
65  public class IGImageServiceHttp {
66      public static com.liferay.portlet.imagegallery.model.IGImage addImage(
67          HttpPrincipal httpPrincipal, long folderId, java.lang.String name,
68          java.lang.String description, java.io.File file,
69          java.lang.String contentType, java.lang.String[] tagsEntries,
70          boolean addCommunityPermissions, boolean addGuestPermissions)
71          throws com.liferay.portal.PortalException,
72              com.liferay.portal.SystemException {
73          try {
74              Object paramObj0 = new LongWrapper(folderId);
75  
76              Object paramObj1 = name;
77  
78              if (name == null) {
79                  paramObj1 = new NullWrapper("java.lang.String");
80              }
81  
82              Object paramObj2 = description;
83  
84              if (description == null) {
85                  paramObj2 = new NullWrapper("java.lang.String");
86              }
87  
88              Object paramObj3 = file;
89  
90              if (file == null) {
91                  paramObj3 = new NullWrapper("java.io.File");
92              }
93  
94              Object paramObj4 = contentType;
95  
96              if (contentType == null) {
97                  paramObj4 = new NullWrapper("java.lang.String");
98              }
99  
100             Object paramObj5 = tagsEntries;
101 
102             if (tagsEntries == null) {
103                 paramObj5 = new NullWrapper("[Ljava.lang.String;");
104             }
105 
106             Object paramObj6 = new BooleanWrapper(addCommunityPermissions);
107 
108             Object paramObj7 = new BooleanWrapper(addGuestPermissions);
109 
110             MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
111                     "addImage",
112                     new Object[] {
113                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
114                         paramObj5, paramObj6, paramObj7
115                     });
116 
117             Object returnObj = null;
118 
119             try {
120                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
121             }
122             catch (Exception e) {
123                 if (e instanceof com.liferay.portal.PortalException) {
124                     throw (com.liferay.portal.PortalException)e;
125                 }
126 
127                 if (e instanceof com.liferay.portal.SystemException) {
128                     throw (com.liferay.portal.SystemException)e;
129                 }
130 
131                 throw new com.liferay.portal.SystemException(e);
132             }
133 
134             return (com.liferay.portlet.imagegallery.model.IGImage)returnObj;
135         }
136         catch (com.liferay.portal.SystemException se) {
137             _log.error(se, se);
138 
139             throw se;
140         }
141     }
142 
143     public static com.liferay.portlet.imagegallery.model.IGImage addImage(
144         HttpPrincipal httpPrincipal, long folderId, java.lang.String name,
145         java.lang.String description, java.io.File file,
146         java.lang.String contentType, java.lang.String[] tagsEntries,
147         java.lang.String[] communityPermissions,
148         java.lang.String[] guestPermissions)
149         throws com.liferay.portal.PortalException,
150             com.liferay.portal.SystemException {
151         try {
152             Object paramObj0 = new LongWrapper(folderId);
153 
154             Object paramObj1 = name;
155 
156             if (name == null) {
157                 paramObj1 = new NullWrapper("java.lang.String");
158             }
159 
160             Object paramObj2 = description;
161 
162             if (description == null) {
163                 paramObj2 = new NullWrapper("java.lang.String");
164             }
165 
166             Object paramObj3 = file;
167 
168             if (file == null) {
169                 paramObj3 = new NullWrapper("java.io.File");
170             }
171 
172             Object paramObj4 = contentType;
173 
174             if (contentType == null) {
175                 paramObj4 = new NullWrapper("java.lang.String");
176             }
177 
178             Object paramObj5 = tagsEntries;
179 
180             if (tagsEntries == null) {
181                 paramObj5 = new NullWrapper("[Ljava.lang.String;");
182             }
183 
184             Object paramObj6 = communityPermissions;
185 
186             if (communityPermissions == null) {
187                 paramObj6 = new NullWrapper("[Ljava.lang.String;");
188             }
189 
190             Object paramObj7 = guestPermissions;
191 
192             if (guestPermissions == null) {
193                 paramObj7 = new NullWrapper("[Ljava.lang.String;");
194             }
195 
196             MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
197                     "addImage",
198                     new Object[] {
199                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
200                         paramObj5, paramObj6, paramObj7
201                     });
202 
203             Object returnObj = null;
204 
205             try {
206                 returnObj = 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             return (com.liferay.portlet.imagegallery.model.IGImage)returnObj;
221         }
222         catch (com.liferay.portal.SystemException se) {
223             _log.error(se, se);
224 
225             throw se;
226         }
227     }
228 
229     public static void deleteImage(HttpPrincipal httpPrincipal, long imageId)
230         throws com.liferay.portal.PortalException,
231             com.liferay.portal.SystemException {
232         try {
233             Object paramObj0 = new LongWrapper(imageId);
234 
235             MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
236                     "deleteImage", new Object[] { paramObj0 });
237 
238             try {
239                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
240             }
241             catch (Exception e) {
242                 if (e instanceof com.liferay.portal.PortalException) {
243                     throw (com.liferay.portal.PortalException)e;
244                 }
245 
246                 if (e instanceof com.liferay.portal.SystemException) {
247                     throw (com.liferay.portal.SystemException)e;
248                 }
249 
250                 throw new com.liferay.portal.SystemException(e);
251             }
252         }
253         catch (com.liferay.portal.SystemException se) {
254             _log.error(se, se);
255 
256             throw se;
257         }
258     }
259 
260     public static void deleteImageByFolderIdAndNameWithExtension(
261         HttpPrincipal httpPrincipal, long folderId,
262         java.lang.String nameWithExtension)
263         throws com.liferay.portal.PortalException,
264             com.liferay.portal.SystemException {
265         try {
266             Object paramObj0 = new LongWrapper(folderId);
267 
268             Object paramObj1 = nameWithExtension;
269 
270             if (nameWithExtension == null) {
271                 paramObj1 = new NullWrapper("java.lang.String");
272             }
273 
274             MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
275                     "deleteImageByFolderIdAndNameWithExtension",
276                     new Object[] { paramObj0, paramObj1 });
277 
278             try {
279                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
280             }
281             catch (Exception e) {
282                 if (e instanceof com.liferay.portal.PortalException) {
283                     throw (com.liferay.portal.PortalException)e;
284                 }
285 
286                 if (e instanceof com.liferay.portal.SystemException) {
287                     throw (com.liferay.portal.SystemException)e;
288                 }
289 
290                 throw new com.liferay.portal.SystemException(e);
291             }
292         }
293         catch (com.liferay.portal.SystemException se) {
294             _log.error(se, se);
295 
296             throw se;
297         }
298     }
299 
300     public static com.liferay.portlet.imagegallery.model.IGImage getImage(
301         HttpPrincipal httpPrincipal, long imageId)
302         throws com.liferay.portal.PortalException,
303             com.liferay.portal.SystemException {
304         try {
305             Object paramObj0 = new LongWrapper(imageId);
306 
307             MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
308                     "getImage", new Object[] { paramObj0 });
309 
310             Object returnObj = null;
311 
312             try {
313                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
314             }
315             catch (Exception e) {
316                 if (e instanceof com.liferay.portal.PortalException) {
317                     throw (com.liferay.portal.PortalException)e;
318                 }
319 
320                 if (e instanceof com.liferay.portal.SystemException) {
321                     throw (com.liferay.portal.SystemException)e;
322                 }
323 
324                 throw new com.liferay.portal.SystemException(e);
325             }
326 
327             return (com.liferay.portlet.imagegallery.model.IGImage)returnObj;
328         }
329         catch (com.liferay.portal.SystemException se) {
330             _log.error(se, se);
331 
332             throw se;
333         }
334     }
335 
336     public static com.liferay.portlet.imagegallery.model.IGImage getImageByFolderIdAndNameWithExtension(
337         HttpPrincipal httpPrincipal, long folderId,
338         java.lang.String nameWithExtension)
339         throws com.liferay.portal.PortalException,
340             com.liferay.portal.SystemException {
341         try {
342             Object paramObj0 = new LongWrapper(folderId);
343 
344             Object paramObj1 = nameWithExtension;
345 
346             if (nameWithExtension == null) {
347                 paramObj1 = new NullWrapper("java.lang.String");
348             }
349 
350             MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
351                     "getImageByFolderIdAndNameWithExtension",
352                     new Object[] { paramObj0, paramObj1 });
353 
354             Object returnObj = null;
355 
356             try {
357                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
358             }
359             catch (Exception e) {
360                 if (e instanceof com.liferay.portal.PortalException) {
361                     throw (com.liferay.portal.PortalException)e;
362                 }
363 
364                 if (e instanceof com.liferay.portal.SystemException) {
365                     throw (com.liferay.portal.SystemException)e;
366                 }
367 
368                 throw new com.liferay.portal.SystemException(e);
369             }
370 
371             return (com.liferay.portlet.imagegallery.model.IGImage)returnObj;
372         }
373         catch (com.liferay.portal.SystemException se) {
374             _log.error(se, se);
375 
376             throw se;
377         }
378     }
379 
380     public static com.liferay.portlet.imagegallery.model.IGImage getImageByLargeImageId(
381         HttpPrincipal httpPrincipal, long largeImageId)
382         throws com.liferay.portal.PortalException,
383             com.liferay.portal.SystemException {
384         try {
385             Object paramObj0 = new LongWrapper(largeImageId);
386 
387             MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
388                     "getImageByLargeImageId", new Object[] { paramObj0 });
389 
390             Object returnObj = null;
391 
392             try {
393                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
394             }
395             catch (Exception e) {
396                 if (e instanceof com.liferay.portal.PortalException) {
397                     throw (com.liferay.portal.PortalException)e;
398                 }
399 
400                 if (e instanceof com.liferay.portal.SystemException) {
401                     throw (com.liferay.portal.SystemException)e;
402                 }
403 
404                 throw new com.liferay.portal.SystemException(e);
405             }
406 
407             return (com.liferay.portlet.imagegallery.model.IGImage)returnObj;
408         }
409         catch (com.liferay.portal.SystemException se) {
410             _log.error(se, se);
411 
412             throw se;
413         }
414     }
415 
416     public static com.liferay.portlet.imagegallery.model.IGImage getImageBySmallImageId(
417         HttpPrincipal httpPrincipal, long smallImageId)
418         throws com.liferay.portal.PortalException,
419             com.liferay.portal.SystemException {
420         try {
421             Object paramObj0 = new LongWrapper(smallImageId);
422 
423             MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
424                     "getImageBySmallImageId", new Object[] { paramObj0 });
425 
426             Object returnObj = null;
427 
428             try {
429                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
430             }
431             catch (Exception e) {
432                 if (e instanceof com.liferay.portal.PortalException) {
433                     throw (com.liferay.portal.PortalException)e;
434                 }
435 
436                 if (e instanceof com.liferay.portal.SystemException) {
437                     throw (com.liferay.portal.SystemException)e;
438                 }
439 
440                 throw new com.liferay.portal.SystemException(e);
441             }
442 
443             return (com.liferay.portlet.imagegallery.model.IGImage)returnObj;
444         }
445         catch (com.liferay.portal.SystemException se) {
446             _log.error(se, se);
447 
448             throw se;
449         }
450     }
451 
452     public static java.util.List<com.liferay.portlet.imagegallery.model.IGImage> getImages(
453         HttpPrincipal httpPrincipal, long folderId)
454         throws com.liferay.portal.PortalException,
455             com.liferay.portal.SystemException {
456         try {
457             Object paramObj0 = new LongWrapper(folderId);
458 
459             MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
460                     "getImages", new Object[] { paramObj0 });
461 
462             Object returnObj = null;
463 
464             try {
465                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
466             }
467             catch (Exception e) {
468                 if (e instanceof com.liferay.portal.PortalException) {
469                     throw (com.liferay.portal.PortalException)e;
470                 }
471 
472                 if (e instanceof com.liferay.portal.SystemException) {
473                     throw (com.liferay.portal.SystemException)e;
474                 }
475 
476                 throw new com.liferay.portal.SystemException(e);
477             }
478 
479             return (java.util.List<com.liferay.portlet.imagegallery.model.IGImage>)returnObj;
480         }
481         catch (com.liferay.portal.SystemException se) {
482             _log.error(se, se);
483 
484             throw se;
485         }
486     }
487 
488     public static com.liferay.portlet.imagegallery.model.IGImage updateImage(
489         HttpPrincipal httpPrincipal, long imageId, long folderId,
490         java.lang.String name, java.lang.String description, java.io.File file,
491         java.lang.String contentType, java.lang.String[] tagsEntries)
492         throws com.liferay.portal.PortalException,
493             com.liferay.portal.SystemException {
494         try {
495             Object paramObj0 = new LongWrapper(imageId);
496 
497             Object paramObj1 = new LongWrapper(folderId);
498 
499             Object paramObj2 = name;
500 
501             if (name == null) {
502                 paramObj2 = new NullWrapper("java.lang.String");
503             }
504 
505             Object paramObj3 = description;
506 
507             if (description == null) {
508                 paramObj3 = new NullWrapper("java.lang.String");
509             }
510 
511             Object paramObj4 = file;
512 
513             if (file == null) {
514                 paramObj4 = new NullWrapper("java.io.File");
515             }
516 
517             Object paramObj5 = contentType;
518 
519             if (contentType == null) {
520                 paramObj5 = new NullWrapper("java.lang.String");
521             }
522 
523             Object paramObj6 = tagsEntries;
524 
525             if (tagsEntries == null) {
526                 paramObj6 = new NullWrapper("[Ljava.lang.String;");
527             }
528 
529             MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
530                     "updateImage",
531                     new Object[] {
532                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
533                         paramObj5, paramObj6
534                     });
535 
536             Object returnObj = null;
537 
538             try {
539                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
540             }
541             catch (Exception e) {
542                 if (e instanceof com.liferay.portal.PortalException) {
543                     throw (com.liferay.portal.PortalException)e;
544                 }
545 
546                 if (e instanceof com.liferay.portal.SystemException) {
547                     throw (com.liferay.portal.SystemException)e;
548                 }
549 
550                 throw new com.liferay.portal.SystemException(e);
551             }
552 
553             return (com.liferay.portlet.imagegallery.model.IGImage)returnObj;
554         }
555         catch (com.liferay.portal.SystemException se) {
556             _log.error(se, se);
557 
558             throw se;
559         }
560     }
561 
562     private static Log _log = LogFactoryUtil.getLog(IGImageServiceHttp.class);
563 }