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.DLFileShortcutServiceUtil;
027    
028    /**
029     * Provides the HTTP utility for the
030     * {@link DLFileShortcutServiceUtil} 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 DLFileShortcutServiceSoap
052     * @see HttpPrincipal
053     * @see DLFileShortcutServiceUtil
054     * @generated
055     */
056    @ProviderType
057    public class DLFileShortcutServiceHttp {
058            public static com.liferay.portlet.documentlibrary.model.DLFileShortcut addFileShortcut(
059                    HttpPrincipal httpPrincipal, long groupId, long repositoryId,
060                    long folderId, long toFileEntryId,
061                    com.liferay.portal.service.ServiceContext serviceContext)
062                    throws com.liferay.portal.kernel.exception.PortalException {
063                    try {
064                            MethodKey methodKey = new MethodKey(DLFileShortcutServiceUtil.class,
065                                            "addFileShortcut", _addFileShortcutParameterTypes0);
066    
067                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
068                                            repositoryId, folderId, toFileEntryId, 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.portlet.documentlibrary.model.DLFileShortcut)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 void deleteFileShortcut(HttpPrincipal httpPrincipal,
093                    long fileShortcutId)
094                    throws com.liferay.portal.kernel.exception.PortalException {
095                    try {
096                            MethodKey methodKey = new MethodKey(DLFileShortcutServiceUtil.class,
097                                            "deleteFileShortcut", _deleteFileShortcutParameterTypes1);
098    
099                            MethodHandler methodHandler = new MethodHandler(methodKey,
100                                            fileShortcutId);
101    
102                            try {
103                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
104                            }
105                            catch (Exception e) {
106                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
107                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
108                                    }
109    
110                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
111                            }
112                    }
113                    catch (com.liferay.portal.kernel.exception.SystemException se) {
114                            _log.error(se, se);
115    
116                            throw se;
117                    }
118            }
119    
120            public static com.liferay.portlet.documentlibrary.model.DLFileShortcut getFileShortcut(
121                    HttpPrincipal httpPrincipal, long fileShortcutId)
122                    throws com.liferay.portal.kernel.exception.PortalException {
123                    try {
124                            MethodKey methodKey = new MethodKey(DLFileShortcutServiceUtil.class,
125                                            "getFileShortcut", _getFileShortcutParameterTypes2);
126    
127                            MethodHandler methodHandler = new MethodHandler(methodKey,
128                                            fileShortcutId);
129    
130                            Object returnObj = null;
131    
132                            try {
133                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
134                            }
135                            catch (Exception e) {
136                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
137                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
138                                    }
139    
140                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
141                            }
142    
143                            return (com.liferay.portlet.documentlibrary.model.DLFileShortcut)returnObj;
144                    }
145                    catch (com.liferay.portal.kernel.exception.SystemException se) {
146                            _log.error(se, se);
147    
148                            throw se;
149                    }
150            }
151    
152            public static com.liferay.portlet.documentlibrary.model.DLFileShortcut updateFileShortcut(
153                    HttpPrincipal httpPrincipal, long fileShortcutId, long repositoryId,
154                    long folderId, long toFileEntryId,
155                    com.liferay.portal.service.ServiceContext serviceContext)
156                    throws com.liferay.portal.kernel.exception.PortalException {
157                    try {
158                            MethodKey methodKey = new MethodKey(DLFileShortcutServiceUtil.class,
159                                            "updateFileShortcut", _updateFileShortcutParameterTypes3);
160    
161                            MethodHandler methodHandler = new MethodHandler(methodKey,
162                                            fileShortcutId, repositoryId, folderId, toFileEntryId,
163                                            serviceContext);
164    
165                            Object returnObj = null;
166    
167                            try {
168                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
169                            }
170                            catch (Exception e) {
171                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
172                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
173                                    }
174    
175                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
176                            }
177    
178                            return (com.liferay.portlet.documentlibrary.model.DLFileShortcut)returnObj;
179                    }
180                    catch (com.liferay.portal.kernel.exception.SystemException se) {
181                            _log.error(se, se);
182    
183                            throw se;
184                    }
185            }
186    
187            public static void updateFileShortcuts(HttpPrincipal httpPrincipal,
188                    long oldToFileEntryId, long newToFileEntryId)
189                    throws com.liferay.portal.kernel.exception.PortalException {
190                    try {
191                            MethodKey methodKey = new MethodKey(DLFileShortcutServiceUtil.class,
192                                            "updateFileShortcuts", _updateFileShortcutsParameterTypes4);
193    
194                            MethodHandler methodHandler = new MethodHandler(methodKey,
195                                            oldToFileEntryId, newToFileEntryId);
196    
197                            try {
198                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
199                            }
200                            catch (Exception e) {
201                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
202                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
203                                    }
204    
205                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
206                            }
207                    }
208                    catch (com.liferay.portal.kernel.exception.SystemException se) {
209                            _log.error(se, se);
210    
211                            throw se;
212                    }
213            }
214    
215            private static Log _log = LogFactoryUtil.getLog(DLFileShortcutServiceHttp.class);
216            private static final Class<?>[] _addFileShortcutParameterTypes0 = new Class[] {
217                            long.class, long.class, long.class, long.class,
218                            com.liferay.portal.service.ServiceContext.class
219                    };
220            private static final Class<?>[] _deleteFileShortcutParameterTypes1 = new Class[] {
221                            long.class
222                    };
223            private static final Class<?>[] _getFileShortcutParameterTypes2 = new Class[] {
224                            long.class
225                    };
226            private static final Class<?>[] _updateFileShortcutParameterTypes3 = new Class[] {
227                            long.class, long.class, long.class, long.class,
228                            com.liferay.portal.service.ServiceContext.class
229                    };
230            private static final Class<?>[] _updateFileShortcutsParameterTypes4 = new Class[] {
231                            long.class, long.class
232                    };
233    }