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.trash.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.trash.service.TrashEntryServiceUtil;
025    
026    /**
027     * <p>
028     * This class provides a HTTP utility for the
029     * {@link com.liferay.portlet.trash.service.TrashEntryServiceUtil} 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       TrashEntryServiceSoap
052     * @see       com.liferay.portal.security.auth.HttpPrincipal
053     * @see       com.liferay.portlet.trash.service.TrashEntryServiceUtil
054     * @generated
055     */
056    public class TrashEntryServiceHttp {
057            public static void deleteEntries(HttpPrincipal httpPrincipal, long groupId)
058                    throws com.liferay.portal.kernel.exception.PortalException,
059                            com.liferay.portal.kernel.exception.SystemException {
060                    try {
061                            MethodKey methodKey = new MethodKey(TrashEntryServiceUtil.class,
062                                            "deleteEntries", _deleteEntriesParameterTypes0);
063    
064                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId);
065    
066                            try {
067                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
068                            }
069                            catch (Exception e) {
070                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
071                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
072                                    }
073    
074                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
075                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
076                                    }
077    
078                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
079                            }
080                    }
081                    catch (com.liferay.portal.kernel.exception.SystemException se) {
082                            _log.error(se, se);
083    
084                            throw se;
085                    }
086            }
087    
088            public static void deleteEntries(HttpPrincipal httpPrincipal,
089                    long[] entryIds)
090                    throws com.liferay.portal.kernel.exception.PortalException,
091                            com.liferay.portal.kernel.exception.SystemException {
092                    try {
093                            MethodKey methodKey = new MethodKey(TrashEntryServiceUtil.class,
094                                            "deleteEntries", _deleteEntriesParameterTypes1);
095    
096                            MethodHandler methodHandler = new MethodHandler(methodKey, entryIds);
097    
098                            try {
099                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
100                            }
101                            catch (Exception e) {
102                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
103                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
104                                    }
105    
106                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
107                                            throw (com.liferay.portal.kernel.exception.SystemException)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 void deleteEntry(HttpPrincipal httpPrincipal, long entryId)
121                    throws com.liferay.portal.kernel.exception.PortalException,
122                            com.liferay.portal.kernel.exception.SystemException {
123                    try {
124                            MethodKey methodKey = new MethodKey(TrashEntryServiceUtil.class,
125                                            "deleteEntry", _deleteEntryParameterTypes2);
126    
127                            MethodHandler methodHandler = new MethodHandler(methodKey, entryId);
128    
129                            try {
130                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
131                            }
132                            catch (Exception e) {
133                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
134                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
135                                    }
136    
137                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
138                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
139                                    }
140    
141                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
142                            }
143                    }
144                    catch (com.liferay.portal.kernel.exception.SystemException se) {
145                            _log.error(se, se);
146    
147                            throw se;
148                    }
149            }
150    
151            public static void deleteEntry(HttpPrincipal httpPrincipal,
152                    java.lang.String className, long classPK)
153                    throws com.liferay.portal.kernel.exception.PortalException,
154                            com.liferay.portal.kernel.exception.SystemException {
155                    try {
156                            MethodKey methodKey = new MethodKey(TrashEntryServiceUtil.class,
157                                            "deleteEntry", _deleteEntryParameterTypes3);
158    
159                            MethodHandler methodHandler = new MethodHandler(methodKey,
160                                            className, classPK);
161    
162                            try {
163                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
164                            }
165                            catch (Exception e) {
166                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
167                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
168                                    }
169    
170                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
171                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
172                                    }
173    
174                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
175                            }
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.trash.model.TrashEntryList getEntries(
185                    HttpPrincipal httpPrincipal, long groupId)
186                    throws com.liferay.portal.kernel.exception.SystemException,
187                            com.liferay.portal.security.auth.PrincipalException {
188                    try {
189                            MethodKey methodKey = new MethodKey(TrashEntryServiceUtil.class,
190                                            "getEntries", _getEntriesParameterTypes4);
191    
192                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId);
193    
194                            Object returnObj = null;
195    
196                            try {
197                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
198                            }
199                            catch (Exception e) {
200                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
201                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
202                                    }
203    
204                                    if (e instanceof com.liferay.portal.security.auth.PrincipalException) {
205                                            throw (com.liferay.portal.security.auth.PrincipalException)e;
206                                    }
207    
208                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
209                            }
210    
211                            return (com.liferay.portlet.trash.model.TrashEntryList)returnObj;
212                    }
213                    catch (com.liferay.portal.kernel.exception.SystemException se) {
214                            _log.error(se, se);
215    
216                            throw se;
217                    }
218            }
219    
220            public static com.liferay.portlet.trash.model.TrashEntryList getEntries(
221                    HttpPrincipal httpPrincipal, long groupId, int start, int end,
222                    com.liferay.portal.kernel.util.OrderByComparator obc)
223                    throws com.liferay.portal.kernel.exception.SystemException,
224                            com.liferay.portal.security.auth.PrincipalException {
225                    try {
226                            MethodKey methodKey = new MethodKey(TrashEntryServiceUtil.class,
227                                            "getEntries", _getEntriesParameterTypes5);
228    
229                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
230                                            start, end, obc);
231    
232                            Object returnObj = null;
233    
234                            try {
235                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
236                            }
237                            catch (Exception e) {
238                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
239                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
240                                    }
241    
242                                    if (e instanceof com.liferay.portal.security.auth.PrincipalException) {
243                                            throw (com.liferay.portal.security.auth.PrincipalException)e;
244                                    }
245    
246                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
247                            }
248    
249                            return (com.liferay.portlet.trash.model.TrashEntryList)returnObj;
250                    }
251                    catch (com.liferay.portal.kernel.exception.SystemException se) {
252                            _log.error(se, se);
253    
254                            throw se;
255                    }
256            }
257    
258            public static void moveEntry(HttpPrincipal httpPrincipal,
259                    java.lang.String className, long classPK,
260                    long destinationContainerModelId,
261                    com.liferay.portal.service.ServiceContext serviceContext)
262                    throws com.liferay.portal.kernel.exception.PortalException,
263                            com.liferay.portal.kernel.exception.SystemException {
264                    try {
265                            MethodKey methodKey = new MethodKey(TrashEntryServiceUtil.class,
266                                            "moveEntry", _moveEntryParameterTypes6);
267    
268                            MethodHandler methodHandler = new MethodHandler(methodKey,
269                                            className, classPK, destinationContainerModelId,
270                                            serviceContext);
271    
272                            try {
273                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
274                            }
275                            catch (Exception e) {
276                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
277                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
278                                    }
279    
280                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
281                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
282                                    }
283    
284                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
285                            }
286                    }
287                    catch (com.liferay.portal.kernel.exception.SystemException se) {
288                            _log.error(se, se);
289    
290                            throw se;
291                    }
292            }
293    
294            public static com.liferay.portlet.trash.model.TrashEntry restoreEntry(
295                    HttpPrincipal httpPrincipal, long entryId)
296                    throws com.liferay.portal.kernel.exception.PortalException,
297                            com.liferay.portal.kernel.exception.SystemException {
298                    try {
299                            MethodKey methodKey = new MethodKey(TrashEntryServiceUtil.class,
300                                            "restoreEntry", _restoreEntryParameterTypes7);
301    
302                            MethodHandler methodHandler = new MethodHandler(methodKey, entryId);
303    
304                            Object returnObj = null;
305    
306                            try {
307                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
308                            }
309                            catch (Exception e) {
310                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
311                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
312                                    }
313    
314                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
315                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
316                                    }
317    
318                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
319                            }
320    
321                            return (com.liferay.portlet.trash.model.TrashEntry)returnObj;
322                    }
323                    catch (com.liferay.portal.kernel.exception.SystemException se) {
324                            _log.error(se, se);
325    
326                            throw se;
327                    }
328            }
329    
330            public static com.liferay.portlet.trash.model.TrashEntry restoreEntry(
331                    HttpPrincipal httpPrincipal, long entryId, long overrideClassPK,
332                    java.lang.String name)
333                    throws com.liferay.portal.kernel.exception.PortalException,
334                            com.liferay.portal.kernel.exception.SystemException {
335                    try {
336                            MethodKey methodKey = new MethodKey(TrashEntryServiceUtil.class,
337                                            "restoreEntry", _restoreEntryParameterTypes8);
338    
339                            MethodHandler methodHandler = new MethodHandler(methodKey, entryId,
340                                            overrideClassPK, name);
341    
342                            Object returnObj = null;
343    
344                            try {
345                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
346                            }
347                            catch (Exception e) {
348                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
349                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
350                                    }
351    
352                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
353                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
354                                    }
355    
356                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
357                            }
358    
359                            return (com.liferay.portlet.trash.model.TrashEntry)returnObj;
360                    }
361                    catch (com.liferay.portal.kernel.exception.SystemException se) {
362                            _log.error(se, se);
363    
364                            throw se;
365                    }
366            }
367    
368            private static Log _log = LogFactoryUtil.getLog(TrashEntryServiceHttp.class);
369            private static final Class<?>[] _deleteEntriesParameterTypes0 = new Class[] {
370                            long.class
371                    };
372            private static final Class<?>[] _deleteEntriesParameterTypes1 = new Class[] {
373                            long[].class
374                    };
375            private static final Class<?>[] _deleteEntryParameterTypes2 = new Class[] {
376                            long.class
377                    };
378            private static final Class<?>[] _deleteEntryParameterTypes3 = new Class[] {
379                            java.lang.String.class, long.class
380                    };
381            private static final Class<?>[] _getEntriesParameterTypes4 = new Class[] {
382                            long.class
383                    };
384            private static final Class<?>[] _getEntriesParameterTypes5 = new Class[] {
385                            long.class, int.class, int.class,
386                            com.liferay.portal.kernel.util.OrderByComparator.class
387                    };
388            private static final Class<?>[] _moveEntryParameterTypes6 = new Class[] {
389                            java.lang.String.class, long.class, long.class,
390                            com.liferay.portal.service.ServiceContext.class
391                    };
392            private static final Class<?>[] _restoreEntryParameterTypes7 = new Class[] {
393                            long.class
394                    };
395            private static final Class<?>[] _restoreEntryParameterTypes8 = new Class[] {
396                            long.class, long.class, java.lang.String.class
397                    };
398    }