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