1   /**
2    * Copyright (c) 2000-2009 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   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portlet.documentlibrary.service.http;
21  
22  import com.liferay.portal.kernel.log.Log;
23  import com.liferay.portal.kernel.log.LogFactoryUtil;
24  import com.liferay.portal.kernel.util.BooleanWrapper;
25  import com.liferay.portal.kernel.util.LongWrapper;
26  import com.liferay.portal.kernel.util.MethodWrapper;
27  import com.liferay.portal.kernel.util.NullWrapper;
28  import com.liferay.portal.security.auth.HttpPrincipal;
29  import com.liferay.portal.service.http.TunnelUtil;
30  
31  import com.liferay.portlet.documentlibrary.service.DLFileShortcutServiceUtil;
32  
33  /**
34   * <a href="DLFileShortcutServiceHttp.java.html"><b><i>View Source</i></b></a>
35   *
36   * <p>
37   * ServiceBuilder generated this class. Modifications in this class will be
38   * overwritten the next time is generated.
39   * </p>
40   *
41   * <p>
42   * This class provides a HTTP utility for the
43   * <code>com.liferay.portlet.documentlibrary.service.DLFileShortcutServiceUtil</code> service
44   * utility. The static methods of this class calls the same methods of the
45   * service utility. However, the signatures are different because it requires an
46   * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code>
47   * parameter.
48   * </p>
49   *
50   * <p>
51   * The benefits of using the HTTP utility is that it is fast and allows for
52   * tunneling without the cost of serializing to text. The drawback is that it
53   * only works with Java.
54   * </p>
55   *
56   * <p>
57   * Set the property <code>tunnel.servlet.hosts.allowed</code> in
58   * portal.properties to configure security.
59   * </p>
60   *
61   * <p>
62   * The HTTP utility is only generated for remote services.
63   * </p>
64   *
65   * @author Brian Wing Shun Chan
66   *
67   * @see com.liferay.portal.security.auth.HttpPrincipal
68   * @see com.liferay.portlet.documentlibrary.service.DLFileShortcutServiceUtil
69   * @see com.liferay.portlet.documentlibrary.service.http.DLFileShortcutServiceSoap
70   *
71   */
72  public class DLFileShortcutServiceHttp {
73      public static com.liferay.portlet.documentlibrary.model.DLFileShortcut addFileShortcut(
74          HttpPrincipal httpPrincipal, long folderId, long toFolderId,
75          java.lang.String toName, boolean addCommunityPermissions,
76          boolean addGuestPermissions)
77          throws com.liferay.portal.PortalException,
78              com.liferay.portal.SystemException {
79          try {
80              Object paramObj0 = new LongWrapper(folderId);
81  
82              Object paramObj1 = new LongWrapper(toFolderId);
83  
84              Object paramObj2 = toName;
85  
86              if (toName == null) {
87                  paramObj2 = new NullWrapper("java.lang.String");
88              }
89  
90              Object paramObj3 = new BooleanWrapper(addCommunityPermissions);
91  
92              Object paramObj4 = new BooleanWrapper(addGuestPermissions);
93  
94              MethodWrapper methodWrapper = new MethodWrapper(DLFileShortcutServiceUtil.class.getName(),
95                      "addFileShortcut",
96                      new Object[] {
97                          paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
98                      });
99  
100             Object returnObj = null;
101 
102             try {
103                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
104             }
105             catch (Exception e) {
106                 if (e instanceof com.liferay.portal.PortalException) {
107                     throw (com.liferay.portal.PortalException)e;
108                 }
109 
110                 if (e instanceof com.liferay.portal.SystemException) {
111                     throw (com.liferay.portal.SystemException)e;
112                 }
113 
114                 throw new com.liferay.portal.SystemException(e);
115             }
116 
117             return (com.liferay.portlet.documentlibrary.model.DLFileShortcut)returnObj;
118         }
119         catch (com.liferay.portal.SystemException se) {
120             _log.error(se, se);
121 
122             throw se;
123         }
124     }
125 
126     public static com.liferay.portlet.documentlibrary.model.DLFileShortcut addFileShortcut(
127         HttpPrincipal httpPrincipal, long folderId, long toFolderId,
128         java.lang.String toName, java.lang.String[] communityPermissions,
129         java.lang.String[] guestPermissions)
130         throws com.liferay.portal.PortalException,
131             com.liferay.portal.SystemException {
132         try {
133             Object paramObj0 = new LongWrapper(folderId);
134 
135             Object paramObj1 = new LongWrapper(toFolderId);
136 
137             Object paramObj2 = toName;
138 
139             if (toName == null) {
140                 paramObj2 = new NullWrapper("java.lang.String");
141             }
142 
143             Object paramObj3 = communityPermissions;
144 
145             if (communityPermissions == null) {
146                 paramObj3 = new NullWrapper("[Ljava.lang.String;");
147             }
148 
149             Object paramObj4 = guestPermissions;
150 
151             if (guestPermissions == null) {
152                 paramObj4 = new NullWrapper("[Ljava.lang.String;");
153             }
154 
155             MethodWrapper methodWrapper = new MethodWrapper(DLFileShortcutServiceUtil.class.getName(),
156                     "addFileShortcut",
157                     new Object[] {
158                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
159                     });
160 
161             Object returnObj = null;
162 
163             try {
164                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
165             }
166             catch (Exception e) {
167                 if (e instanceof com.liferay.portal.PortalException) {
168                     throw (com.liferay.portal.PortalException)e;
169                 }
170 
171                 if (e instanceof com.liferay.portal.SystemException) {
172                     throw (com.liferay.portal.SystemException)e;
173                 }
174 
175                 throw new com.liferay.portal.SystemException(e);
176             }
177 
178             return (com.liferay.portlet.documentlibrary.model.DLFileShortcut)returnObj;
179         }
180         catch (com.liferay.portal.SystemException se) {
181             _log.error(se, se);
182 
183             throw se;
184         }
185     }
186 
187     public static void deleteFileShortcut(HttpPrincipal httpPrincipal,
188         long fileShortcutId)
189         throws com.liferay.portal.PortalException,
190             com.liferay.portal.SystemException {
191         try {
192             Object paramObj0 = new LongWrapper(fileShortcutId);
193 
194             MethodWrapper methodWrapper = new MethodWrapper(DLFileShortcutServiceUtil.class.getName(),
195                     "deleteFileShortcut", new Object[] { paramObj0 });
196 
197             try {
198                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
199             }
200             catch (Exception e) {
201                 if (e instanceof com.liferay.portal.PortalException) {
202                     throw (com.liferay.portal.PortalException)e;
203                 }
204 
205                 if (e instanceof com.liferay.portal.SystemException) {
206                     throw (com.liferay.portal.SystemException)e;
207                 }
208 
209                 throw new com.liferay.portal.SystemException(e);
210             }
211         }
212         catch (com.liferay.portal.SystemException se) {
213             _log.error(se, se);
214 
215             throw se;
216         }
217     }
218 
219     public static com.liferay.portlet.documentlibrary.model.DLFileShortcut getFileShortcut(
220         HttpPrincipal httpPrincipal, long fileShortcutId)
221         throws com.liferay.portal.PortalException,
222             com.liferay.portal.SystemException {
223         try {
224             Object paramObj0 = new LongWrapper(fileShortcutId);
225 
226             MethodWrapper methodWrapper = new MethodWrapper(DLFileShortcutServiceUtil.class.getName(),
227                     "getFileShortcut", new Object[] { paramObj0 });
228 
229             Object returnObj = null;
230 
231             try {
232                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
233             }
234             catch (Exception e) {
235                 if (e instanceof com.liferay.portal.PortalException) {
236                     throw (com.liferay.portal.PortalException)e;
237                 }
238 
239                 if (e instanceof com.liferay.portal.SystemException) {
240                     throw (com.liferay.portal.SystemException)e;
241                 }
242 
243                 throw new com.liferay.portal.SystemException(e);
244             }
245 
246             return (com.liferay.portlet.documentlibrary.model.DLFileShortcut)returnObj;
247         }
248         catch (com.liferay.portal.SystemException se) {
249             _log.error(se, se);
250 
251             throw se;
252         }
253     }
254 
255     public static com.liferay.portlet.documentlibrary.model.DLFileShortcut updateFileShortcut(
256         HttpPrincipal httpPrincipal, long fileShortcutId, long folderId,
257         long toFolderId, java.lang.String toName)
258         throws com.liferay.portal.PortalException,
259             com.liferay.portal.SystemException {
260         try {
261             Object paramObj0 = new LongWrapper(fileShortcutId);
262 
263             Object paramObj1 = new LongWrapper(folderId);
264 
265             Object paramObj2 = new LongWrapper(toFolderId);
266 
267             Object paramObj3 = toName;
268 
269             if (toName == null) {
270                 paramObj3 = new NullWrapper("java.lang.String");
271             }
272 
273             MethodWrapper methodWrapper = new MethodWrapper(DLFileShortcutServiceUtil.class.getName(),
274                     "updateFileShortcut",
275                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
276 
277             Object returnObj = null;
278 
279             try {
280                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
281             }
282             catch (Exception e) {
283                 if (e instanceof com.liferay.portal.PortalException) {
284                     throw (com.liferay.portal.PortalException)e;
285                 }
286 
287                 if (e instanceof com.liferay.portal.SystemException) {
288                     throw (com.liferay.portal.SystemException)e;
289                 }
290 
291                 throw new com.liferay.portal.SystemException(e);
292             }
293 
294             return (com.liferay.portlet.documentlibrary.model.DLFileShortcut)returnObj;
295         }
296         catch (com.liferay.portal.SystemException se) {
297             _log.error(se, se);
298 
299             throw se;
300         }
301     }
302 
303     private static Log _log = LogFactoryUtil.getLog(DLFileShortcutServiceHttp.class);
304 }