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