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.documentlibrary.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.documentlibrary.service.DLFileShortcutServiceUtil;
35  
36  /**
37   * <a href="DLFileShortcutServiceHttp.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.documentlibrary.service.DLFileShortcutServiceUtil} 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       DLFileShortcutServiceSoap
69   * @see       com.liferay.portal.security.auth.HttpPrincipal
70   * @see       com.liferay.portlet.documentlibrary.service.DLFileShortcutServiceUtil
71   * @generated
72   */
73  public class DLFileShortcutServiceHttp {
74      public static com.liferay.portlet.documentlibrary.model.DLFileShortcut addFileShortcut(
75          HttpPrincipal httpPrincipal, long folderId, long toFolderId,
76          java.lang.String toName, boolean addCommunityPermissions,
77          boolean addGuestPermissions)
78          throws com.liferay.portal.PortalException,
79              com.liferay.portal.SystemException {
80          try {
81              Object paramObj0 = new LongWrapper(folderId);
82  
83              Object paramObj1 = new LongWrapper(toFolderId);
84  
85              Object paramObj2 = toName;
86  
87              if (toName == null) {
88                  paramObj2 = new NullWrapper("java.lang.String");
89              }
90  
91              Object paramObj3 = new BooleanWrapper(addCommunityPermissions);
92  
93              Object paramObj4 = new BooleanWrapper(addGuestPermissions);
94  
95              MethodWrapper methodWrapper = new MethodWrapper(DLFileShortcutServiceUtil.class.getName(),
96                      "addFileShortcut",
97                      new Object[] {
98                          paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
99                      });
100 
101             Object returnObj = null;
102 
103             try {
104                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
105             }
106             catch (Exception e) {
107                 if (e instanceof com.liferay.portal.PortalException) {
108                     throw (com.liferay.portal.PortalException)e;
109                 }
110 
111                 if (e instanceof com.liferay.portal.SystemException) {
112                     throw (com.liferay.portal.SystemException)e;
113                 }
114 
115                 throw new com.liferay.portal.SystemException(e);
116             }
117 
118             return (com.liferay.portlet.documentlibrary.model.DLFileShortcut)returnObj;
119         }
120         catch (com.liferay.portal.SystemException se) {
121             _log.error(se, se);
122 
123             throw se;
124         }
125     }
126 
127     public static com.liferay.portlet.documentlibrary.model.DLFileShortcut addFileShortcut(
128         HttpPrincipal httpPrincipal, long folderId, long toFolderId,
129         java.lang.String toName,
130         com.liferay.portal.service.ServiceContext serviceContext)
131         throws com.liferay.portal.PortalException,
132             com.liferay.portal.SystemException {
133         try {
134             Object paramObj0 = new LongWrapper(folderId);
135 
136             Object paramObj1 = new LongWrapper(toFolderId);
137 
138             Object paramObj2 = toName;
139 
140             if (toName == null) {
141                 paramObj2 = new NullWrapper("java.lang.String");
142             }
143 
144             Object paramObj3 = serviceContext;
145 
146             if (serviceContext == null) {
147                 paramObj3 = new NullWrapper(
148                         "com.liferay.portal.service.ServiceContext");
149             }
150 
151             MethodWrapper methodWrapper = new MethodWrapper(DLFileShortcutServiceUtil.class.getName(),
152                     "addFileShortcut",
153                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
154 
155             Object returnObj = null;
156 
157             try {
158                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
159             }
160             catch (Exception e) {
161                 if (e instanceof com.liferay.portal.PortalException) {
162                     throw (com.liferay.portal.PortalException)e;
163                 }
164 
165                 if (e instanceof com.liferay.portal.SystemException) {
166                     throw (com.liferay.portal.SystemException)e;
167                 }
168 
169                 throw new com.liferay.portal.SystemException(e);
170             }
171 
172             return (com.liferay.portlet.documentlibrary.model.DLFileShortcut)returnObj;
173         }
174         catch (com.liferay.portal.SystemException se) {
175             _log.error(se, se);
176 
177             throw se;
178         }
179     }
180 
181     public static com.liferay.portlet.documentlibrary.model.DLFileShortcut addFileShortcut(
182         HttpPrincipal httpPrincipal, long folderId, long toFolderId,
183         java.lang.String toName, java.lang.String[] communityPermissions,
184         java.lang.String[] guestPermissions)
185         throws com.liferay.portal.PortalException,
186             com.liferay.portal.SystemException {
187         try {
188             Object paramObj0 = new LongWrapper(folderId);
189 
190             Object paramObj1 = new LongWrapper(toFolderId);
191 
192             Object paramObj2 = toName;
193 
194             if (toName == null) {
195                 paramObj2 = new NullWrapper("java.lang.String");
196             }
197 
198             Object paramObj3 = communityPermissions;
199 
200             if (communityPermissions == null) {
201                 paramObj3 = new NullWrapper("[Ljava.lang.String;");
202             }
203 
204             Object paramObj4 = guestPermissions;
205 
206             if (guestPermissions == null) {
207                 paramObj4 = new NullWrapper("[Ljava.lang.String;");
208             }
209 
210             MethodWrapper methodWrapper = new MethodWrapper(DLFileShortcutServiceUtil.class.getName(),
211                     "addFileShortcut",
212                     new Object[] {
213                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
214                     });
215 
216             Object returnObj = null;
217 
218             try {
219                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
220             }
221             catch (Exception e) {
222                 if (e instanceof com.liferay.portal.PortalException) {
223                     throw (com.liferay.portal.PortalException)e;
224                 }
225 
226                 if (e instanceof com.liferay.portal.SystemException) {
227                     throw (com.liferay.portal.SystemException)e;
228                 }
229 
230                 throw new com.liferay.portal.SystemException(e);
231             }
232 
233             return (com.liferay.portlet.documentlibrary.model.DLFileShortcut)returnObj;
234         }
235         catch (com.liferay.portal.SystemException se) {
236             _log.error(se, se);
237 
238             throw se;
239         }
240     }
241 
242     public static void deleteFileShortcut(HttpPrincipal httpPrincipal,
243         long fileShortcutId)
244         throws com.liferay.portal.PortalException,
245             com.liferay.portal.SystemException {
246         try {
247             Object paramObj0 = new LongWrapper(fileShortcutId);
248 
249             MethodWrapper methodWrapper = new MethodWrapper(DLFileShortcutServiceUtil.class.getName(),
250                     "deleteFileShortcut", new Object[] { paramObj0 });
251 
252             try {
253                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
254             }
255             catch (Exception e) {
256                 if (e instanceof com.liferay.portal.PortalException) {
257                     throw (com.liferay.portal.PortalException)e;
258                 }
259 
260                 if (e instanceof com.liferay.portal.SystemException) {
261                     throw (com.liferay.portal.SystemException)e;
262                 }
263 
264                 throw new com.liferay.portal.SystemException(e);
265             }
266         }
267         catch (com.liferay.portal.SystemException se) {
268             _log.error(se, se);
269 
270             throw se;
271         }
272     }
273 
274     public static com.liferay.portlet.documentlibrary.model.DLFileShortcut getFileShortcut(
275         HttpPrincipal httpPrincipal, long fileShortcutId)
276         throws com.liferay.portal.PortalException,
277             com.liferay.portal.SystemException {
278         try {
279             Object paramObj0 = new LongWrapper(fileShortcutId);
280 
281             MethodWrapper methodWrapper = new MethodWrapper(DLFileShortcutServiceUtil.class.getName(),
282                     "getFileShortcut", new Object[] { paramObj0 });
283 
284             Object returnObj = null;
285 
286             try {
287                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
288             }
289             catch (Exception e) {
290                 if (e instanceof com.liferay.portal.PortalException) {
291                     throw (com.liferay.portal.PortalException)e;
292                 }
293 
294                 if (e instanceof com.liferay.portal.SystemException) {
295                     throw (com.liferay.portal.SystemException)e;
296                 }
297 
298                 throw new com.liferay.portal.SystemException(e);
299             }
300 
301             return (com.liferay.portlet.documentlibrary.model.DLFileShortcut)returnObj;
302         }
303         catch (com.liferay.portal.SystemException se) {
304             _log.error(se, se);
305 
306             throw se;
307         }
308     }
309 
310     public static com.liferay.portlet.documentlibrary.model.DLFileShortcut updateFileShortcut(
311         HttpPrincipal httpPrincipal, long fileShortcutId, long folderId,
312         long toFolderId, java.lang.String toName)
313         throws com.liferay.portal.PortalException,
314             com.liferay.portal.SystemException {
315         try {
316             Object paramObj0 = new LongWrapper(fileShortcutId);
317 
318             Object paramObj1 = new LongWrapper(folderId);
319 
320             Object paramObj2 = new LongWrapper(toFolderId);
321 
322             Object paramObj3 = toName;
323 
324             if (toName == null) {
325                 paramObj3 = new NullWrapper("java.lang.String");
326             }
327 
328             MethodWrapper methodWrapper = new MethodWrapper(DLFileShortcutServiceUtil.class.getName(),
329                     "updateFileShortcut",
330                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
331 
332             Object returnObj = null;
333 
334             try {
335                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
336             }
337             catch (Exception e) {
338                 if (e instanceof com.liferay.portal.PortalException) {
339                     throw (com.liferay.portal.PortalException)e;
340                 }
341 
342                 if (e instanceof com.liferay.portal.SystemException) {
343                     throw (com.liferay.portal.SystemException)e;
344                 }
345 
346                 throw new com.liferay.portal.SystemException(e);
347             }
348 
349             return (com.liferay.portlet.documentlibrary.model.DLFileShortcut)returnObj;
350         }
351         catch (com.liferay.portal.SystemException se) {
352             _log.error(se, se);
353 
354             throw se;
355         }
356     }
357 
358     public static com.liferay.portlet.documentlibrary.model.DLFileShortcut updateFileShortcut(
359         HttpPrincipal httpPrincipal, long fileShortcutId, long folderId,
360         long toFolderId, java.lang.String toName,
361         com.liferay.portal.service.ServiceContext serviceContext)
362         throws com.liferay.portal.PortalException,
363             com.liferay.portal.SystemException {
364         try {
365             Object paramObj0 = new LongWrapper(fileShortcutId);
366 
367             Object paramObj1 = new LongWrapper(folderId);
368 
369             Object paramObj2 = new LongWrapper(toFolderId);
370 
371             Object paramObj3 = toName;
372 
373             if (toName == null) {
374                 paramObj3 = new NullWrapper("java.lang.String");
375             }
376 
377             Object paramObj4 = serviceContext;
378 
379             if (serviceContext == null) {
380                 paramObj4 = new NullWrapper(
381                         "com.liferay.portal.service.ServiceContext");
382             }
383 
384             MethodWrapper methodWrapper = new MethodWrapper(DLFileShortcutServiceUtil.class.getName(),
385                     "updateFileShortcut",
386                     new Object[] {
387                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
388                     });
389 
390             Object returnObj = null;
391 
392             try {
393                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
394             }
395             catch (Exception e) {
396                 if (e instanceof com.liferay.portal.PortalException) {
397                     throw (com.liferay.portal.PortalException)e;
398                 }
399 
400                 if (e instanceof com.liferay.portal.SystemException) {
401                     throw (com.liferay.portal.SystemException)e;
402                 }
403 
404                 throw new com.liferay.portal.SystemException(e);
405             }
406 
407             return (com.liferay.portlet.documentlibrary.model.DLFileShortcut)returnObj;
408         }
409         catch (com.liferay.portal.SystemException se) {
410             _log.error(se, se);
411 
412             throw se;
413         }
414     }
415 
416     private static Log _log = LogFactoryUtil.getLog(DLFileShortcutServiceHttp.class);
417 }