001    /**
002     * Copyright (c) 2000-2010 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.LongWrapper;
020    import com.liferay.portal.kernel.util.MethodWrapper;
021    import com.liferay.portal.kernel.util.NullWrapper;
022    import com.liferay.portal.security.auth.HttpPrincipal;
023    import com.liferay.portal.service.http.TunnelUtil;
024    
025    import com.liferay.portlet.documentlibrary.service.DLFileShortcutServiceUtil;
026    
027    /**
028     * <p>
029     * This class provides a 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     * </p>
035     *
036     * <p>
037     * The benefits of using the HTTP utility is that it is fast and allows for
038     * tunneling without the cost of serializing to text. The drawback is that it
039     * only works with Java.
040     * </p>
041     *
042     * <p>
043     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
044     * configure security.
045     * </p>
046     *
047     * <p>
048     * The HTTP utility is only generated for remote services.
049     * </p>
050     *
051     * @author    Brian Wing Shun Chan
052     * @see       DLFileShortcutServiceSoap
053     * @see       com.liferay.portal.security.auth.HttpPrincipal
054     * @see       com.liferay.portlet.documentlibrary.service.DLFileShortcutServiceUtil
055     * @generated
056     */
057    public class DLFileShortcutServiceHttp {
058            public static com.liferay.portlet.documentlibrary.model.DLFileShortcut addFileShortcut(
059                    HttpPrincipal httpPrincipal, long groupId, long folderId,
060                    long toFolderId, java.lang.String toName,
061                    com.liferay.portal.service.ServiceContext serviceContext)
062                    throws com.liferay.portal.kernel.exception.PortalException,
063                            com.liferay.portal.kernel.exception.SystemException {
064                    try {
065                            Object paramObj0 = new LongWrapper(groupId);
066    
067                            Object paramObj1 = new LongWrapper(folderId);
068    
069                            Object paramObj2 = new LongWrapper(toFolderId);
070    
071                            Object paramObj3 = toName;
072    
073                            if (toName == null) {
074                                    paramObj3 = new NullWrapper("java.lang.String");
075                            }
076    
077                            Object paramObj4 = serviceContext;
078    
079                            if (serviceContext == null) {
080                                    paramObj4 = new NullWrapper(
081                                                    "com.liferay.portal.service.ServiceContext");
082                            }
083    
084                            MethodWrapper methodWrapper = new MethodWrapper(DLFileShortcutServiceUtil.class.getName(),
085                                            "addFileShortcut",
086                                            new Object[] {
087                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
088                                            });
089    
090                            Object returnObj = null;
091    
092                            try {
093                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
094                            }
095                            catch (Exception e) {
096                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
097                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
098                                    }
099    
100                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
101                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
102                                    }
103    
104                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
105                            }
106    
107                            return (com.liferay.portlet.documentlibrary.model.DLFileShortcut)returnObj;
108                    }
109                    catch (com.liferay.portal.kernel.exception.SystemException se) {
110                            _log.error(se, se);
111    
112                            throw se;
113                    }
114            }
115    
116            public static void deleteFileShortcut(HttpPrincipal httpPrincipal,
117                    long fileShortcutId)
118                    throws com.liferay.portal.kernel.exception.PortalException,
119                            com.liferay.portal.kernel.exception.SystemException {
120                    try {
121                            Object paramObj0 = new LongWrapper(fileShortcutId);
122    
123                            MethodWrapper methodWrapper = new MethodWrapper(DLFileShortcutServiceUtil.class.getName(),
124                                            "deleteFileShortcut", new Object[] { paramObj0 });
125    
126                            try {
127                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
128                            }
129                            catch (Exception e) {
130                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
131                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
132                                    }
133    
134                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
135                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
136                                    }
137    
138                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
139                            }
140                    }
141                    catch (com.liferay.portal.kernel.exception.SystemException se) {
142                            _log.error(se, se);
143    
144                            throw se;
145                    }
146            }
147    
148            public static com.liferay.portlet.documentlibrary.model.DLFileShortcut getFileShortcut(
149                    HttpPrincipal httpPrincipal, long fileShortcutId)
150                    throws com.liferay.portal.kernel.exception.PortalException,
151                            com.liferay.portal.kernel.exception.SystemException {
152                    try {
153                            Object paramObj0 = new LongWrapper(fileShortcutId);
154    
155                            MethodWrapper methodWrapper = new MethodWrapper(DLFileShortcutServiceUtil.class.getName(),
156                                            "getFileShortcut", new Object[] { paramObj0 });
157    
158                            Object returnObj = null;
159    
160                            try {
161                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
162                            }
163                            catch (Exception e) {
164                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
165                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
166                                    }
167    
168                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
169                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
170                                    }
171    
172                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
173                            }
174    
175                            return (com.liferay.portlet.documentlibrary.model.DLFileShortcut)returnObj;
176                    }
177                    catch (com.liferay.portal.kernel.exception.SystemException se) {
178                            _log.error(se, se);
179    
180                            throw se;
181                    }
182            }
183    
184            public static com.liferay.portlet.documentlibrary.model.DLFileShortcut updateFileShortcut(
185                    HttpPrincipal httpPrincipal, long fileShortcutId, long folderId,
186                    long toFolderId, java.lang.String toName,
187                    com.liferay.portal.service.ServiceContext serviceContext)
188                    throws com.liferay.portal.kernel.exception.PortalException,
189                            com.liferay.portal.kernel.exception.SystemException {
190                    try {
191                            Object paramObj0 = new LongWrapper(fileShortcutId);
192    
193                            Object paramObj1 = new LongWrapper(folderId);
194    
195                            Object paramObj2 = new LongWrapper(toFolderId);
196    
197                            Object paramObj3 = toName;
198    
199                            if (toName == null) {
200                                    paramObj3 = new NullWrapper("java.lang.String");
201                            }
202    
203                            Object paramObj4 = serviceContext;
204    
205                            if (serviceContext == null) {
206                                    paramObj4 = new NullWrapper(
207                                                    "com.liferay.portal.service.ServiceContext");
208                            }
209    
210                            MethodWrapper methodWrapper = new MethodWrapper(DLFileShortcutServiceUtil.class.getName(),
211                                            "updateFileShortcut",
212                                            new Object[] {
213                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
214                                            });
215    
216                            Object returnObj = null;
217    
218                            try {
219                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
220                            }
221                            catch (Exception e) {
222                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
223                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
224                                    }
225    
226                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
227                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
228                                    }
229    
230                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
231                            }
232    
233                            return (com.liferay.portlet.documentlibrary.model.DLFileShortcut)returnObj;
234                    }
235                    catch (com.liferay.portal.kernel.exception.SystemException se) {
236                            _log.error(se, se);
237    
238                            throw se;
239                    }
240            }
241    
242            private static Log _log = LogFactoryUtil.getLog(DLFileShortcutServiceHttp.class);
243    }