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, java.lang.String[] communityPermissions,
130         java.lang.String[] guestPermissions)
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 = communityPermissions;
145 
146             if (communityPermissions == null) {
147                 paramObj3 = new NullWrapper("[Ljava.lang.String;");
148             }
149 
150             Object paramObj4 = guestPermissions;
151 
152             if (guestPermissions == null) {
153                 paramObj4 = new NullWrapper("[Ljava.lang.String;");
154             }
155 
156             MethodWrapper methodWrapper = new MethodWrapper(DLFileShortcutServiceUtil.class.getName(),
157                     "addFileShortcut",
158                     new Object[] {
159                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
160                     });
161 
162             Object returnObj = null;
163 
164             try {
165                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
166             }
167             catch (Exception e) {
168                 if (e instanceof com.liferay.portal.PortalException) {
169                     throw (com.liferay.portal.PortalException)e;
170                 }
171 
172                 if (e instanceof com.liferay.portal.SystemException) {
173                     throw (com.liferay.portal.SystemException)e;
174                 }
175 
176                 throw new com.liferay.portal.SystemException(e);
177             }
178 
179             return (com.liferay.portlet.documentlibrary.model.DLFileShortcut)returnObj;
180         }
181         catch (com.liferay.portal.SystemException se) {
182             _log.error(se, se);
183 
184             throw se;
185         }
186     }
187 
188     public static void deleteFileShortcut(HttpPrincipal httpPrincipal,
189         long fileShortcutId)
190         throws com.liferay.portal.PortalException,
191             com.liferay.portal.SystemException {
192         try {
193             Object paramObj0 = new LongWrapper(fileShortcutId);
194 
195             MethodWrapper methodWrapper = new MethodWrapper(DLFileShortcutServiceUtil.class.getName(),
196                     "deleteFileShortcut", new Object[] { paramObj0 });
197 
198             try {
199                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
200             }
201             catch (Exception e) {
202                 if (e instanceof com.liferay.portal.PortalException) {
203                     throw (com.liferay.portal.PortalException)e;
204                 }
205 
206                 if (e instanceof com.liferay.portal.SystemException) {
207                     throw (com.liferay.portal.SystemException)e;
208                 }
209 
210                 throw new com.liferay.portal.SystemException(e);
211             }
212         }
213         catch (com.liferay.portal.SystemException se) {
214             _log.error(se, se);
215 
216             throw se;
217         }
218     }
219 
220     public static com.liferay.portlet.documentlibrary.model.DLFileShortcut getFileShortcut(
221         HttpPrincipal httpPrincipal, long fileShortcutId)
222         throws com.liferay.portal.PortalException,
223             com.liferay.portal.SystemException {
224         try {
225             Object paramObj0 = new LongWrapper(fileShortcutId);
226 
227             MethodWrapper methodWrapper = new MethodWrapper(DLFileShortcutServiceUtil.class.getName(),
228                     "getFileShortcut", new Object[] { paramObj0 });
229 
230             Object returnObj = null;
231 
232             try {
233                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
234             }
235             catch (Exception e) {
236                 if (e instanceof com.liferay.portal.PortalException) {
237                     throw (com.liferay.portal.PortalException)e;
238                 }
239 
240                 if (e instanceof com.liferay.portal.SystemException) {
241                     throw (com.liferay.portal.SystemException)e;
242                 }
243 
244                 throw new com.liferay.portal.SystemException(e);
245             }
246 
247             return (com.liferay.portlet.documentlibrary.model.DLFileShortcut)returnObj;
248         }
249         catch (com.liferay.portal.SystemException se) {
250             _log.error(se, se);
251 
252             throw se;
253         }
254     }
255 
256     public static com.liferay.portlet.documentlibrary.model.DLFileShortcut updateFileShortcut(
257         HttpPrincipal httpPrincipal, long fileShortcutId, long folderId,
258         long toFolderId, java.lang.String toName)
259         throws com.liferay.portal.PortalException,
260             com.liferay.portal.SystemException {
261         try {
262             Object paramObj0 = new LongWrapper(fileShortcutId);
263 
264             Object paramObj1 = new LongWrapper(folderId);
265 
266             Object paramObj2 = new LongWrapper(toFolderId);
267 
268             Object paramObj3 = toName;
269 
270             if (toName == null) {
271                 paramObj3 = new NullWrapper("java.lang.String");
272             }
273 
274             MethodWrapper methodWrapper = new MethodWrapper(DLFileShortcutServiceUtil.class.getName(),
275                     "updateFileShortcut",
276                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
277 
278             Object returnObj = null;
279 
280             try {
281                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
282             }
283             catch (Exception e) {
284                 if (e instanceof com.liferay.portal.PortalException) {
285                     throw (com.liferay.portal.PortalException)e;
286                 }
287 
288                 if (e instanceof com.liferay.portal.SystemException) {
289                     throw (com.liferay.portal.SystemException)e;
290                 }
291 
292                 throw new com.liferay.portal.SystemException(e);
293             }
294 
295             return (com.liferay.portlet.documentlibrary.model.DLFileShortcut)returnObj;
296         }
297         catch (com.liferay.portal.SystemException se) {
298             _log.error(se, se);
299 
300             throw se;
301         }
302     }
303 
304     private static Log _log = LogFactoryUtil.getLog(DLFileShortcutServiceHttp.class);
305 }