001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
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.BooleanWrapper;
020    import com.liferay.portal.kernel.util.IntegerWrapper;
021    import com.liferay.portal.kernel.util.LongWrapper;
022    import com.liferay.portal.kernel.util.MethodWrapper;
023    import com.liferay.portal.kernel.util.NullWrapper;
024    import com.liferay.portal.security.auth.HttpPrincipal;
025    import com.liferay.portal.service.http.TunnelUtil;
026    
027    import com.liferay.portlet.imagegallery.service.IGFolderServiceUtil;
028    
029    /**
030     * <p>
031     * This class provides a HTTP utility for the
032     * {@link com.liferay.portlet.imagegallery.service.IGFolderServiceUtil} service utility. The
033     * static methods of this class calls the same methods of the service utility.
034     * However, the signatures are different because it requires an additional
035     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
036     * </p>
037     *
038     * <p>
039     * The benefits of using the HTTP utility is that it is fast and allows for
040     * tunneling without the cost of serializing to text. The drawback is that it
041     * only works with Java.
042     * </p>
043     *
044     * <p>
045     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
046     * configure security.
047     * </p>
048     *
049     * <p>
050     * The HTTP utility is only generated for remote services.
051     * </p>
052     *
053     * @author    Brian Wing Shun Chan
054     * @see       IGFolderServiceSoap
055     * @see       com.liferay.portal.security.auth.HttpPrincipal
056     * @see       com.liferay.portlet.imagegallery.service.IGFolderServiceUtil
057     * @generated
058     */
059    public class IGFolderServiceHttp {
060            public static com.liferay.portlet.imagegallery.model.IGFolder addFolder(
061                    HttpPrincipal httpPrincipal, long parentFolderId,
062                    java.lang.String name, java.lang.String description,
063                    com.liferay.portal.service.ServiceContext serviceContext)
064                    throws com.liferay.portal.kernel.exception.PortalException,
065                            com.liferay.portal.kernel.exception.SystemException {
066                    try {
067                            Object paramObj0 = new LongWrapper(parentFolderId);
068    
069                            Object paramObj1 = name;
070    
071                            if (name == null) {
072                                    paramObj1 = new NullWrapper("java.lang.String");
073                            }
074    
075                            Object paramObj2 = description;
076    
077                            if (description == null) {
078                                    paramObj2 = new NullWrapper("java.lang.String");
079                            }
080    
081                            Object paramObj3 = serviceContext;
082    
083                            if (serviceContext == null) {
084                                    paramObj3 = new NullWrapper(
085                                                    "com.liferay.portal.service.ServiceContext");
086                            }
087    
088                            MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
089                                            "addFolder",
090                                            new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
091    
092                            Object returnObj = null;
093    
094                            try {
095                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
096                            }
097                            catch (Exception e) {
098                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
099                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
100                                    }
101    
102                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
103                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
104                                    }
105    
106                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
107                            }
108    
109                            return (com.liferay.portlet.imagegallery.model.IGFolder)returnObj;
110                    }
111                    catch (com.liferay.portal.kernel.exception.SystemException se) {
112                            _log.error(se, se);
113    
114                            throw se;
115                    }
116            }
117    
118            public static com.liferay.portlet.imagegallery.model.IGFolder copyFolder(
119                    HttpPrincipal httpPrincipal, long sourceFolderId, long parentFolderId,
120                    java.lang.String name, java.lang.String description,
121                    com.liferay.portal.service.ServiceContext serviceContext)
122                    throws com.liferay.portal.kernel.exception.PortalException,
123                            com.liferay.portal.kernel.exception.SystemException {
124                    try {
125                            Object paramObj0 = new LongWrapper(sourceFolderId);
126    
127                            Object paramObj1 = new LongWrapper(parentFolderId);
128    
129                            Object paramObj2 = name;
130    
131                            if (name == null) {
132                                    paramObj2 = new NullWrapper("java.lang.String");
133                            }
134    
135                            Object paramObj3 = description;
136    
137                            if (description == null) {
138                                    paramObj3 = new NullWrapper("java.lang.String");
139                            }
140    
141                            Object paramObj4 = serviceContext;
142    
143                            if (serviceContext == null) {
144                                    paramObj4 = new NullWrapper(
145                                                    "com.liferay.portal.service.ServiceContext");
146                            }
147    
148                            MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
149                                            "copyFolder",
150                                            new Object[] {
151                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
152                                            });
153    
154                            Object returnObj = null;
155    
156                            try {
157                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
158                            }
159                            catch (Exception e) {
160                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
161                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
162                                    }
163    
164                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
165                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
166                                    }
167    
168                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
169                            }
170    
171                            return (com.liferay.portlet.imagegallery.model.IGFolder)returnObj;
172                    }
173                    catch (com.liferay.portal.kernel.exception.SystemException se) {
174                            _log.error(se, se);
175    
176                            throw se;
177                    }
178            }
179    
180            public static void deleteFolder(HttpPrincipal httpPrincipal, long folderId)
181                    throws com.liferay.portal.kernel.exception.PortalException,
182                            com.liferay.portal.kernel.exception.SystemException {
183                    try {
184                            Object paramObj0 = new LongWrapper(folderId);
185    
186                            MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
187                                            "deleteFolder", new Object[] { paramObj0 });
188    
189                            try {
190                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
191                            }
192                            catch (Exception e) {
193                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
194                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
195                                    }
196    
197                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
198                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
199                                    }
200    
201                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
202                            }
203                    }
204                    catch (com.liferay.portal.kernel.exception.SystemException se) {
205                            _log.error(se, se);
206    
207                            throw se;
208                    }
209            }
210    
211            public static com.liferay.portlet.imagegallery.model.IGFolder getFolder(
212                    HttpPrincipal httpPrincipal, long folderId)
213                    throws com.liferay.portal.kernel.exception.PortalException,
214                            com.liferay.portal.kernel.exception.SystemException {
215                    try {
216                            Object paramObj0 = new LongWrapper(folderId);
217    
218                            MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
219                                            "getFolder", new Object[] { paramObj0 });
220    
221                            Object returnObj = null;
222    
223                            try {
224                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
225                            }
226                            catch (Exception e) {
227                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
228                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
229                                    }
230    
231                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
232                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
233                                    }
234    
235                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
236                            }
237    
238                            return (com.liferay.portlet.imagegallery.model.IGFolder)returnObj;
239                    }
240                    catch (com.liferay.portal.kernel.exception.SystemException se) {
241                            _log.error(se, se);
242    
243                            throw se;
244                    }
245            }
246    
247            public static com.liferay.portlet.imagegallery.model.IGFolder getFolder(
248                    HttpPrincipal httpPrincipal, long groupId, long parentFolderId,
249                    java.lang.String name)
250                    throws com.liferay.portal.kernel.exception.PortalException,
251                            com.liferay.portal.kernel.exception.SystemException {
252                    try {
253                            Object paramObj0 = new LongWrapper(groupId);
254    
255                            Object paramObj1 = new LongWrapper(parentFolderId);
256    
257                            Object paramObj2 = name;
258    
259                            if (name == null) {
260                                    paramObj2 = new NullWrapper("java.lang.String");
261                            }
262    
263                            MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
264                                            "getFolder",
265                                            new Object[] { paramObj0, paramObj1, paramObj2 });
266    
267                            Object returnObj = null;
268    
269                            try {
270                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
271                            }
272                            catch (Exception e) {
273                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
274                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
275                                    }
276    
277                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
278                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
279                                    }
280    
281                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
282                            }
283    
284                            return (com.liferay.portlet.imagegallery.model.IGFolder)returnObj;
285                    }
286                    catch (com.liferay.portal.kernel.exception.SystemException se) {
287                            _log.error(se, se);
288    
289                            throw se;
290                    }
291            }
292    
293            public static java.util.List<com.liferay.portlet.imagegallery.model.IGFolder> getFolders(
294                    HttpPrincipal httpPrincipal, long groupId, long parentFolderId)
295                    throws com.liferay.portal.kernel.exception.SystemException {
296                    try {
297                            Object paramObj0 = new LongWrapper(groupId);
298    
299                            Object paramObj1 = new LongWrapper(parentFolderId);
300    
301                            MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
302                                            "getFolders", new Object[] { paramObj0, paramObj1 });
303    
304                            Object returnObj = null;
305    
306                            try {
307                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
308                            }
309                            catch (Exception e) {
310                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
311                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
312                                    }
313    
314                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
315                            }
316    
317                            return (java.util.List<com.liferay.portlet.imagegallery.model.IGFolder>)returnObj;
318                    }
319                    catch (com.liferay.portal.kernel.exception.SystemException se) {
320                            _log.error(se, se);
321    
322                            throw se;
323                    }
324            }
325    
326            public static java.util.List<com.liferay.portlet.imagegallery.model.IGFolder> getFolders(
327                    HttpPrincipal httpPrincipal, long groupId, long parentFolderId,
328                    int start, int end)
329                    throws com.liferay.portal.kernel.exception.SystemException {
330                    try {
331                            Object paramObj0 = new LongWrapper(groupId);
332    
333                            Object paramObj1 = new LongWrapper(parentFolderId);
334    
335                            Object paramObj2 = new IntegerWrapper(start);
336    
337                            Object paramObj3 = new IntegerWrapper(end);
338    
339                            MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
340                                            "getFolders",
341                                            new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
342    
343                            Object returnObj = null;
344    
345                            try {
346                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
347                            }
348                            catch (Exception e) {
349                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
350                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
351                                    }
352    
353                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
354                            }
355    
356                            return (java.util.List<com.liferay.portlet.imagegallery.model.IGFolder>)returnObj;
357                    }
358                    catch (com.liferay.portal.kernel.exception.SystemException se) {
359                            _log.error(se, se);
360    
361                            throw se;
362                    }
363            }
364    
365            public static int getFoldersCount(HttpPrincipal httpPrincipal,
366                    long groupId, long parentFolderId)
367                    throws com.liferay.portal.kernel.exception.SystemException {
368                    try {
369                            Object paramObj0 = new LongWrapper(groupId);
370    
371                            Object paramObj1 = new LongWrapper(parentFolderId);
372    
373                            MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
374                                            "getFoldersCount", new Object[] { paramObj0, paramObj1 });
375    
376                            Object returnObj = null;
377    
378                            try {
379                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
380                            }
381                            catch (Exception e) {
382                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
383                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
384                                    }
385    
386                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
387                            }
388    
389                            return ((Integer)returnObj).intValue();
390                    }
391                    catch (com.liferay.portal.kernel.exception.SystemException se) {
392                            _log.error(se, se);
393    
394                            throw se;
395                    }
396            }
397    
398            public static com.liferay.portlet.imagegallery.model.IGFolder updateFolder(
399                    HttpPrincipal httpPrincipal, long folderId, long parentFolderId,
400                    java.lang.String name, java.lang.String description,
401                    boolean mergeWithParentFolder,
402                    com.liferay.portal.service.ServiceContext serviceContext)
403                    throws com.liferay.portal.kernel.exception.PortalException,
404                            com.liferay.portal.kernel.exception.SystemException {
405                    try {
406                            Object paramObj0 = new LongWrapper(folderId);
407    
408                            Object paramObj1 = new LongWrapper(parentFolderId);
409    
410                            Object paramObj2 = name;
411    
412                            if (name == null) {
413                                    paramObj2 = new NullWrapper("java.lang.String");
414                            }
415    
416                            Object paramObj3 = description;
417    
418                            if (description == null) {
419                                    paramObj3 = new NullWrapper("java.lang.String");
420                            }
421    
422                            Object paramObj4 = new BooleanWrapper(mergeWithParentFolder);
423    
424                            Object paramObj5 = serviceContext;
425    
426                            if (serviceContext == null) {
427                                    paramObj5 = new NullWrapper(
428                                                    "com.liferay.portal.service.ServiceContext");
429                            }
430    
431                            MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
432                                            "updateFolder",
433                                            new Object[] {
434                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
435                                                    paramObj5
436                                            });
437    
438                            Object returnObj = null;
439    
440                            try {
441                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
442                            }
443                            catch (Exception e) {
444                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
445                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
446                                    }
447    
448                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
449                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
450                                    }
451    
452                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
453                            }
454    
455                            return (com.liferay.portlet.imagegallery.model.IGFolder)returnObj;
456                    }
457                    catch (com.liferay.portal.kernel.exception.SystemException se) {
458                            _log.error(se, se);
459    
460                            throw se;
461                    }
462            }
463    
464            private static Log _log = LogFactoryUtil.getLog(IGFolderServiceHttp.class);
465    }