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