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 com.liferay.portlet.documentlibrary.service.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 com.liferay.portal.security.auth.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 com.liferay.portal.security.auth.HttpPrincipal
053     * @see com.liferay.portlet.documentlibrary.service.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 folderId,
060                    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                                            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 folderId,
154                    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, folderId, toFileEntryId, serviceContext);
163    
164                            Object returnObj = null;
165    
166                            try {
167                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
168                            }
169                            catch (Exception e) {
170                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
171                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
172                                    }
173    
174                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
175                            }
176    
177                            return (com.liferay.portlet.documentlibrary.model.DLFileShortcut)returnObj;
178                    }
179                    catch (com.liferay.portal.kernel.exception.SystemException se) {
180                            _log.error(se, se);
181    
182                            throw se;
183                    }
184            }
185    
186            private static Log _log = LogFactoryUtil.getLog(DLFileShortcutServiceHttp.class);
187            private static final Class<?>[] _addFileShortcutParameterTypes0 = new Class[] {
188                            long.class, long.class, long.class,
189                            com.liferay.portal.service.ServiceContext.class
190                    };
191            private static final Class<?>[] _deleteFileShortcutParameterTypes1 = new Class[] {
192                            long.class
193                    };
194            private static final Class<?>[] _getFileShortcutParameterTypes2 = new Class[] {
195                            long.class
196                    };
197            private static final Class<?>[] _updateFileShortcutParameterTypes3 = new Class[] {
198                            long.class, long.class, long.class,
199                            com.liferay.portal.service.ServiceContext.class
200                    };
201    }