001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portlet.imagegallery.service.http;
016    
017    import com.liferay.portal.kernel.log.Log;
018    import com.liferay.portal.kernel.log.LogFactoryUtil;
019    import com.liferay.portal.kernel.util.MethodHandler;
020    import com.liferay.portal.kernel.util.MethodKey;
021    import com.liferay.portal.security.auth.HttpPrincipal;
022    import com.liferay.portal.service.http.TunnelUtil;
023    
024    import com.liferay.portlet.imagegallery.service.IGImageServiceUtil;
025    
026    /**
027     * <p>
028     * This class provides a HTTP utility for the
029     * {@link com.liferay.portlet.imagegallery.service.IGImageServiceUtil} service utility. The
030     * static methods of this class calls the same methods of the service utility.
031     * However, the signatures are different because it requires an additional
032     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
033     * </p>
034     *
035     * <p>
036     * The benefits of using the HTTP utility is that it is fast and allows for
037     * tunneling without the cost of serializing to text. The drawback is that it
038     * only works with Java.
039     * </p>
040     *
041     * <p>
042     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
043     * configure security.
044     * </p>
045     *
046     * <p>
047     * The HTTP utility is only generated for remote services.
048     * </p>
049     *
050     * @author    Brian Wing Shun Chan
051     * @see       IGImageServiceSoap
052     * @see       com.liferay.portal.security.auth.HttpPrincipal
053     * @see       com.liferay.portlet.imagegallery.service.IGImageServiceUtil
054     * @generated
055     */
056    public class IGImageServiceHttp {
057            public static com.liferay.portlet.imagegallery.model.IGImage addImage(
058                    HttpPrincipal httpPrincipal, long groupId, long folderId,
059                    java.lang.String name, java.lang.String description, java.io.File file,
060                    java.lang.String contentType,
061                    com.liferay.portal.service.ServiceContext serviceContext)
062                    throws com.liferay.portal.kernel.exception.PortalException,
063                            com.liferay.portal.kernel.exception.SystemException {
064                    try {
065                            MethodKey methodKey = new MethodKey(IGImageServiceUtil.class.getName(),
066                                            "addImage", _addImageParameterTypes0);
067    
068                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
069                                            folderId, name, description, file, contentType,
070                                            serviceContext);
071    
072                            Object returnObj = null;
073    
074                            try {
075                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
076                            }
077                            catch (Exception e) {
078                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
079                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
080                                    }
081    
082                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
083                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
084                                    }
085    
086                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
087                            }
088    
089                            return (com.liferay.portlet.imagegallery.model.IGImage)returnObj;
090                    }
091                    catch (com.liferay.portal.kernel.exception.SystemException se) {
092                            _log.error(se, se);
093    
094                            throw se;
095                    }
096            }
097    
098            public static void deleteImage(HttpPrincipal httpPrincipal, long imageId)
099                    throws com.liferay.portal.kernel.exception.PortalException,
100                            com.liferay.portal.kernel.exception.SystemException {
101                    try {
102                            MethodKey methodKey = new MethodKey(IGImageServiceUtil.class.getName(),
103                                            "deleteImage", _deleteImageParameterTypes1);
104    
105                            MethodHandler methodHandler = new MethodHandler(methodKey, imageId);
106    
107                            try {
108                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
109                            }
110                            catch (Exception e) {
111                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
112                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
113                                    }
114    
115                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
116                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
117                                    }
118    
119                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
120                            }
121                    }
122                    catch (com.liferay.portal.kernel.exception.SystemException se) {
123                            _log.error(se, se);
124    
125                            throw se;
126                    }
127            }
128    
129            public static void deleteImageByFolderIdAndNameWithExtension(
130                    HttpPrincipal httpPrincipal, long groupId, long folderId,
131                    java.lang.String nameWithExtension)
132                    throws com.liferay.portal.kernel.exception.PortalException,
133                            com.liferay.portal.kernel.exception.SystemException {
134                    try {
135                            MethodKey methodKey = new MethodKey(IGImageServiceUtil.class.getName(),
136                                            "deleteImageByFolderIdAndNameWithExtension",
137                                            _deleteImageByFolderIdAndNameWithExtensionParameterTypes2);
138    
139                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
140                                            folderId, nameWithExtension);
141    
142                            try {
143                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
144                            }
145                            catch (Exception e) {
146                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
147                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
148                                    }
149    
150                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
151                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
152                                    }
153    
154                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
155                            }
156                    }
157                    catch (com.liferay.portal.kernel.exception.SystemException se) {
158                            _log.error(se, se);
159    
160                            throw se;
161                    }
162            }
163    
164            public static java.util.List<com.liferay.portlet.imagegallery.model.IGImage> getGroupImages(
165                    HttpPrincipal httpPrincipal, long groupId, long userId, int start,
166                    int end) throws com.liferay.portal.kernel.exception.SystemException {
167                    try {
168                            MethodKey methodKey = new MethodKey(IGImageServiceUtil.class.getName(),
169                                            "getGroupImages", _getGroupImagesParameterTypes3);
170    
171                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
172                                            userId, start, end);
173    
174                            Object returnObj = null;
175    
176                            try {
177                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
178                            }
179                            catch (Exception e) {
180                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
181                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
182                                    }
183    
184                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
185                            }
186    
187                            return (java.util.List<com.liferay.portlet.imagegallery.model.IGImage>)returnObj;
188                    }
189                    catch (com.liferay.portal.kernel.exception.SystemException se) {
190                            _log.error(se, se);
191    
192                            throw se;
193                    }
194            }
195    
196            public static int getGroupImagesCount(HttpPrincipal httpPrincipal,
197                    long groupId, long userId)
198                    throws com.liferay.portal.kernel.exception.SystemException {
199                    try {
200                            MethodKey methodKey = new MethodKey(IGImageServiceUtil.class.getName(),
201                                            "getGroupImagesCount", _getGroupImagesCountParameterTypes4);
202    
203                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
204                                            userId);
205    
206                            Object returnObj = null;
207    
208                            try {
209                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
210                            }
211                            catch (Exception e) {
212                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
213                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
214                                    }
215    
216                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
217                            }
218    
219                            return ((Integer)returnObj).intValue();
220                    }
221                    catch (com.liferay.portal.kernel.exception.SystemException se) {
222                            _log.error(se, se);
223    
224                            throw se;
225                    }
226            }
227    
228            public static com.liferay.portlet.imagegallery.model.IGImage getImage(
229                    HttpPrincipal httpPrincipal, long imageId)
230                    throws com.liferay.portal.kernel.exception.PortalException,
231                            com.liferay.portal.kernel.exception.SystemException {
232                    try {
233                            MethodKey methodKey = new MethodKey(IGImageServiceUtil.class.getName(),
234                                            "getImage", _getImageParameterTypes5);
235    
236                            MethodHandler methodHandler = new MethodHandler(methodKey, imageId);
237    
238                            Object returnObj = null;
239    
240                            try {
241                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
242                            }
243                            catch (Exception e) {
244                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
245                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
246                                    }
247    
248                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
249                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
250                                    }
251    
252                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
253                            }
254    
255                            return (com.liferay.portlet.imagegallery.model.IGImage)returnObj;
256                    }
257                    catch (com.liferay.portal.kernel.exception.SystemException se) {
258                            _log.error(se, se);
259    
260                            throw se;
261                    }
262            }
263    
264            public static com.liferay.portlet.imagegallery.model.IGImage getImageByFolderIdAndNameWithExtension(
265                    HttpPrincipal httpPrincipal, long groupId, long folderId,
266                    java.lang.String nameWithExtension)
267                    throws com.liferay.portal.kernel.exception.PortalException,
268                            com.liferay.portal.kernel.exception.SystemException {
269                    try {
270                            MethodKey methodKey = new MethodKey(IGImageServiceUtil.class.getName(),
271                                            "getImageByFolderIdAndNameWithExtension",
272                                            _getImageByFolderIdAndNameWithExtensionParameterTypes6);
273    
274                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
275                                            folderId, nameWithExtension);
276    
277                            Object returnObj = null;
278    
279                            try {
280                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
281                            }
282                            catch (Exception e) {
283                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
284                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
285                                    }
286    
287                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
288                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
289                                    }
290    
291                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
292                            }
293    
294                            return (com.liferay.portlet.imagegallery.model.IGImage)returnObj;
295                    }
296                    catch (com.liferay.portal.kernel.exception.SystemException se) {
297                            _log.error(se, se);
298    
299                            throw se;
300                    }
301            }
302    
303            public static com.liferay.portlet.imagegallery.model.IGImage getImageByLargeImageId(
304                    HttpPrincipal httpPrincipal, long largeImageId)
305                    throws com.liferay.portal.kernel.exception.PortalException,
306                            com.liferay.portal.kernel.exception.SystemException {
307                    try {
308                            MethodKey methodKey = new MethodKey(IGImageServiceUtil.class.getName(),
309                                            "getImageByLargeImageId",
310                                            _getImageByLargeImageIdParameterTypes7);
311    
312                            MethodHandler methodHandler = new MethodHandler(methodKey,
313                                            largeImageId);
314    
315                            Object returnObj = null;
316    
317                            try {
318                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
319                            }
320                            catch (Exception e) {
321                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
322                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
323                                    }
324    
325                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
326                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
327                                    }
328    
329                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
330                            }
331    
332                            return (com.liferay.portlet.imagegallery.model.IGImage)returnObj;
333                    }
334                    catch (com.liferay.portal.kernel.exception.SystemException se) {
335                            _log.error(se, se);
336    
337                            throw se;
338                    }
339            }
340    
341            public static com.liferay.portlet.imagegallery.model.IGImage getImageBySmallImageId(
342                    HttpPrincipal httpPrincipal, long smallImageId)
343                    throws com.liferay.portal.kernel.exception.PortalException,
344                            com.liferay.portal.kernel.exception.SystemException {
345                    try {
346                            MethodKey methodKey = new MethodKey(IGImageServiceUtil.class.getName(),
347                                            "getImageBySmallImageId",
348                                            _getImageBySmallImageIdParameterTypes8);
349    
350                            MethodHandler methodHandler = new MethodHandler(methodKey,
351                                            smallImageId);
352    
353                            Object returnObj = null;
354    
355                            try {
356                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
357                            }
358                            catch (Exception e) {
359                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
360                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
361                                    }
362    
363                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
364                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
365                                    }
366    
367                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
368                            }
369    
370                            return (com.liferay.portlet.imagegallery.model.IGImage)returnObj;
371                    }
372                    catch (com.liferay.portal.kernel.exception.SystemException se) {
373                            _log.error(se, se);
374    
375                            throw se;
376                    }
377            }
378    
379            public static java.util.List<com.liferay.portlet.imagegallery.model.IGImage> getImages(
380                    HttpPrincipal httpPrincipal, long groupId, long folderId)
381                    throws com.liferay.portal.kernel.exception.SystemException {
382                    try {
383                            MethodKey methodKey = new MethodKey(IGImageServiceUtil.class.getName(),
384                                            "getImages", _getImagesParameterTypes9);
385    
386                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
387                                            folderId);
388    
389                            Object returnObj = null;
390    
391                            try {
392                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
393                            }
394                            catch (Exception e) {
395                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
396                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
397                                    }
398    
399                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
400                            }
401    
402                            return (java.util.List<com.liferay.portlet.imagegallery.model.IGImage>)returnObj;
403                    }
404                    catch (com.liferay.portal.kernel.exception.SystemException se) {
405                            _log.error(se, se);
406    
407                            throw se;
408                    }
409            }
410    
411            public static java.util.List<com.liferay.portlet.imagegallery.model.IGImage> getImages(
412                    HttpPrincipal httpPrincipal, long groupId, long folderId, int start,
413                    int end) throws com.liferay.portal.kernel.exception.SystemException {
414                    try {
415                            MethodKey methodKey = new MethodKey(IGImageServiceUtil.class.getName(),
416                                            "getImages", _getImagesParameterTypes10);
417    
418                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
419                                            folderId, start, end);
420    
421                            Object returnObj = null;
422    
423                            try {
424                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
425                            }
426                            catch (Exception e) {
427                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
428                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
429                                    }
430    
431                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
432                            }
433    
434                            return (java.util.List<com.liferay.portlet.imagegallery.model.IGImage>)returnObj;
435                    }
436                    catch (com.liferay.portal.kernel.exception.SystemException se) {
437                            _log.error(se, se);
438    
439                            throw se;
440                    }
441            }
442    
443            public static int getImagesCount(HttpPrincipal httpPrincipal, long groupId,
444                    long folderId)
445                    throws com.liferay.portal.kernel.exception.SystemException {
446                    try {
447                            MethodKey methodKey = new MethodKey(IGImageServiceUtil.class.getName(),
448                                            "getImagesCount", _getImagesCountParameterTypes11);
449    
450                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
451                                            folderId);
452    
453                            Object returnObj = null;
454    
455                            try {
456                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
457                            }
458                            catch (Exception e) {
459                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
460                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
461                                    }
462    
463                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
464                            }
465    
466                            return ((Integer)returnObj).intValue();
467                    }
468                    catch (com.liferay.portal.kernel.exception.SystemException se) {
469                            _log.error(se, se);
470    
471                            throw se;
472                    }
473            }
474    
475            public static com.liferay.portlet.imagegallery.model.IGImage updateImage(
476                    HttpPrincipal httpPrincipal, long imageId, long groupId, long folderId,
477                    java.lang.String name, java.lang.String description, java.io.File file,
478                    java.lang.String contentType,
479                    com.liferay.portal.service.ServiceContext serviceContext)
480                    throws com.liferay.portal.kernel.exception.PortalException,
481                            com.liferay.portal.kernel.exception.SystemException {
482                    try {
483                            MethodKey methodKey = new MethodKey(IGImageServiceUtil.class.getName(),
484                                            "updateImage", _updateImageParameterTypes12);
485    
486                            MethodHandler methodHandler = new MethodHandler(methodKey, imageId,
487                                            groupId, folderId, name, description, file, contentType,
488                                            serviceContext);
489    
490                            Object returnObj = null;
491    
492                            try {
493                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
494                            }
495                            catch (Exception e) {
496                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
497                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
498                                    }
499    
500                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
501                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
502                                    }
503    
504                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
505                            }
506    
507                            return (com.liferay.portlet.imagegallery.model.IGImage)returnObj;
508                    }
509                    catch (com.liferay.portal.kernel.exception.SystemException se) {
510                            _log.error(se, se);
511    
512                            throw se;
513                    }
514            }
515    
516            private static Log _log = LogFactoryUtil.getLog(IGImageServiceHttp.class);
517            private static final Class<?>[] _addImageParameterTypes0 = new Class[] {
518                            long.class, long.class, java.lang.String.class,
519                            java.lang.String.class, java.io.File.class, java.lang.String.class,
520                            com.liferay.portal.service.ServiceContext.class
521                    };
522            private static final Class<?>[] _deleteImageParameterTypes1 = new Class[] {
523                            long.class
524                    };
525            private static final Class<?>[] _deleteImageByFolderIdAndNameWithExtensionParameterTypes2 =
526                    new Class[] { long.class, long.class, java.lang.String.class };
527            private static final Class<?>[] _getGroupImagesParameterTypes3 = new Class[] {
528                            long.class, long.class, int.class, int.class
529                    };
530            private static final Class<?>[] _getGroupImagesCountParameterTypes4 = new Class[] {
531                            long.class, long.class
532                    };
533            private static final Class<?>[] _getImageParameterTypes5 = new Class[] {
534                            long.class
535                    };
536            private static final Class<?>[] _getImageByFolderIdAndNameWithExtensionParameterTypes6 =
537                    new Class[] { long.class, long.class, java.lang.String.class };
538            private static final Class<?>[] _getImageByLargeImageIdParameterTypes7 = new Class[] {
539                            long.class
540                    };
541            private static final Class<?>[] _getImageBySmallImageIdParameterTypes8 = new Class[] {
542                            long.class
543                    };
544            private static final Class<?>[] _getImagesParameterTypes9 = new Class[] {
545                            long.class, long.class
546                    };
547            private static final Class<?>[] _getImagesParameterTypes10 = new Class[] {
548                            long.class, long.class, int.class, int.class
549                    };
550            private static final Class<?>[] _getImagesCountParameterTypes11 = new Class[] {
551                            long.class, long.class
552                    };
553            private static final Class<?>[] _updateImageParameterTypes12 = new Class[] {
554                            long.class, long.class, long.class, java.lang.String.class,
555                            java.lang.String.class, java.io.File.class, java.lang.String.class,
556                            com.liferay.portal.service.ServiceContext.class
557                    };
558    }