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