1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portlet.imagegallery.service.http;
16  
17  import com.liferay.portal.kernel.log.Log;
18  import com.liferay.portal.kernel.log.LogFactoryUtil;
19  import com.liferay.portal.kernel.util.MethodHandler;
20  import com.liferay.portal.kernel.util.MethodKey;
21  import com.liferay.portal.security.auth.HttpPrincipal;
22  import com.liferay.portal.service.http.TunnelUtil;
23  
24  import com.liferay.portlet.imagegallery.service.IGFolderServiceUtil;
25  
26  /**
27   * <a href="IGFolderServiceHttp.java.html"><b><i>View Source</i></b></a>
28   *
29   * <p>
30   * ServiceBuilder generated this class. Modifications in this class will be
31   * overwritten the next time is generated.
32   * </p>
33   *
34   * <p>
35   * This class provides a HTTP utility for the
36   * {@link com.liferay.portlet.imagegallery.service.IGFolderServiceUtil} service utility. The
37   * static methods of this class calls the same methods of the service utility.
38   * However, the signatures are different because it requires an additional
39   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
40   * </p>
41   *
42   * <p>
43   * The benefits of using the HTTP utility is that it is fast and allows for
44   * tunneling without the cost of serializing to text. The drawback is that it
45   * only works with Java.
46   * </p>
47   *
48   * <p>
49   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
50   * configure security.
51   * </p>
52   *
53   * <p>
54   * The HTTP utility is only generated for remote services.
55   * </p>
56   *
57   * @author    Brian Wing Shun Chan
58   * @see       IGFolderServiceSoap
59   * @see       com.liferay.portal.security.auth.HttpPrincipal
60   * @see       com.liferay.portlet.imagegallery.service.IGFolderServiceUtil
61   * @generated
62   */
63  public class IGFolderServiceHttp {
64      public static com.liferay.portlet.imagegallery.model.IGFolder addFolder(
65          HttpPrincipal httpPrincipal, long parentFolderId,
66          java.lang.String name, java.lang.String description,
67          com.liferay.portal.service.ServiceContext serviceContext)
68          throws com.liferay.portal.PortalException,
69              com.liferay.portal.SystemException {
70          try {
71              MethodKey methodKey = new MethodKey(IGFolderServiceUtil.class.getName(),
72                      "addFolder", _addFolderParameterTypes0);
73  
74              MethodHandler methodHandler = new MethodHandler(methodKey,
75                      parentFolderId, name, description, serviceContext);
76  
77              Object returnObj = null;
78  
79              try {
80                  returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
81              }
82              catch (Exception e) {
83                  if (e instanceof com.liferay.portal.PortalException) {
84                      throw (com.liferay.portal.PortalException)e;
85                  }
86  
87                  if (e instanceof com.liferay.portal.SystemException) {
88                      throw (com.liferay.portal.SystemException)e;
89                  }
90  
91                  throw new com.liferay.portal.SystemException(e);
92              }
93  
94              return (com.liferay.portlet.imagegallery.model.IGFolder)returnObj;
95          }
96          catch (com.liferay.portal.SystemException se) {
97              _log.error(se, se);
98  
99              throw se;
100         }
101     }
102 
103     public static com.liferay.portlet.imagegallery.model.IGFolder copyFolder(
104         HttpPrincipal httpPrincipal, long sourceFolderId, long parentFolderId,
105         java.lang.String name, java.lang.String description,
106         com.liferay.portal.service.ServiceContext serviceContext)
107         throws com.liferay.portal.PortalException,
108             com.liferay.portal.SystemException {
109         try {
110             MethodKey methodKey = new MethodKey(IGFolderServiceUtil.class.getName(),
111                     "copyFolder", _copyFolderParameterTypes1);
112 
113             MethodHandler methodHandler = new MethodHandler(methodKey,
114                     sourceFolderId, parentFolderId, name, description,
115                     serviceContext);
116 
117             Object returnObj = null;
118 
119             try {
120                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
121             }
122             catch (Exception e) {
123                 if (e instanceof com.liferay.portal.PortalException) {
124                     throw (com.liferay.portal.PortalException)e;
125                 }
126 
127                 if (e instanceof com.liferay.portal.SystemException) {
128                     throw (com.liferay.portal.SystemException)e;
129                 }
130 
131                 throw new com.liferay.portal.SystemException(e);
132             }
133 
134             return (com.liferay.portlet.imagegallery.model.IGFolder)returnObj;
135         }
136         catch (com.liferay.portal.SystemException se) {
137             _log.error(se, se);
138 
139             throw se;
140         }
141     }
142 
143     public static void deleteFolder(HttpPrincipal httpPrincipal, long folderId)
144         throws com.liferay.portal.PortalException,
145             com.liferay.portal.SystemException {
146         try {
147             MethodKey methodKey = new MethodKey(IGFolderServiceUtil.class.getName(),
148                     "deleteFolder", _deleteFolderParameterTypes2);
149 
150             MethodHandler methodHandler = new MethodHandler(methodKey, folderId);
151 
152             try {
153                 TunnelUtil.invoke(httpPrincipal, methodHandler);
154             }
155             catch (Exception e) {
156                 if (e instanceof com.liferay.portal.PortalException) {
157                     throw (com.liferay.portal.PortalException)e;
158                 }
159 
160                 if (e instanceof com.liferay.portal.SystemException) {
161                     throw (com.liferay.portal.SystemException)e;
162                 }
163 
164                 throw new com.liferay.portal.SystemException(e);
165             }
166         }
167         catch (com.liferay.portal.SystemException se) {
168             _log.error(se, se);
169 
170             throw se;
171         }
172     }
173 
174     public static com.liferay.portlet.imagegallery.model.IGFolder getFolder(
175         HttpPrincipal httpPrincipal, long folderId)
176         throws com.liferay.portal.PortalException,
177             com.liferay.portal.SystemException {
178         try {
179             MethodKey methodKey = new MethodKey(IGFolderServiceUtil.class.getName(),
180                     "getFolder", _getFolderParameterTypes3);
181 
182             MethodHandler methodHandler = new MethodHandler(methodKey, folderId);
183 
184             Object returnObj = null;
185 
186             try {
187                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
188             }
189             catch (Exception e) {
190                 if (e instanceof com.liferay.portal.PortalException) {
191                     throw (com.liferay.portal.PortalException)e;
192                 }
193 
194                 if (e instanceof com.liferay.portal.SystemException) {
195                     throw (com.liferay.portal.SystemException)e;
196                 }
197 
198                 throw new com.liferay.portal.SystemException(e);
199             }
200 
201             return (com.liferay.portlet.imagegallery.model.IGFolder)returnObj;
202         }
203         catch (com.liferay.portal.SystemException se) {
204             _log.error(se, se);
205 
206             throw se;
207         }
208     }
209 
210     public static com.liferay.portlet.imagegallery.model.IGFolder getFolder(
211         HttpPrincipal httpPrincipal, long groupId, long parentFolderId,
212         java.lang.String name)
213         throws com.liferay.portal.PortalException,
214             com.liferay.portal.SystemException {
215         try {
216             MethodKey methodKey = new MethodKey(IGFolderServiceUtil.class.getName(),
217                     "getFolder", _getFolderParameterTypes4);
218 
219             MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
220                     parentFolderId, name);
221 
222             Object returnObj = null;
223 
224             try {
225                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
226             }
227             catch (Exception e) {
228                 if (e instanceof com.liferay.portal.PortalException) {
229                     throw (com.liferay.portal.PortalException)e;
230                 }
231 
232                 if (e instanceof com.liferay.portal.SystemException) {
233                     throw (com.liferay.portal.SystemException)e;
234                 }
235 
236                 throw new com.liferay.portal.SystemException(e);
237             }
238 
239             return (com.liferay.portlet.imagegallery.model.IGFolder)returnObj;
240         }
241         catch (com.liferay.portal.SystemException se) {
242             _log.error(se, se);
243 
244             throw se;
245         }
246     }
247 
248     public static java.util.List<com.liferay.portlet.imagegallery.model.IGFolder> getFolders(
249         HttpPrincipal httpPrincipal, long groupId, long parentFolderId)
250         throws com.liferay.portal.PortalException,
251             com.liferay.portal.SystemException {
252         try {
253             MethodKey methodKey = new MethodKey(IGFolderServiceUtil.class.getName(),
254                     "getFolders", _getFoldersParameterTypes5);
255 
256             MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
257                     parentFolderId);
258 
259             Object returnObj = null;
260 
261             try {
262                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
263             }
264             catch (Exception e) {
265                 if (e instanceof com.liferay.portal.PortalException) {
266                     throw (com.liferay.portal.PortalException)e;
267                 }
268 
269                 if (e instanceof com.liferay.portal.SystemException) {
270                     throw (com.liferay.portal.SystemException)e;
271                 }
272 
273                 throw new com.liferay.portal.SystemException(e);
274             }
275 
276             return (java.util.List<com.liferay.portlet.imagegallery.model.IGFolder>)returnObj;
277         }
278         catch (com.liferay.portal.SystemException se) {
279             _log.error(se, se);
280 
281             throw se;
282         }
283     }
284 
285     public static com.liferay.portlet.imagegallery.model.IGFolder updateFolder(
286         HttpPrincipal httpPrincipal, long folderId, long parentFolderId,
287         java.lang.String name, java.lang.String description,
288         boolean mergeWithParentFolder,
289         com.liferay.portal.service.ServiceContext serviceContext)
290         throws com.liferay.portal.PortalException,
291             com.liferay.portal.SystemException {
292         try {
293             MethodKey methodKey = new MethodKey(IGFolderServiceUtil.class.getName(),
294                     "updateFolder", _updateFolderParameterTypes6);
295 
296             MethodHandler methodHandler = new MethodHandler(methodKey,
297                     folderId, parentFolderId, name, description,
298                     mergeWithParentFolder, serviceContext);
299 
300             Object returnObj = null;
301 
302             try {
303                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
304             }
305             catch (Exception e) {
306                 if (e instanceof com.liferay.portal.PortalException) {
307                     throw (com.liferay.portal.PortalException)e;
308                 }
309 
310                 if (e instanceof com.liferay.portal.SystemException) {
311                     throw (com.liferay.portal.SystemException)e;
312                 }
313 
314                 throw new com.liferay.portal.SystemException(e);
315             }
316 
317             return (com.liferay.portlet.imagegallery.model.IGFolder)returnObj;
318         }
319         catch (com.liferay.portal.SystemException se) {
320             _log.error(se, se);
321 
322             throw se;
323         }
324     }
325 
326     private static Log _log = LogFactoryUtil.getLog(IGFolderServiceHttp.class);
327     private static final Class<?>[] _addFolderParameterTypes0 = new Class[] {
328             long.class, java.lang.String.class, java.lang.String.class,
329             com.liferay.portal.service.ServiceContext.class
330         };
331     private static final Class<?>[] _copyFolderParameterTypes1 = new Class[] {
332             long.class, long.class, java.lang.String.class,
333             java.lang.String.class,
334             com.liferay.portal.service.ServiceContext.class
335         };
336     private static final Class<?>[] _deleteFolderParameterTypes2 = new Class[] {
337             long.class
338         };
339     private static final Class<?>[] _getFolderParameterTypes3 = new Class[] {
340             long.class
341         };
342     private static final Class<?>[] _getFolderParameterTypes4 = new Class[] {
343             long.class, long.class, java.lang.String.class
344         };
345     private static final Class<?>[] _getFoldersParameterTypes5 = new Class[] {
346             long.class, long.class
347         };
348     private static final Class<?>[] _updateFolderParameterTypes6 = new Class[] {
349             long.class, long.class, java.lang.String.class,
350             java.lang.String.class, boolean.class,
351             com.liferay.portal.service.ServiceContext.class
352         };
353 }