1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
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.LongWrapper;
20  import com.liferay.portal.kernel.util.MethodWrapper;
21  import com.liferay.portal.kernel.util.NullWrapper;
22  import com.liferay.portal.security.auth.HttpPrincipal;
23  import com.liferay.portal.service.http.TunnelUtil;
24  
25  import com.liferay.portlet.documentlibrary.service.DLFileShortcutServiceUtil;
26  
27  /**
28   * <a href="DLFileShortcutServiceHttp.java.html"><b><i>View Source</i></b></a>
29   *
30   * <p>
31   * ServiceBuilder generated this class. Modifications in this class will be
32   * overwritten the next time is generated.
33   * </p>
34   *
35   * <p>
36   * This class provides a HTTP utility for the
37   * {@link com.liferay.portlet.documentlibrary.service.DLFileShortcutServiceUtil} service utility. The
38   * static methods of this class calls the same methods of the service utility.
39   * However, the signatures are different because it requires an additional
40   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
41   * </p>
42   *
43   * <p>
44   * The benefits of using the HTTP utility is that it is fast and allows for
45   * tunneling without the cost of serializing to text. The drawback is that it
46   * only works with Java.
47   * </p>
48   *
49   * <p>
50   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
51   * configure security.
52   * </p>
53   *
54   * <p>
55   * The HTTP utility is only generated for remote services.
56   * </p>
57   *
58   * @author    Brian Wing Shun Chan
59   * @see       DLFileShortcutServiceSoap
60   * @see       com.liferay.portal.security.auth.HttpPrincipal
61   * @see       com.liferay.portlet.documentlibrary.service.DLFileShortcutServiceUtil
62   * @generated
63   */
64  public class DLFileShortcutServiceHttp {
65      public static com.liferay.portlet.documentlibrary.model.DLFileShortcut addFileShortcut(
66          HttpPrincipal httpPrincipal, long groupId, long folderId,
67          long toFolderId, java.lang.String toName,
68          com.liferay.portal.service.ServiceContext serviceContext)
69          throws com.liferay.portal.kernel.exception.PortalException,
70              com.liferay.portal.kernel.exception.SystemException {
71          try {
72              Object paramObj0 = new LongWrapper(groupId);
73  
74              Object paramObj1 = new LongWrapper(folderId);
75  
76              Object paramObj2 = new LongWrapper(toFolderId);
77  
78              Object paramObj3 = toName;
79  
80              if (toName == null) {
81                  paramObj3 = new NullWrapper("java.lang.String");
82              }
83  
84              Object paramObj4 = serviceContext;
85  
86              if (serviceContext == null) {
87                  paramObj4 = new NullWrapper(
88                          "com.liferay.portal.service.ServiceContext");
89              }
90  
91              MethodWrapper methodWrapper = new MethodWrapper(DLFileShortcutServiceUtil.class.getName(),
92                      "addFileShortcut",
93                      new Object[] {
94                          paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
95                      });
96  
97              Object returnObj = null;
98  
99              try {
100                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
101             }
102             catch (Exception e) {
103                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
104                     throw (com.liferay.portal.kernel.exception.PortalException)e;
105                 }
106 
107                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
108                     throw (com.liferay.portal.kernel.exception.SystemException)e;
109                 }
110 
111                 throw new com.liferay.portal.kernel.exception.SystemException(e);
112             }
113 
114             return (com.liferay.portlet.documentlibrary.model.DLFileShortcut)returnObj;
115         }
116         catch (com.liferay.portal.kernel.exception.SystemException se) {
117             _log.error(se, se);
118 
119             throw se;
120         }
121     }
122 
123     public static void deleteFileShortcut(HttpPrincipal httpPrincipal,
124         long fileShortcutId)
125         throws com.liferay.portal.kernel.exception.PortalException,
126             com.liferay.portal.kernel.exception.SystemException {
127         try {
128             Object paramObj0 = new LongWrapper(fileShortcutId);
129 
130             MethodWrapper methodWrapper = new MethodWrapper(DLFileShortcutServiceUtil.class.getName(),
131                     "deleteFileShortcut", new Object[] { paramObj0 });
132 
133             try {
134                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
135             }
136             catch (Exception e) {
137                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
138                     throw (com.liferay.portal.kernel.exception.PortalException)e;
139                 }
140 
141                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
142                     throw (com.liferay.portal.kernel.exception.SystemException)e;
143                 }
144 
145                 throw new com.liferay.portal.kernel.exception.SystemException(e);
146             }
147         }
148         catch (com.liferay.portal.kernel.exception.SystemException se) {
149             _log.error(se, se);
150 
151             throw se;
152         }
153     }
154 
155     public static com.liferay.portlet.documentlibrary.model.DLFileShortcut getFileShortcut(
156         HttpPrincipal httpPrincipal, long fileShortcutId)
157         throws com.liferay.portal.kernel.exception.PortalException,
158             com.liferay.portal.kernel.exception.SystemException {
159         try {
160             Object paramObj0 = new LongWrapper(fileShortcutId);
161 
162             MethodWrapper methodWrapper = new MethodWrapper(DLFileShortcutServiceUtil.class.getName(),
163                     "getFileShortcut", new Object[] { paramObj0 });
164 
165             Object returnObj = null;
166 
167             try {
168                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
169             }
170             catch (Exception e) {
171                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
172                     throw (com.liferay.portal.kernel.exception.PortalException)e;
173                 }
174 
175                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
176                     throw (com.liferay.portal.kernel.exception.SystemException)e;
177                 }
178 
179                 throw new com.liferay.portal.kernel.exception.SystemException(e);
180             }
181 
182             return (com.liferay.portlet.documentlibrary.model.DLFileShortcut)returnObj;
183         }
184         catch (com.liferay.portal.kernel.exception.SystemException se) {
185             _log.error(se, se);
186 
187             throw se;
188         }
189     }
190 
191     public static com.liferay.portlet.documentlibrary.model.DLFileShortcut updateFileShortcut(
192         HttpPrincipal httpPrincipal, long fileShortcutId, long folderId,
193         long toFolderId, java.lang.String toName,
194         com.liferay.portal.service.ServiceContext serviceContext)
195         throws com.liferay.portal.kernel.exception.PortalException,
196             com.liferay.portal.kernel.exception.SystemException {
197         try {
198             Object paramObj0 = new LongWrapper(fileShortcutId);
199 
200             Object paramObj1 = new LongWrapper(folderId);
201 
202             Object paramObj2 = new LongWrapper(toFolderId);
203 
204             Object paramObj3 = toName;
205 
206             if (toName == null) {
207                 paramObj3 = new NullWrapper("java.lang.String");
208             }
209 
210             Object paramObj4 = serviceContext;
211 
212             if (serviceContext == null) {
213                 paramObj4 = new NullWrapper(
214                         "com.liferay.portal.service.ServiceContext");
215             }
216 
217             MethodWrapper methodWrapper = new MethodWrapper(DLFileShortcutServiceUtil.class.getName(),
218                     "updateFileShortcut",
219                     new Object[] {
220                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
221                     });
222 
223             Object returnObj = null;
224 
225             try {
226                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
227             }
228             catch (Exception e) {
229                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
230                     throw (com.liferay.portal.kernel.exception.PortalException)e;
231                 }
232 
233                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
234                     throw (com.liferay.portal.kernel.exception.SystemException)e;
235                 }
236 
237                 throw new com.liferay.portal.kernel.exception.SystemException(e);
238             }
239 
240             return (com.liferay.portlet.documentlibrary.model.DLFileShortcut)returnObj;
241         }
242         catch (com.liferay.portal.kernel.exception.SystemException se) {
243             _log.error(se, se);
244 
245             throw se;
246         }
247     }
248 
249     private static Log _log = LogFactoryUtil.getLog(DLFileShortcutServiceHttp.class);
250 }