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 plid, long parentFolderId,
76          java.lang.String name, java.lang.String description,
77          boolean addCommunityPermissions, boolean addGuestPermissions)
78          throws com.liferay.portal.PortalException,
79              com.liferay.portal.SystemException {
80          try {
81              Object paramObj0 = new LongWrapper(plid);
82  
83              Object paramObj1 = new LongWrapper(parentFolderId);
84  
85              Object paramObj2 = name;
86  
87              if (name == null) {
88                  paramObj2 = new NullWrapper("java.lang.String");
89              }
90  
91              Object paramObj3 = description;
92  
93              if (description == null) {
94                  paramObj3 = new NullWrapper("java.lang.String");
95              }
96  
97              Object paramObj4 = new BooleanWrapper(addCommunityPermissions);
98  
99              Object paramObj5 = new BooleanWrapper(addGuestPermissions);
100 
101             MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
102                     "addFolder",
103                     new Object[] {
104                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
105                         paramObj5
106                     });
107 
108             Object returnObj = null;
109 
110             try {
111                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
112             }
113             catch (Exception e) {
114                 if (e instanceof com.liferay.portal.PortalException) {
115                     throw (com.liferay.portal.PortalException)e;
116                 }
117 
118                 if (e instanceof com.liferay.portal.SystemException) {
119                     throw (com.liferay.portal.SystemException)e;
120                 }
121 
122                 throw new com.liferay.portal.SystemException(e);
123             }
124 
125             return (com.liferay.portlet.imagegallery.model.IGFolder)returnObj;
126         }
127         catch (com.liferay.portal.SystemException se) {
128             _log.error(se, se);
129 
130             throw se;
131         }
132     }
133 
134     public static com.liferay.portlet.imagegallery.model.IGFolder addFolder(
135         HttpPrincipal httpPrincipal, long plid, long parentFolderId,
136         java.lang.String name, java.lang.String description,
137         java.lang.String[] communityPermissions,
138         java.lang.String[] guestPermissions)
139         throws com.liferay.portal.PortalException,
140             com.liferay.portal.SystemException {
141         try {
142             Object paramObj0 = new LongWrapper(plid);
143 
144             Object paramObj1 = new LongWrapper(parentFolderId);
145 
146             Object paramObj2 = name;
147 
148             if (name == null) {
149                 paramObj2 = new NullWrapper("java.lang.String");
150             }
151 
152             Object paramObj3 = description;
153 
154             if (description == null) {
155                 paramObj3 = new NullWrapper("java.lang.String");
156             }
157 
158             Object paramObj4 = communityPermissions;
159 
160             if (communityPermissions == null) {
161                 paramObj4 = new NullWrapper("[Ljava.lang.String;");
162             }
163 
164             Object paramObj5 = guestPermissions;
165 
166             if (guestPermissions == null) {
167                 paramObj5 = new NullWrapper("[Ljava.lang.String;");
168             }
169 
170             MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
171                     "addFolder",
172                     new Object[] {
173                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
174                         paramObj5
175                     });
176 
177             Object returnObj = null;
178 
179             try {
180                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
181             }
182             catch (Exception e) {
183                 if (e instanceof com.liferay.portal.PortalException) {
184                     throw (com.liferay.portal.PortalException)e;
185                 }
186 
187                 if (e instanceof com.liferay.portal.SystemException) {
188                     throw (com.liferay.portal.SystemException)e;
189                 }
190 
191                 throw new com.liferay.portal.SystemException(e);
192             }
193 
194             return (com.liferay.portlet.imagegallery.model.IGFolder)returnObj;
195         }
196         catch (com.liferay.portal.SystemException se) {
197             _log.error(se, se);
198 
199             throw se;
200         }
201     }
202 
203     public static com.liferay.portlet.imagegallery.model.IGFolder copyFolder(
204         HttpPrincipal httpPrincipal, long plid, long sourceFolderId,
205         long parentFolderId, java.lang.String name,
206         java.lang.String description, boolean addCommunityPermissions,
207         boolean addGuestPermissions)
208         throws com.liferay.portal.PortalException,
209             com.liferay.portal.SystemException, java.rmi.RemoteException {
210         try {
211             Object paramObj0 = new LongWrapper(plid);
212 
213             Object paramObj1 = new LongWrapper(sourceFolderId);
214 
215             Object paramObj2 = new LongWrapper(parentFolderId);
216 
217             Object paramObj3 = name;
218 
219             if (name == null) {
220                 paramObj3 = new NullWrapper("java.lang.String");
221             }
222 
223             Object paramObj4 = description;
224 
225             if (description == null) {
226                 paramObj4 = new NullWrapper("java.lang.String");
227             }
228 
229             Object paramObj5 = new BooleanWrapper(addCommunityPermissions);
230 
231             Object paramObj6 = new BooleanWrapper(addGuestPermissions);
232 
233             MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
234                     "copyFolder",
235                     new Object[] {
236                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
237                         paramObj5, paramObj6
238                     });
239 
240             Object returnObj = null;
241 
242             try {
243                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
244             }
245             catch (Exception e) {
246                 if (e instanceof com.liferay.portal.PortalException) {
247                     throw (com.liferay.portal.PortalException)e;
248                 }
249 
250                 if (e instanceof com.liferay.portal.SystemException) {
251                     throw (com.liferay.portal.SystemException)e;
252                 }
253 
254                 if (e instanceof java.rmi.RemoteException) {
255                     throw (java.rmi.RemoteException)e;
256                 }
257 
258                 throw new com.liferay.portal.SystemException(e);
259             }
260 
261             return (com.liferay.portlet.imagegallery.model.IGFolder)returnObj;
262         }
263         catch (com.liferay.portal.SystemException se) {
264             _log.error(se, se);
265 
266             throw se;
267         }
268     }
269 
270     public static void deleteFolder(HttpPrincipal httpPrincipal, long folderId)
271         throws com.liferay.portal.PortalException,
272             com.liferay.portal.SystemException {
273         try {
274             Object paramObj0 = new LongWrapper(folderId);
275 
276             MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
277                     "deleteFolder", new Object[] { paramObj0 });
278 
279             try {
280                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
281             }
282             catch (Exception e) {
283                 if (e instanceof com.liferay.portal.PortalException) {
284                     throw (com.liferay.portal.PortalException)e;
285                 }
286 
287                 if (e instanceof com.liferay.portal.SystemException) {
288                     throw (com.liferay.portal.SystemException)e;
289                 }
290 
291                 throw new com.liferay.portal.SystemException(e);
292             }
293         }
294         catch (com.liferay.portal.SystemException se) {
295             _log.error(se, se);
296 
297             throw se;
298         }
299     }
300 
301     public static com.liferay.portlet.imagegallery.model.IGFolder getFolder(
302         HttpPrincipal httpPrincipal, long folderId)
303         throws com.liferay.portal.PortalException,
304             com.liferay.portal.SystemException {
305         try {
306             Object paramObj0 = new LongWrapper(folderId);
307 
308             MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
309                     "getFolder", new Object[] { paramObj0 });
310 
311             Object returnObj = null;
312 
313             try {
314                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
315             }
316             catch (Exception e) {
317                 if (e instanceof com.liferay.portal.PortalException) {
318                     throw (com.liferay.portal.PortalException)e;
319                 }
320 
321                 if (e instanceof com.liferay.portal.SystemException) {
322                     throw (com.liferay.portal.SystemException)e;
323                 }
324 
325                 throw new com.liferay.portal.SystemException(e);
326             }
327 
328             return (com.liferay.portlet.imagegallery.model.IGFolder)returnObj;
329         }
330         catch (com.liferay.portal.SystemException se) {
331             _log.error(se, se);
332 
333             throw se;
334         }
335     }
336 
337     public static com.liferay.portlet.imagegallery.model.IGFolder getFolder(
338         HttpPrincipal httpPrincipal, long groupId, long parentFolderId,
339         java.lang.String name)
340         throws com.liferay.portal.PortalException,
341             com.liferay.portal.SystemException {
342         try {
343             Object paramObj0 = new LongWrapper(groupId);
344 
345             Object paramObj1 = new LongWrapper(parentFolderId);
346 
347             Object paramObj2 = name;
348 
349             if (name == null) {
350                 paramObj2 = new NullWrapper("java.lang.String");
351             }
352 
353             MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
354                     "getFolder",
355                     new Object[] { paramObj0, paramObj1, paramObj2 });
356 
357             Object returnObj = null;
358 
359             try {
360                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
361             }
362             catch (Exception e) {
363                 if (e instanceof com.liferay.portal.PortalException) {
364                     throw (com.liferay.portal.PortalException)e;
365                 }
366 
367                 if (e instanceof com.liferay.portal.SystemException) {
368                     throw (com.liferay.portal.SystemException)e;
369                 }
370 
371                 throw new com.liferay.portal.SystemException(e);
372             }
373 
374             return (com.liferay.portlet.imagegallery.model.IGFolder)returnObj;
375         }
376         catch (com.liferay.portal.SystemException se) {
377             _log.error(se, se);
378 
379             throw se;
380         }
381     }
382 
383     public static java.util.List<com.liferay.portlet.imagegallery.model.IGFolder> getFolders(
384         HttpPrincipal httpPrincipal, long groupId, long parentFolderId)
385         throws com.liferay.portal.PortalException,
386             com.liferay.portal.SystemException {
387         try {
388             Object paramObj0 = new LongWrapper(groupId);
389 
390             Object paramObj1 = new LongWrapper(parentFolderId);
391 
392             MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
393                     "getFolders", new Object[] { paramObj0, paramObj1 });
394 
395             Object returnObj = null;
396 
397             try {
398                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
399             }
400             catch (Exception e) {
401                 if (e instanceof com.liferay.portal.PortalException) {
402                     throw (com.liferay.portal.PortalException)e;
403                 }
404 
405                 if (e instanceof com.liferay.portal.SystemException) {
406                     throw (com.liferay.portal.SystemException)e;
407                 }
408 
409                 throw new com.liferay.portal.SystemException(e);
410             }
411 
412             return (java.util.List<com.liferay.portlet.imagegallery.model.IGFolder>)returnObj;
413         }
414         catch (com.liferay.portal.SystemException se) {
415             _log.error(se, se);
416 
417             throw se;
418         }
419     }
420 
421     public static com.liferay.portlet.imagegallery.model.IGFolder updateFolder(
422         HttpPrincipal httpPrincipal, long folderId, long parentFolderId,
423         java.lang.String name, java.lang.String description,
424         boolean mergeWithParentFolder)
425         throws com.liferay.portal.PortalException,
426             com.liferay.portal.SystemException {
427         try {
428             Object paramObj0 = new LongWrapper(folderId);
429 
430             Object paramObj1 = new LongWrapper(parentFolderId);
431 
432             Object paramObj2 = name;
433 
434             if (name == null) {
435                 paramObj2 = new NullWrapper("java.lang.String");
436             }
437 
438             Object paramObj3 = description;
439 
440             if (description == null) {
441                 paramObj3 = new NullWrapper("java.lang.String");
442             }
443 
444             Object paramObj4 = new BooleanWrapper(mergeWithParentFolder);
445 
446             MethodWrapper methodWrapper = new MethodWrapper(IGFolderServiceUtil.class.getName(),
447                     "updateFolder",
448                     new Object[] {
449                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
450                     });
451 
452             Object returnObj = null;
453 
454             try {
455                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
456             }
457             catch (Exception e) {
458                 if (e instanceof com.liferay.portal.PortalException) {
459                     throw (com.liferay.portal.PortalException)e;
460                 }
461 
462                 if (e instanceof com.liferay.portal.SystemException) {
463                     throw (com.liferay.portal.SystemException)e;
464                 }
465 
466                 throw new com.liferay.portal.SystemException(e);
467             }
468 
469             return (com.liferay.portlet.imagegallery.model.IGFolder)returnObj;
470         }
471         catch (com.liferay.portal.SystemException se) {
472             _log.error(se, se);
473 
474             throw se;
475         }
476     }
477 
478     private static Log _log = LogFactoryUtil.getLog(IGFolderServiceHttp.class);
479 }