1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions 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   * <code>com.liferay.portlet.documentlibrary.service.DLFileShortcutServiceUtil</code> service
47   * utility. The static methods of this class calls the same methods of the
48   * service utility. However, the signatures are different because it requires an
49   * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code>
50   * parameter.
51   * </p>
52   *
53   * <p>
54   * The benefits of using the HTTP utility is that it is fast and allows for
55   * tunneling without the cost of serializing to text. The drawback is that it
56   * only works with Java.
57   * </p>
58   *
59   * <p>
60   * Set the property <code>tunnel.servlet.hosts.allowed</code> in
61   * portal.properties to configure security.
62   * </p>
63   *
64   * <p>
65   * The HTTP utility is only generated for remote services.
66   * </p>
67   *
68   * @author Brian Wing Shun Chan
69   *
70   * @see com.liferay.portal.security.auth.HttpPrincipal
71   * @see com.liferay.portlet.documentlibrary.service.DLFileShortcutServiceUtil
72   * @see com.liferay.portlet.documentlibrary.service.http.DLFileShortcutServiceSoap
73   *
74   */
75  public class DLFileShortcutServiceHttp {
76      public static com.liferay.portlet.documentlibrary.model.DLFileShortcut addFileShortcut(
77          HttpPrincipal httpPrincipal, long folderId, long toFolderId,
78          java.lang.String toName, boolean addCommunityPermissions,
79          boolean addGuestPermissions)
80          throws com.liferay.portal.PortalException,
81              com.liferay.portal.SystemException {
82          try {
83              Object paramObj0 = new LongWrapper(folderId);
84  
85              Object paramObj1 = new LongWrapper(toFolderId);
86  
87              Object paramObj2 = toName;
88  
89              if (toName == null) {
90                  paramObj2 = new NullWrapper("java.lang.String");
91              }
92  
93              Object paramObj3 = new BooleanWrapper(addCommunityPermissions);
94  
95              Object paramObj4 = new BooleanWrapper(addGuestPermissions);
96  
97              MethodWrapper methodWrapper = new MethodWrapper(DLFileShortcutServiceUtil.class.getName(),
98                      "addFileShortcut",
99                      new Object[] {
100                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
101                     });
102 
103             Object returnObj = null;
104 
105             try {
106                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
107             }
108             catch (Exception e) {
109                 if (e instanceof com.liferay.portal.PortalException) {
110                     throw (com.liferay.portal.PortalException)e;
111                 }
112 
113                 if (e instanceof com.liferay.portal.SystemException) {
114                     throw (com.liferay.portal.SystemException)e;
115                 }
116 
117                 throw new com.liferay.portal.SystemException(e);
118             }
119 
120             return (com.liferay.portlet.documentlibrary.model.DLFileShortcut)returnObj;
121         }
122         catch (com.liferay.portal.SystemException se) {
123             _log.error(se, se);
124 
125             throw se;
126         }
127     }
128 
129     public static com.liferay.portlet.documentlibrary.model.DLFileShortcut addFileShortcut(
130         HttpPrincipal httpPrincipal, long folderId, long toFolderId,
131         java.lang.String toName, java.lang.String[] communityPermissions,
132         java.lang.String[] guestPermissions)
133         throws com.liferay.portal.PortalException,
134             com.liferay.portal.SystemException {
135         try {
136             Object paramObj0 = new LongWrapper(folderId);
137 
138             Object paramObj1 = new LongWrapper(toFolderId);
139 
140             Object paramObj2 = toName;
141 
142             if (toName == null) {
143                 paramObj2 = new NullWrapper("java.lang.String");
144             }
145 
146             Object paramObj3 = communityPermissions;
147 
148             if (communityPermissions == null) {
149                 paramObj3 = new NullWrapper("[Ljava.lang.String;");
150             }
151 
152             Object paramObj4 = guestPermissions;
153 
154             if (guestPermissions == null) {
155                 paramObj4 = new NullWrapper("[Ljava.lang.String;");
156             }
157 
158             MethodWrapper methodWrapper = new MethodWrapper(DLFileShortcutServiceUtil.class.getName(),
159                     "addFileShortcut",
160                     new Object[] {
161                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
162                     });
163 
164             Object returnObj = null;
165 
166             try {
167                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
168             }
169             catch (Exception e) {
170                 if (e instanceof com.liferay.portal.PortalException) {
171                     throw (com.liferay.portal.PortalException)e;
172                 }
173 
174                 if (e instanceof com.liferay.portal.SystemException) {
175                     throw (com.liferay.portal.SystemException)e;
176                 }
177 
178                 throw new com.liferay.portal.SystemException(e);
179             }
180 
181             return (com.liferay.portlet.documentlibrary.model.DLFileShortcut)returnObj;
182         }
183         catch (com.liferay.portal.SystemException se) {
184             _log.error(se, se);
185 
186             throw se;
187         }
188     }
189 
190     public static void deleteFileShortcut(HttpPrincipal httpPrincipal,
191         long fileShortcutId)
192         throws com.liferay.portal.PortalException,
193             com.liferay.portal.SystemException {
194         try {
195             Object paramObj0 = new LongWrapper(fileShortcutId);
196 
197             MethodWrapper methodWrapper = new MethodWrapper(DLFileShortcutServiceUtil.class.getName(),
198                     "deleteFileShortcut", new Object[] { paramObj0 });
199 
200             try {
201                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
202             }
203             catch (Exception e) {
204                 if (e instanceof com.liferay.portal.PortalException) {
205                     throw (com.liferay.portal.PortalException)e;
206                 }
207 
208                 if (e instanceof com.liferay.portal.SystemException) {
209                     throw (com.liferay.portal.SystemException)e;
210                 }
211 
212                 throw new com.liferay.portal.SystemException(e);
213             }
214         }
215         catch (com.liferay.portal.SystemException se) {
216             _log.error(se, se);
217 
218             throw se;
219         }
220     }
221 
222     public static com.liferay.portlet.documentlibrary.model.DLFileShortcut getFileShortcut(
223         HttpPrincipal httpPrincipal, long fileShortcutId)
224         throws com.liferay.portal.PortalException,
225             com.liferay.portal.SystemException {
226         try {
227             Object paramObj0 = new LongWrapper(fileShortcutId);
228 
229             MethodWrapper methodWrapper = new MethodWrapper(DLFileShortcutServiceUtil.class.getName(),
230                     "getFileShortcut", new Object[] { paramObj0 });
231 
232             Object returnObj = null;
233 
234             try {
235                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
236             }
237             catch (Exception e) {
238                 if (e instanceof com.liferay.portal.PortalException) {
239                     throw (com.liferay.portal.PortalException)e;
240                 }
241 
242                 if (e instanceof com.liferay.portal.SystemException) {
243                     throw (com.liferay.portal.SystemException)e;
244                 }
245 
246                 throw new com.liferay.portal.SystemException(e);
247             }
248 
249             return (com.liferay.portlet.documentlibrary.model.DLFileShortcut)returnObj;
250         }
251         catch (com.liferay.portal.SystemException se) {
252             _log.error(se, se);
253 
254             throw se;
255         }
256     }
257 
258     public static com.liferay.portlet.documentlibrary.model.DLFileShortcut updateFileShortcut(
259         HttpPrincipal httpPrincipal, long fileShortcutId, long folderId,
260         long toFolderId, java.lang.String toName)
261         throws com.liferay.portal.PortalException,
262             com.liferay.portal.SystemException {
263         try {
264             Object paramObj0 = new LongWrapper(fileShortcutId);
265 
266             Object paramObj1 = new LongWrapper(folderId);
267 
268             Object paramObj2 = new LongWrapper(toFolderId);
269 
270             Object paramObj3 = toName;
271 
272             if (toName == null) {
273                 paramObj3 = new NullWrapper("java.lang.String");
274             }
275 
276             MethodWrapper methodWrapper = new MethodWrapper(DLFileShortcutServiceUtil.class.getName(),
277                     "updateFileShortcut",
278                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
279 
280             Object returnObj = null;
281 
282             try {
283                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
284             }
285             catch (Exception e) {
286                 if (e instanceof com.liferay.portal.PortalException) {
287                     throw (com.liferay.portal.PortalException)e;
288                 }
289 
290                 if (e instanceof com.liferay.portal.SystemException) {
291                     throw (com.liferay.portal.SystemException)e;
292                 }
293 
294                 throw new com.liferay.portal.SystemException(e);
295             }
296 
297             return (com.liferay.portlet.documentlibrary.model.DLFileShortcut)returnObj;
298         }
299         catch (com.liferay.portal.SystemException se) {
300             _log.error(se, se);
301 
302             throw se;
303         }
304     }
305 
306     private static Log _log = LogFactoryUtil.getLog(DLFileShortcutServiceHttp.class);
307 }