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.trash.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.trash.service.TrashEntryServiceUtil;
027    
028    /**
029     * Provides the HTTP utility for the
030     * {@link TrashEntryServiceUtil} 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 TrashEntryServiceSoap
052     * @see HttpPrincipal
053     * @see TrashEntryServiceUtil
054     * @generated
055     */
056    @ProviderType
057    public class TrashEntryServiceHttp {
058            public static void deleteEntries(HttpPrincipal httpPrincipal, long groupId)
059                    throws com.liferay.portal.kernel.exception.PortalException {
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                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
075                            }
076                    }
077                    catch (com.liferay.portal.kernel.exception.SystemException se) {
078                            _log.error(se, se);
079    
080                            throw se;
081                    }
082            }
083    
084            public static void deleteEntries(HttpPrincipal httpPrincipal,
085                    long[] entryIds)
086                    throws com.liferay.portal.kernel.exception.PortalException {
087                    try {
088                            MethodKey methodKey = new MethodKey(TrashEntryServiceUtil.class,
089                                            "deleteEntries", _deleteEntriesParameterTypes1);
090    
091                            MethodHandler methodHandler = new MethodHandler(methodKey, entryIds);
092    
093                            try {
094                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
095                            }
096                            catch (Exception e) {
097                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
098                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
099                                    }
100    
101                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
102                            }
103                    }
104                    catch (com.liferay.portal.kernel.exception.SystemException se) {
105                            _log.error(se, se);
106    
107                            throw se;
108                    }
109            }
110    
111            public static void deleteEntry(HttpPrincipal httpPrincipal, long entryId)
112                    throws com.liferay.portal.kernel.exception.PortalException {
113                    try {
114                            MethodKey methodKey = new MethodKey(TrashEntryServiceUtil.class,
115                                            "deleteEntry", _deleteEntryParameterTypes2);
116    
117                            MethodHandler methodHandler = new MethodHandler(methodKey, entryId);
118    
119                            try {
120                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
121                            }
122                            catch (Exception e) {
123                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
124                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
125                                    }
126    
127                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
128                            }
129                    }
130                    catch (com.liferay.portal.kernel.exception.SystemException se) {
131                            _log.error(se, se);
132    
133                            throw se;
134                    }
135            }
136    
137            public static void deleteEntry(HttpPrincipal httpPrincipal,
138                    java.lang.String className, long classPK)
139                    throws com.liferay.portal.kernel.exception.PortalException {
140                    try {
141                            MethodKey methodKey = new MethodKey(TrashEntryServiceUtil.class,
142                                            "deleteEntry", _deleteEntryParameterTypes3);
143    
144                            MethodHandler methodHandler = new MethodHandler(methodKey,
145                                            className, classPK);
146    
147                            try {
148                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
149                            }
150                            catch (Exception e) {
151                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
152                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
153                                    }
154    
155                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
156                            }
157                    }
158                    catch (com.liferay.portal.kernel.exception.SystemException se) {
159                            _log.error(se, se);
160    
161                            throw se;
162                    }
163            }
164    
165            public static com.liferay.portlet.trash.model.TrashEntryList getEntries(
166                    HttpPrincipal httpPrincipal, long groupId)
167                    throws com.liferay.portal.security.auth.PrincipalException {
168                    try {
169                            MethodKey methodKey = new MethodKey(TrashEntryServiceUtil.class,
170                                            "getEntries", _getEntriesParameterTypes4);
171    
172                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId);
173    
174                            Object returnObj = null;
175    
176                            try {
177                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
178                            }
179                            catch (Exception e) {
180                                    if (e instanceof com.liferay.portal.security.auth.PrincipalException) {
181                                            throw (com.liferay.portal.security.auth.PrincipalException)e;
182                                    }
183    
184                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
185                            }
186    
187                            return (com.liferay.portlet.trash.model.TrashEntryList)returnObj;
188                    }
189                    catch (com.liferay.portal.kernel.exception.SystemException se) {
190                            _log.error(se, se);
191    
192                            throw se;
193                    }
194            }
195    
196            public static com.liferay.portlet.trash.model.TrashEntryList getEntries(
197                    HttpPrincipal httpPrincipal, long groupId, int start, int end,
198                    com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portlet.trash.model.TrashEntry> obc)
199                    throws com.liferay.portal.security.auth.PrincipalException {
200                    try {
201                            MethodKey methodKey = new MethodKey(TrashEntryServiceUtil.class,
202                                            "getEntries", _getEntriesParameterTypes5);
203    
204                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
205                                            start, end, obc);
206    
207                            Object returnObj = null;
208    
209                            try {
210                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
211                            }
212                            catch (Exception e) {
213                                    if (e instanceof com.liferay.portal.security.auth.PrincipalException) {
214                                            throw (com.liferay.portal.security.auth.PrincipalException)e;
215                                    }
216    
217                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
218                            }
219    
220                            return (com.liferay.portlet.trash.model.TrashEntryList)returnObj;
221                    }
222                    catch (com.liferay.portal.kernel.exception.SystemException se) {
223                            _log.error(se, se);
224    
225                            throw se;
226                    }
227            }
228    
229            public static java.util.List<com.liferay.portlet.trash.model.TrashEntry> getEntries(
230                    HttpPrincipal httpPrincipal, long groupId, java.lang.String className)
231                    throws com.liferay.portal.security.auth.PrincipalException {
232                    try {
233                            MethodKey methodKey = new MethodKey(TrashEntryServiceUtil.class,
234                                            "getEntries", _getEntriesParameterTypes6);
235    
236                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
237                                            className);
238    
239                            Object returnObj = null;
240    
241                            try {
242                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
243                            }
244                            catch (Exception e) {
245                                    if (e instanceof com.liferay.portal.security.auth.PrincipalException) {
246                                            throw (com.liferay.portal.security.auth.PrincipalException)e;
247                                    }
248    
249                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
250                            }
251    
252                            return (java.util.List<com.liferay.portlet.trash.model.TrashEntry>)returnObj;
253                    }
254                    catch (com.liferay.portal.kernel.exception.SystemException se) {
255                            _log.error(se, se);
256    
257                            throw se;
258                    }
259            }
260    
261            public static void moveEntry(HttpPrincipal httpPrincipal,
262                    java.lang.String className, long classPK,
263                    long destinationContainerModelId,
264                    com.liferay.portal.service.ServiceContext serviceContext)
265                    throws com.liferay.portal.kernel.exception.PortalException {
266                    try {
267                            MethodKey methodKey = new MethodKey(TrashEntryServiceUtil.class,
268                                            "moveEntry", _moveEntryParameterTypes7);
269    
270                            MethodHandler methodHandler = new MethodHandler(methodKey,
271                                            className, classPK, destinationContainerModelId,
272                                            serviceContext);
273    
274                            try {
275                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
276                            }
277                            catch (Exception e) {
278                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
279                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
280                                    }
281    
282                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
283                            }
284                    }
285                    catch (com.liferay.portal.kernel.exception.SystemException se) {
286                            _log.error(se, se);
287    
288                            throw se;
289                    }
290            }
291    
292            public static com.liferay.portlet.trash.model.TrashEntry restoreEntry(
293                    HttpPrincipal httpPrincipal, long entryId)
294                    throws com.liferay.portal.kernel.exception.PortalException {
295                    try {
296                            MethodKey methodKey = new MethodKey(TrashEntryServiceUtil.class,
297                                            "restoreEntry", _restoreEntryParameterTypes8);
298    
299                            MethodHandler methodHandler = new MethodHandler(methodKey, entryId);
300    
301                            Object returnObj = null;
302    
303                            try {
304                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
305                            }
306                            catch (Exception e) {
307                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
308                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
309                                    }
310    
311                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
312                            }
313    
314                            return (com.liferay.portlet.trash.model.TrashEntry)returnObj;
315                    }
316                    catch (com.liferay.portal.kernel.exception.SystemException se) {
317                            _log.error(se, se);
318    
319                            throw se;
320                    }
321            }
322    
323            public static com.liferay.portlet.trash.model.TrashEntry restoreEntry(
324                    HttpPrincipal httpPrincipal, long entryId, long overrideClassPK,
325                    java.lang.String name)
326                    throws com.liferay.portal.kernel.exception.PortalException {
327                    try {
328                            MethodKey methodKey = new MethodKey(TrashEntryServiceUtil.class,
329                                            "restoreEntry", _restoreEntryParameterTypes9);
330    
331                            MethodHandler methodHandler = new MethodHandler(methodKey, entryId,
332                                            overrideClassPK, name);
333    
334                            Object returnObj = null;
335    
336                            try {
337                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
338                            }
339                            catch (Exception e) {
340                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
341                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
342                                    }
343    
344                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
345                            }
346    
347                            return (com.liferay.portlet.trash.model.TrashEntry)returnObj;
348                    }
349                    catch (com.liferay.portal.kernel.exception.SystemException se) {
350                            _log.error(se, se);
351    
352                            throw se;
353                    }
354            }
355    
356            public static com.liferay.portlet.trash.model.TrashEntry restoreEntry(
357                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK)
358                    throws com.liferay.portal.kernel.exception.PortalException {
359                    try {
360                            MethodKey methodKey = new MethodKey(TrashEntryServiceUtil.class,
361                                            "restoreEntry", _restoreEntryParameterTypes10);
362    
363                            MethodHandler methodHandler = new MethodHandler(methodKey,
364                                            className, classPK);
365    
366                            Object returnObj = null;
367    
368                            try {
369                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
370                            }
371                            catch (Exception e) {
372                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
373                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
374                                    }
375    
376                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
377                            }
378    
379                            return (com.liferay.portlet.trash.model.TrashEntry)returnObj;
380                    }
381                    catch (com.liferay.portal.kernel.exception.SystemException se) {
382                            _log.error(se, se);
383    
384                            throw se;
385                    }
386            }
387    
388            public static com.liferay.portlet.trash.model.TrashEntry restoreEntry(
389                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK,
390                    long overrideClassPK, java.lang.String name)
391                    throws com.liferay.portal.kernel.exception.PortalException {
392                    try {
393                            MethodKey methodKey = new MethodKey(TrashEntryServiceUtil.class,
394                                            "restoreEntry", _restoreEntryParameterTypes11);
395    
396                            MethodHandler methodHandler = new MethodHandler(methodKey,
397                                            className, classPK, overrideClassPK, name);
398    
399                            Object returnObj = null;
400    
401                            try {
402                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
403                            }
404                            catch (Exception e) {
405                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
406                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
407                                    }
408    
409                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
410                            }
411    
412                            return (com.liferay.portlet.trash.model.TrashEntry)returnObj;
413                    }
414                    catch (com.liferay.portal.kernel.exception.SystemException se) {
415                            _log.error(se, se);
416    
417                            throw se;
418                    }
419            }
420    
421            private static Log _log = LogFactoryUtil.getLog(TrashEntryServiceHttp.class);
422            private static final Class<?>[] _deleteEntriesParameterTypes0 = new Class[] {
423                            long.class
424                    };
425            private static final Class<?>[] _deleteEntriesParameterTypes1 = new Class[] {
426                            long[].class
427                    };
428            private static final Class<?>[] _deleteEntryParameterTypes2 = new Class[] {
429                            long.class
430                    };
431            private static final Class<?>[] _deleteEntryParameterTypes3 = new Class[] {
432                            java.lang.String.class, long.class
433                    };
434            private static final Class<?>[] _getEntriesParameterTypes4 = new Class[] {
435                            long.class
436                    };
437            private static final Class<?>[] _getEntriesParameterTypes5 = new Class[] {
438                            long.class, int.class, int.class,
439                            com.liferay.portal.kernel.util.OrderByComparator.class
440                    };
441            private static final Class<?>[] _getEntriesParameterTypes6 = new Class[] {
442                            long.class, java.lang.String.class
443                    };
444            private static final Class<?>[] _moveEntryParameterTypes7 = new Class[] {
445                            java.lang.String.class, long.class, long.class,
446                            com.liferay.portal.service.ServiceContext.class
447                    };
448            private static final Class<?>[] _restoreEntryParameterTypes8 = new Class[] {
449                            long.class
450                    };
451            private static final Class<?>[] _restoreEntryParameterTypes9 = new Class[] {
452                            long.class, long.class, java.lang.String.class
453                    };
454            private static final Class<?>[] _restoreEntryParameterTypes10 = new Class[] {
455                            java.lang.String.class, long.class
456                    };
457            private static final Class<?>[] _restoreEntryParameterTypes11 = new Class[] {
458                            java.lang.String.class, long.class, long.class,
459                            java.lang.String.class
460                    };
461    }