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 com.liferay.portlet.trash.service.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 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 TrashEntryServiceSoap
052     * @see com.liferay.portal.security.auth.HttpPrincipal
053     * @see com.liferay.portlet.trash.service.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 void moveEntry(HttpPrincipal httpPrincipal,
230                    java.lang.String className, long classPK,
231                    long destinationContainerModelId,
232                    com.liferay.portal.service.ServiceContext serviceContext)
233                    throws com.liferay.portal.kernel.exception.PortalException {
234                    try {
235                            MethodKey methodKey = new MethodKey(TrashEntryServiceUtil.class,
236                                            "moveEntry", _moveEntryParameterTypes6);
237    
238                            MethodHandler methodHandler = new MethodHandler(methodKey,
239                                            className, classPK, destinationContainerModelId,
240                                            serviceContext);
241    
242                            try {
243                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
244                            }
245                            catch (Exception e) {
246                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
247                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
248                                    }
249    
250                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
251                            }
252                    }
253                    catch (com.liferay.portal.kernel.exception.SystemException se) {
254                            _log.error(se, se);
255    
256                            throw se;
257                    }
258            }
259    
260            public static com.liferay.portlet.trash.model.TrashEntry restoreEntry(
261                    HttpPrincipal httpPrincipal, long entryId)
262                    throws com.liferay.portal.kernel.exception.PortalException {
263                    try {
264                            MethodKey methodKey = new MethodKey(TrashEntryServiceUtil.class,
265                                            "restoreEntry", _restoreEntryParameterTypes7);
266    
267                            MethodHandler methodHandler = new MethodHandler(methodKey, entryId);
268    
269                            Object returnObj = null;
270    
271                            try {
272                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
273                            }
274                            catch (Exception e) {
275                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
276                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
277                                    }
278    
279                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
280                            }
281    
282                            return (com.liferay.portlet.trash.model.TrashEntry)returnObj;
283                    }
284                    catch (com.liferay.portal.kernel.exception.SystemException se) {
285                            _log.error(se, se);
286    
287                            throw se;
288                    }
289            }
290    
291            public static com.liferay.portlet.trash.model.TrashEntry restoreEntry(
292                    HttpPrincipal httpPrincipal, long entryId, long overrideClassPK,
293                    java.lang.String name)
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                                            overrideClassPK, name);
301    
302                            Object returnObj = null;
303    
304                            try {
305                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
306                            }
307                            catch (Exception e) {
308                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
309                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
310                                    }
311    
312                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
313                            }
314    
315                            return (com.liferay.portlet.trash.model.TrashEntry)returnObj;
316                    }
317                    catch (com.liferay.portal.kernel.exception.SystemException se) {
318                            _log.error(se, se);
319    
320                            throw se;
321                    }
322            }
323    
324            public static com.liferay.portlet.trash.model.TrashEntry restoreEntry(
325                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK)
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,
332                                            className, classPK);
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                    long overrideClassPK, java.lang.String name)
359                    throws com.liferay.portal.kernel.exception.PortalException {
360                    try {
361                            MethodKey methodKey = new MethodKey(TrashEntryServiceUtil.class,
362                                            "restoreEntry", _restoreEntryParameterTypes10);
363    
364                            MethodHandler methodHandler = new MethodHandler(methodKey,
365                                            className, classPK, overrideClassPK, name);
366    
367                            Object returnObj = null;
368    
369                            try {
370                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
371                            }
372                            catch (Exception e) {
373                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
374                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
375                                    }
376    
377                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
378                            }
379    
380                            return (com.liferay.portlet.trash.model.TrashEntry)returnObj;
381                    }
382                    catch (com.liferay.portal.kernel.exception.SystemException se) {
383                            _log.error(se, se);
384    
385                            throw se;
386                    }
387            }
388    
389            private static Log _log = LogFactoryUtil.getLog(TrashEntryServiceHttp.class);
390            private static final Class<?>[] _deleteEntriesParameterTypes0 = new Class[] {
391                            long.class
392                    };
393            private static final Class<?>[] _deleteEntriesParameterTypes1 = new Class[] {
394                            long[].class
395                    };
396            private static final Class<?>[] _deleteEntryParameterTypes2 = new Class[] {
397                            long.class
398                    };
399            private static final Class<?>[] _deleteEntryParameterTypes3 = new Class[] {
400                            java.lang.String.class, long.class
401                    };
402            private static final Class<?>[] _getEntriesParameterTypes4 = new Class[] {
403                            long.class
404                    };
405            private static final Class<?>[] _getEntriesParameterTypes5 = new Class[] {
406                            long.class, int.class, int.class,
407                            com.liferay.portal.kernel.util.OrderByComparator.class
408                    };
409            private static final Class<?>[] _moveEntryParameterTypes6 = new Class[] {
410                            java.lang.String.class, long.class, long.class,
411                            com.liferay.portal.service.ServiceContext.class
412                    };
413            private static final Class<?>[] _restoreEntryParameterTypes7 = new Class[] {
414                            long.class
415                    };
416            private static final Class<?>[] _restoreEntryParameterTypes8 = new Class[] {
417                            long.class, long.class, java.lang.String.class
418                    };
419            private static final Class<?>[] _restoreEntryParameterTypes9 = new Class[] {
420                            java.lang.String.class, long.class
421                    };
422            private static final Class<?>[] _restoreEntryParameterTypes10 = new Class[] {
423                            java.lang.String.class, long.class, long.class,
424                            java.lang.String.class
425                    };
426    }