1   /**
2    * Copyright (c) 2000-2009 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   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portlet.imagegallery.service.http;
21  
22  import com.liferay.portal.kernel.log.Log;
23  import com.liferay.portal.kernel.log.LogFactoryUtil;
24  import com.liferay.portal.kernel.util.BooleanWrapper;
25  import com.liferay.portal.kernel.util.LongWrapper;
26  import com.liferay.portal.kernel.util.MethodWrapper;
27  import com.liferay.portal.kernel.util.NullWrapper;
28  import com.liferay.portal.security.auth.HttpPrincipal;
29  import com.liferay.portal.service.http.TunnelUtil;
30  
31  import com.liferay.portlet.imagegallery.service.IGFolderServiceUtil;
32  
33  /**
34   * <a href="IGFolderServiceHttp.java.html"><b><i>View Source</i></b></a>
35   *
36   * <p>
37   * ServiceBuilder generated this class. Modifications in this class will be
38   * overwritten the next time is generated.
39   * </p>
40   *
41   * <p>
42   * This class provides a HTTP utility for the
43   * <code>com.liferay.portlet.imagegallery.service.IGFolderServiceUtil</code> service
44   * utility. The static methods of this class calls the same methods of the
45   * service utility. However, the signatures are different because it requires an
46   * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code>
47   * parameter.
48   * </p>
49   *
50   * <p>
51   * The benefits of using the HTTP utility is that it is fast and allows for
52   * tunneling without the cost of serializing to text. The drawback is that it
53   * only works with Java.
54   * </p>
55   *
56   * <p>
57   * Set the property <code>tunnel.servlet.hosts.allowed</code> in
58   * portal.properties to configure security.
59   * </p>
60   *
61   * <p>
62   * The HTTP utility is only generated for remote services.
63   * </p>
64   *
65   * @author Brian Wing Shun Chan
66   *
67   * @see com.liferay.portal.security.auth.HttpPrincipal
68   * @see com.liferay.portlet.imagegallery.service.IGFolderServiceUtil
69   * @see com.liferay.portlet.imagegallery.service.http.IGFolderServiceSoap
70   *
71   */
72  public class IGFolderServiceHttp {
73      public static com.liferay.portlet.imagegallery.model.IGFolder addFolder(
74          HttpPrincipal httpPrincipal, long parentFolderId,
75          java.lang.String name, java.lang.String description,
76          com.liferay.portal.service.ServiceContext serviceContext)
77          throws com.liferay.portal.PortalException,
78              com.liferay.portal.SystemException {
79          try {
80              Object paramObj0 = new LongWrapper(parentFolderId);
81  
82              Object paramObj1 = name;
83  
84              if (name == null) {
85                  paramObj1 = new NullWrapper("java.lang.String");
86              }
87  
88              Object paramObj2 = description;
89  
90              if (description == null) {
91                  paramObj2 = new NullWrapper("java.lang.String");
92              }
93  
94              Object paramObj3 = serviceContext;
95  
96              if (serviceContext == null) {
97                  paramObj3 = new NullWrapper(
98                          "com.liferay.portal.service.ServiceContext");
99              }
100 
101             MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
102                     "addFolder",
103                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
104 
105             Object returnObj = null;
106 
107             try {
108                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
109             }
110             catch (Exception e) {
111                 if (e instanceof com.liferay.portal.PortalException) {
112                     throw (com.liferay.portal.PortalException)e;
113                 }
114 
115                 if (e instanceof com.liferay.portal.SystemException) {
116                     throw (com.liferay.portal.SystemException)e;
117                 }
118 
119                 throw new com.liferay.portal.SystemException(e);
120             }
121 
122             return (com.liferay.portlet.imagegallery.model.IGFolder)returnObj;
123         }
124         catch (com.liferay.portal.SystemException se) {
125             _log.error(se, se);
126 
127             throw se;
128         }
129     }
130 
131     public static com.liferay.portlet.imagegallery.model.IGFolder copyFolder(
132         HttpPrincipal httpPrincipal, long sourceFolderId, long parentFolderId,
133         java.lang.String name, java.lang.String description,
134         com.liferay.portal.service.ServiceContext serviceContext)
135         throws com.liferay.portal.PortalException,
136             com.liferay.portal.SystemException {
137         try {
138             Object paramObj0 = new LongWrapper(sourceFolderId);
139 
140             Object paramObj1 = new LongWrapper(parentFolderId);
141 
142             Object paramObj2 = name;
143 
144             if (name == null) {
145                 paramObj2 = new NullWrapper("java.lang.String");
146             }
147 
148             Object paramObj3 = description;
149 
150             if (description == null) {
151                 paramObj3 = new NullWrapper("java.lang.String");
152             }
153 
154             Object paramObj4 = serviceContext;
155 
156             if (serviceContext == null) {
157                 paramObj4 = new NullWrapper(
158                         "com.liferay.portal.service.ServiceContext");
159             }
160 
161             MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
162                     "copyFolder",
163                     new Object[] {
164                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
165                     });
166 
167             Object returnObj = null;
168 
169             try {
170                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
171             }
172             catch (Exception e) {
173                 if (e instanceof com.liferay.portal.PortalException) {
174                     throw (com.liferay.portal.PortalException)e;
175                 }
176 
177                 if (e instanceof com.liferay.portal.SystemException) {
178                     throw (com.liferay.portal.SystemException)e;
179                 }
180 
181                 throw new com.liferay.portal.SystemException(e);
182             }
183 
184             return (com.liferay.portlet.imagegallery.model.IGFolder)returnObj;
185         }
186         catch (com.liferay.portal.SystemException se) {
187             _log.error(se, se);
188 
189             throw se;
190         }
191     }
192 
193     public static void deleteFolder(HttpPrincipal httpPrincipal, long folderId)
194         throws com.liferay.portal.PortalException,
195             com.liferay.portal.SystemException {
196         try {
197             Object paramObj0 = new LongWrapper(folderId);
198 
199             MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
200                     "deleteFolder", new Object[] { paramObj0 });
201 
202             try {
203                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
204             }
205             catch (Exception e) {
206                 if (e instanceof com.liferay.portal.PortalException) {
207                     throw (com.liferay.portal.PortalException)e;
208                 }
209 
210                 if (e instanceof com.liferay.portal.SystemException) {
211                     throw (com.liferay.portal.SystemException)e;
212                 }
213 
214                 throw new com.liferay.portal.SystemException(e);
215             }
216         }
217         catch (com.liferay.portal.SystemException se) {
218             _log.error(se, se);
219 
220             throw se;
221         }
222     }
223 
224     public static com.liferay.portlet.imagegallery.model.IGFolder getFolder(
225         HttpPrincipal httpPrincipal, long folderId)
226         throws com.liferay.portal.PortalException,
227             com.liferay.portal.SystemException {
228         try {
229             Object paramObj0 = new LongWrapper(folderId);
230 
231             MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
232                     "getFolder", new Object[] { paramObj0 });
233 
234             Object returnObj = null;
235 
236             try {
237                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
238             }
239             catch (Exception e) {
240                 if (e instanceof com.liferay.portal.PortalException) {
241                     throw (com.liferay.portal.PortalException)e;
242                 }
243 
244                 if (e instanceof com.liferay.portal.SystemException) {
245                     throw (com.liferay.portal.SystemException)e;
246                 }
247 
248                 throw new com.liferay.portal.SystemException(e);
249             }
250 
251             return (com.liferay.portlet.imagegallery.model.IGFolder)returnObj;
252         }
253         catch (com.liferay.portal.SystemException se) {
254             _log.error(se, se);
255 
256             throw se;
257         }
258     }
259 
260     public static com.liferay.portlet.imagegallery.model.IGFolder getFolder(
261         HttpPrincipal httpPrincipal, long groupId, long parentFolderId,
262         java.lang.String name)
263         throws com.liferay.portal.PortalException,
264             com.liferay.portal.SystemException {
265         try {
266             Object paramObj0 = new LongWrapper(groupId);
267 
268             Object paramObj1 = new LongWrapper(parentFolderId);
269 
270             Object paramObj2 = name;
271 
272             if (name == null) {
273                 paramObj2 = new NullWrapper("java.lang.String");
274             }
275 
276             MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
277                     "getFolder",
278                     new Object[] { paramObj0, paramObj1, paramObj2 });
279 
280             Object returnObj = null;
281 
282             try {
283                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
284             }
285             catch (Exception e) {
286                 if (e instanceof com.liferay.portal.PortalException) {
287                     throw (com.liferay.portal.PortalException)e;
288                 }
289 
290                 if (e instanceof com.liferay.portal.SystemException) {
291                     throw (com.liferay.portal.SystemException)e;
292                 }
293 
294                 throw new com.liferay.portal.SystemException(e);
295             }
296 
297             return (com.liferay.portlet.imagegallery.model.IGFolder)returnObj;
298         }
299         catch (com.liferay.portal.SystemException se) {
300             _log.error(se, se);
301 
302             throw se;
303         }
304     }
305 
306     public static java.util.List<com.liferay.portlet.imagegallery.model.IGFolder> getFolders(
307         HttpPrincipal httpPrincipal, long groupId, long parentFolderId)
308         throws com.liferay.portal.PortalException,
309             com.liferay.portal.SystemException {
310         try {
311             Object paramObj0 = new LongWrapper(groupId);
312 
313             Object paramObj1 = new LongWrapper(parentFolderId);
314 
315             MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
316                     "getFolders", new Object[] { paramObj0, paramObj1 });
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 (java.util.List<com.liferay.portlet.imagegallery.model.IGFolder>)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.IGFolder updateFolder(
345         HttpPrincipal httpPrincipal, long folderId, long parentFolderId,
346         java.lang.String name, java.lang.String description,
347         boolean mergeWithParentFolder,
348         com.liferay.portal.service.ServiceContext serviceContext)
349         throws com.liferay.portal.PortalException,
350             com.liferay.portal.SystemException {
351         try {
352             Object paramObj0 = new LongWrapper(folderId);
353 
354             Object paramObj1 = new LongWrapper(parentFolderId);
355 
356             Object paramObj2 = name;
357 
358             if (name == null) {
359                 paramObj2 = new NullWrapper("java.lang.String");
360             }
361 
362             Object paramObj3 = description;
363 
364             if (description == null) {
365                 paramObj3 = new NullWrapper("java.lang.String");
366             }
367 
368             Object paramObj4 = new BooleanWrapper(mergeWithParentFolder);
369 
370             Object paramObj5 = serviceContext;
371 
372             if (serviceContext == null) {
373                 paramObj5 = new NullWrapper(
374                         "com.liferay.portal.service.ServiceContext");
375             }
376 
377             MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
378                     "updateFolder",
379                     new Object[] {
380                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
381                         paramObj5
382                     });
383 
384             Object returnObj = null;
385 
386             try {
387                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
388             }
389             catch (Exception e) {
390                 if (e instanceof com.liferay.portal.PortalException) {
391                     throw (com.liferay.portal.PortalException)e;
392                 }
393 
394                 if (e instanceof com.liferay.portal.SystemException) {
395                     throw (com.liferay.portal.SystemException)e;
396                 }
397 
398                 throw new com.liferay.portal.SystemException(e);
399             }
400 
401             return (com.liferay.portlet.imagegallery.model.IGFolder)returnObj;
402         }
403         catch (com.liferay.portal.SystemException se) {
404             _log.error(se, se);
405 
406             throw se;
407         }
408     }
409 
410     private static Log _log = LogFactoryUtil.getLog(IGFolderServiceHttp.class);
411 }