001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.documentlibrary.service.http;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.log.Log;
020    import com.liferay.portal.kernel.log.LogFactoryUtil;
021    import com.liferay.portal.kernel.util.MethodHandler;
022    import com.liferay.portal.kernel.util.MethodKey;
023    import com.liferay.portal.security.auth.HttpPrincipal;
024    import com.liferay.portal.service.http.TunnelUtil;
025    
026    import com.liferay.portlet.documentlibrary.service.DLTrashServiceUtil;
027    
028    /**
029     * Provides the HTTP utility for the
030     * {@link DLTrashServiceUtil} service utility. The
031     * static methods of this class calls the same methods of the service utility.
032     * However, the signatures are different because it requires an additional
033     * {@link HttpPrincipal} parameter.
034     *
035     * <p>
036     * The benefits of using the HTTP utility is that it is fast and allows for
037     * tunneling without the cost of serializing to text. The drawback is that it
038     * only works with Java.
039     * </p>
040     *
041     * <p>
042     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
043     * configure security.
044     * </p>
045     *
046     * <p>
047     * The HTTP utility is only generated for remote services.
048     * </p>
049     *
050     * @author Brian Wing Shun Chan
051     * @see DLTrashServiceSoap
052     * @see HttpPrincipal
053     * @see DLTrashServiceUtil
054     * @generated
055     */
056    @ProviderType
057    public class DLTrashServiceHttp {
058            public static com.liferay.portal.kernel.repository.model.FileEntry moveFileEntryFromTrash(
059                    HttpPrincipal httpPrincipal, long fileEntryId, long newFolderId,
060                    com.liferay.portal.service.ServiceContext serviceContext)
061                    throws com.liferay.portal.kernel.exception.PortalException {
062                    try {
063                            MethodKey methodKey = new MethodKey(DLTrashServiceUtil.class,
064                                            "moveFileEntryFromTrash",
065                                            _moveFileEntryFromTrashParameterTypes0);
066    
067                            MethodHandler methodHandler = new MethodHandler(methodKey,
068                                            fileEntryId, newFolderId, serviceContext);
069    
070                            Object returnObj = null;
071    
072                            try {
073                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
074                            }
075                            catch (Exception e) {
076                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
077                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
078                                    }
079    
080                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
081                            }
082    
083                            return (com.liferay.portal.kernel.repository.model.FileEntry)returnObj;
084                    }
085                    catch (com.liferay.portal.kernel.exception.SystemException se) {
086                            _log.error(se, se);
087    
088                            throw se;
089                    }
090            }
091    
092            public static com.liferay.portal.kernel.repository.model.FileEntry moveFileEntryToTrash(
093                    HttpPrincipal httpPrincipal, long fileEntryId)
094                    throws com.liferay.portal.kernel.exception.PortalException {
095                    try {
096                            MethodKey methodKey = new MethodKey(DLTrashServiceUtil.class,
097                                            "moveFileEntryToTrash", _moveFileEntryToTrashParameterTypes1);
098    
099                            MethodHandler methodHandler = new MethodHandler(methodKey,
100                                            fileEntryId);
101    
102                            Object returnObj = null;
103    
104                            try {
105                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
106                            }
107                            catch (Exception e) {
108                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
109                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
110                                    }
111    
112                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
113                            }
114    
115                            return (com.liferay.portal.kernel.repository.model.FileEntry)returnObj;
116                    }
117                    catch (com.liferay.portal.kernel.exception.SystemException se) {
118                            _log.error(se, se);
119    
120                            throw se;
121                    }
122            }
123    
124            public static com.liferay.portal.kernel.repository.model.FileShortcut moveFileShortcutFromTrash(
125                    HttpPrincipal httpPrincipal, long fileShortcutId, long newFolderId,
126                    com.liferay.portal.service.ServiceContext serviceContext)
127                    throws com.liferay.portal.kernel.exception.PortalException {
128                    try {
129                            MethodKey methodKey = new MethodKey(DLTrashServiceUtil.class,
130                                            "moveFileShortcutFromTrash",
131                                            _moveFileShortcutFromTrashParameterTypes2);
132    
133                            MethodHandler methodHandler = new MethodHandler(methodKey,
134                                            fileShortcutId, newFolderId, serviceContext);
135    
136                            Object returnObj = null;
137    
138                            try {
139                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
140                            }
141                            catch (Exception e) {
142                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
143                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
144                                    }
145    
146                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
147                            }
148    
149                            return (com.liferay.portal.kernel.repository.model.FileShortcut)returnObj;
150                    }
151                    catch (com.liferay.portal.kernel.exception.SystemException se) {
152                            _log.error(se, se);
153    
154                            throw se;
155                    }
156            }
157    
158            public static com.liferay.portal.kernel.repository.model.FileShortcut moveFileShortcutToTrash(
159                    HttpPrincipal httpPrincipal, long fileShortcutId)
160                    throws com.liferay.portal.kernel.exception.PortalException {
161                    try {
162                            MethodKey methodKey = new MethodKey(DLTrashServiceUtil.class,
163                                            "moveFileShortcutToTrash",
164                                            _moveFileShortcutToTrashParameterTypes3);
165    
166                            MethodHandler methodHandler = new MethodHandler(methodKey,
167                                            fileShortcutId);
168    
169                            Object returnObj = null;
170    
171                            try {
172                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
173                            }
174                            catch (Exception e) {
175                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
176                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
177                                    }
178    
179                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
180                            }
181    
182                            return (com.liferay.portal.kernel.repository.model.FileShortcut)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.portal.kernel.repository.model.Folder moveFolderFromTrash(
192                    HttpPrincipal httpPrincipal, long folderId, long parentFolderId,
193                    com.liferay.portal.service.ServiceContext serviceContext)
194                    throws com.liferay.portal.kernel.exception.PortalException {
195                    try {
196                            MethodKey methodKey = new MethodKey(DLTrashServiceUtil.class,
197                                            "moveFolderFromTrash", _moveFolderFromTrashParameterTypes4);
198    
199                            MethodHandler methodHandler = new MethodHandler(methodKey,
200                                            folderId, parentFolderId, serviceContext);
201    
202                            Object returnObj = null;
203    
204                            try {
205                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
206                            }
207                            catch (Exception e) {
208                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
209                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
210                                    }
211    
212                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
213                            }
214    
215                            return (com.liferay.portal.kernel.repository.model.Folder)returnObj;
216                    }
217                    catch (com.liferay.portal.kernel.exception.SystemException se) {
218                            _log.error(se, se);
219    
220                            throw se;
221                    }
222            }
223    
224            public static com.liferay.portal.kernel.repository.model.Folder moveFolderToTrash(
225                    HttpPrincipal httpPrincipal, long folderId)
226                    throws com.liferay.portal.kernel.exception.PortalException {
227                    try {
228                            MethodKey methodKey = new MethodKey(DLTrashServiceUtil.class,
229                                            "moveFolderToTrash", _moveFolderToTrashParameterTypes5);
230    
231                            MethodHandler methodHandler = new MethodHandler(methodKey, folderId);
232    
233                            Object returnObj = null;
234    
235                            try {
236                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
237                            }
238                            catch (Exception e) {
239                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
240                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
241                                    }
242    
243                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
244                            }
245    
246                            return (com.liferay.portal.kernel.repository.model.Folder)returnObj;
247                    }
248                    catch (com.liferay.portal.kernel.exception.SystemException se) {
249                            _log.error(se, se);
250    
251                            throw se;
252                    }
253            }
254    
255            public static void restoreFileEntryFromTrash(HttpPrincipal httpPrincipal,
256                    long fileEntryId)
257                    throws com.liferay.portal.kernel.exception.PortalException {
258                    try {
259                            MethodKey methodKey = new MethodKey(DLTrashServiceUtil.class,
260                                            "restoreFileEntryFromTrash",
261                                            _restoreFileEntryFromTrashParameterTypes6);
262    
263                            MethodHandler methodHandler = new MethodHandler(methodKey,
264                                            fileEntryId);
265    
266                            try {
267                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
268                            }
269                            catch (Exception e) {
270                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
271                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
272                                    }
273    
274                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
275                            }
276                    }
277                    catch (com.liferay.portal.kernel.exception.SystemException se) {
278                            _log.error(se, se);
279    
280                            throw se;
281                    }
282            }
283    
284            public static void restoreFileShortcutFromTrash(
285                    HttpPrincipal httpPrincipal, long fileShortcutId)
286                    throws com.liferay.portal.kernel.exception.PortalException {
287                    try {
288                            MethodKey methodKey = new MethodKey(DLTrashServiceUtil.class,
289                                            "restoreFileShortcutFromTrash",
290                                            _restoreFileShortcutFromTrashParameterTypes7);
291    
292                            MethodHandler methodHandler = new MethodHandler(methodKey,
293                                            fileShortcutId);
294    
295                            try {
296                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
297                            }
298                            catch (Exception e) {
299                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
300                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
301                                    }
302    
303                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
304                            }
305                    }
306                    catch (com.liferay.portal.kernel.exception.SystemException se) {
307                            _log.error(se, se);
308    
309                            throw se;
310                    }
311            }
312    
313            public static void restoreFolderFromTrash(HttpPrincipal httpPrincipal,
314                    long folderId)
315                    throws com.liferay.portal.kernel.exception.PortalException {
316                    try {
317                            MethodKey methodKey = new MethodKey(DLTrashServiceUtil.class,
318                                            "restoreFolderFromTrash",
319                                            _restoreFolderFromTrashParameterTypes8);
320    
321                            MethodHandler methodHandler = new MethodHandler(methodKey, folderId);
322    
323                            try {
324                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
325                            }
326                            catch (Exception e) {
327                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
328                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
329                                    }
330    
331                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
332                            }
333                    }
334                    catch (com.liferay.portal.kernel.exception.SystemException se) {
335                            _log.error(se, se);
336    
337                            throw se;
338                    }
339            }
340    
341            private static Log _log = LogFactoryUtil.getLog(DLTrashServiceHttp.class);
342            private static final Class<?>[] _moveFileEntryFromTrashParameterTypes0 = new Class[] {
343                            long.class, long.class,
344                            com.liferay.portal.service.ServiceContext.class
345                    };
346            private static final Class<?>[] _moveFileEntryToTrashParameterTypes1 = new Class[] {
347                            long.class
348                    };
349            private static final Class<?>[] _moveFileShortcutFromTrashParameterTypes2 = new Class[] {
350                            long.class, long.class,
351                            com.liferay.portal.service.ServiceContext.class
352                    };
353            private static final Class<?>[] _moveFileShortcutToTrashParameterTypes3 = new Class[] {
354                            long.class
355                    };
356            private static final Class<?>[] _moveFolderFromTrashParameterTypes4 = new Class[] {
357                            long.class, long.class,
358                            com.liferay.portal.service.ServiceContext.class
359                    };
360            private static final Class<?>[] _moveFolderToTrashParameterTypes5 = new Class[] {
361                            long.class
362                    };
363            private static final Class<?>[] _restoreFileEntryFromTrashParameterTypes6 = new Class[] {
364                            long.class
365                    };
366            private static final Class<?>[] _restoreFileShortcutFromTrashParameterTypes7 =
367                    new Class[] { long.class };
368            private static final Class<?>[] _restoreFolderFromTrashParameterTypes8 = new Class[] {
369                            long.class
370                    };
371    }