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