001    /**
002     * Copyright (c) 2000-2013 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 com.liferay.portal.kernel.log.Log;
018    import com.liferay.portal.kernel.log.LogFactoryUtil;
019    import com.liferay.portal.kernel.util.MethodHandler;
020    import com.liferay.portal.kernel.util.MethodKey;
021    import com.liferay.portal.security.auth.HttpPrincipal;
022    import com.liferay.portal.service.http.TunnelUtil;
023    
024    import com.liferay.portlet.documentlibrary.service.DLFileShortcutServiceUtil;
025    
026    /**
027     * <p>
028     * This class provides a HTTP utility for the
029     * {@link com.liferay.portlet.documentlibrary.service.DLFileShortcutServiceUtil} service utility. The
030     * static methods of this class calls the same methods of the service utility.
031     * However, the signatures are different because it requires an additional
032     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
033     * </p>
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    public class DLFileShortcutServiceHttp {
057            public static com.liferay.portlet.documentlibrary.model.DLFileShortcut addFileShortcut(
058                    HttpPrincipal httpPrincipal, long groupId, long folderId,
059                    long toFileEntryId,
060                    com.liferay.portal.service.ServiceContext serviceContext)
061                    throws com.liferay.portal.kernel.exception.PortalException,
062                            com.liferay.portal.kernel.exception.SystemException {
063                    try {
064                            MethodKey methodKey = new MethodKey(DLFileShortcutServiceUtil.class.getName(),
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                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
081                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
082                                    }
083    
084                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
085                            }
086    
087                            return (com.liferay.portlet.documentlibrary.model.DLFileShortcut)returnObj;
088                    }
089                    catch (com.liferay.portal.kernel.exception.SystemException se) {
090                            _log.error(se, se);
091    
092                            throw se;
093                    }
094            }
095    
096            public static void deleteFileShortcut(HttpPrincipal httpPrincipal,
097                    long fileShortcutId)
098                    throws com.liferay.portal.kernel.exception.PortalException,
099                            com.liferay.portal.kernel.exception.SystemException {
100                    try {
101                            MethodKey methodKey = new MethodKey(DLFileShortcutServiceUtil.class.getName(),
102                                            "deleteFileShortcut", _deleteFileShortcutParameterTypes1);
103    
104                            MethodHandler methodHandler = new MethodHandler(methodKey,
105                                            fileShortcutId);
106    
107                            try {
108                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
109                            }
110                            catch (Exception e) {
111                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
112                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
113                                    }
114    
115                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
116                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
117                                    }
118    
119                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
120                            }
121                    }
122                    catch (com.liferay.portal.kernel.exception.SystemException se) {
123                            _log.error(se, se);
124    
125                            throw se;
126                    }
127            }
128    
129            public static com.liferay.portlet.documentlibrary.model.DLFileShortcut getFileShortcut(
130                    HttpPrincipal httpPrincipal, long fileShortcutId)
131                    throws com.liferay.portal.kernel.exception.PortalException,
132                            com.liferay.portal.kernel.exception.SystemException {
133                    try {
134                            MethodKey methodKey = new MethodKey(DLFileShortcutServiceUtil.class.getName(),
135                                            "getFileShortcut", _getFileShortcutParameterTypes2);
136    
137                            MethodHandler methodHandler = new MethodHandler(methodKey,
138                                            fileShortcutId);
139    
140                            Object returnObj = null;
141    
142                            try {
143                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
144                            }
145                            catch (Exception e) {
146                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
147                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
148                                    }
149    
150                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
151                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
152                                    }
153    
154                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
155                            }
156    
157                            return (com.liferay.portlet.documentlibrary.model.DLFileShortcut)returnObj;
158                    }
159                    catch (com.liferay.portal.kernel.exception.SystemException se) {
160                            _log.error(se, se);
161    
162                            throw se;
163                    }
164            }
165    
166            public static com.liferay.portlet.documentlibrary.model.DLFileShortcut updateFileShortcut(
167                    HttpPrincipal httpPrincipal, long fileShortcutId, long folderId,
168                    long toFileEntryId,
169                    com.liferay.portal.service.ServiceContext serviceContext)
170                    throws com.liferay.portal.kernel.exception.PortalException,
171                            com.liferay.portal.kernel.exception.SystemException {
172                    try {
173                            MethodKey methodKey = new MethodKey(DLFileShortcutServiceUtil.class.getName(),
174                                            "updateFileShortcut", _updateFileShortcutParameterTypes3);
175    
176                            MethodHandler methodHandler = new MethodHandler(methodKey,
177                                            fileShortcutId, folderId, toFileEntryId, serviceContext);
178    
179                            Object returnObj = null;
180    
181                            try {
182                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
183                            }
184                            catch (Exception e) {
185                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
186                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
187                                    }
188    
189                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
190                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
191                                    }
192    
193                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
194                            }
195    
196                            return (com.liferay.portlet.documentlibrary.model.DLFileShortcut)returnObj;
197                    }
198                    catch (com.liferay.portal.kernel.exception.SystemException se) {
199                            _log.error(se, se);
200    
201                            throw se;
202                    }
203            }
204    
205            private static Log _log = LogFactoryUtil.getLog(DLFileShortcutServiceHttp.class);
206            private static final Class<?>[] _addFileShortcutParameterTypes0 = new Class[] {
207                            long.class, long.class, long.class,
208                            com.liferay.portal.service.ServiceContext.class
209                    };
210            private static final Class<?>[] _deleteFileShortcutParameterTypes1 = new Class[] {
211                            long.class
212                    };
213            private static final Class<?>[] _getFileShortcutParameterTypes2 = new Class[] {
214                            long.class
215                    };
216            private static final Class<?>[] _updateFileShortcutParameterTypes3 = new Class[] {
217                            long.class, long.class, long.class,
218                            com.liferay.portal.service.ServiceContext.class
219                    };
220    }