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     * Provides the HTTP utility for the
028     * {@link com.liferay.portlet.trash.service.TrashEntryServiceUtil} service utility. The
029     * static methods of this class calls the same methods of the service utility.
030     * However, the signatures are different because it requires an additional
031     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
032     *
033     * <p>
034     * The benefits of using the HTTP utility is that it is fast and allows for
035     * tunneling without the cost of serializing to text. The drawback is that it
036     * only works with Java.
037     * </p>
038     *
039     * <p>
040     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
041     * configure security.
042     * </p>
043     *
044     * <p>
045     * The HTTP utility is only generated for remote services.
046     * </p>
047     *
048     * @author Brian Wing Shun Chan
049     * @see TrashEntryServiceSoap
050     * @see com.liferay.portal.security.auth.HttpPrincipal
051     * @see com.liferay.portlet.trash.service.TrashEntryServiceUtil
052     * @generated
053     */
054    public class TrashEntryServiceHttp {
055            public static void deleteEntries(HttpPrincipal httpPrincipal, long groupId)
056                    throws com.liferay.portal.kernel.exception.PortalException,
057                            com.liferay.portal.kernel.exception.SystemException {
058                    try {
059                            MethodKey methodKey = new MethodKey(TrashEntryServiceUtil.class,
060                                            "deleteEntries", _deleteEntriesParameterTypes0);
061    
062                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId);
063    
064                            try {
065                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
066                            }
067                            catch (Exception e) {
068                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
069                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
070                                    }
071    
072                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
073                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
074                                    }
075    
076                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
077                            }
078                    }
079                    catch (com.liferay.portal.kernel.exception.SystemException se) {
080                            _log.error(se, se);
081    
082                            throw se;
083                    }
084            }
085    
086            public static void deleteEntries(HttpPrincipal httpPrincipal,
087                    long[] entryIds)
088                    throws com.liferay.portal.kernel.exception.PortalException,
089                            com.liferay.portal.kernel.exception.SystemException {
090                    try {
091                            MethodKey methodKey = new MethodKey(TrashEntryServiceUtil.class,
092                                            "deleteEntries", _deleteEntriesParameterTypes1);
093    
094                            MethodHandler methodHandler = new MethodHandler(methodKey, entryIds);
095    
096                            try {
097                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
098                            }
099                            catch (Exception e) {
100                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
101                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
102                                    }
103    
104                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
105                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
106                                    }
107    
108                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
109                            }
110                    }
111                    catch (com.liferay.portal.kernel.exception.SystemException se) {
112                            _log.error(se, se);
113    
114                            throw se;
115                    }
116            }
117    
118            public static void deleteEntry(HttpPrincipal httpPrincipal, long entryId)
119                    throws com.liferay.portal.kernel.exception.PortalException,
120                            com.liferay.portal.kernel.exception.SystemException {
121                    try {
122                            MethodKey methodKey = new MethodKey(TrashEntryServiceUtil.class,
123                                            "deleteEntry", _deleteEntryParameterTypes2);
124    
125                            MethodHandler methodHandler = new MethodHandler(methodKey, entryId);
126    
127                            try {
128                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
129                            }
130                            catch (Exception e) {
131                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
132                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
133                                    }
134    
135                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
136                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
137                                    }
138    
139                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
140                            }
141                    }
142                    catch (com.liferay.portal.kernel.exception.SystemException se) {
143                            _log.error(se, se);
144    
145                            throw se;
146                    }
147            }
148    
149            public static void deleteEntry(HttpPrincipal httpPrincipal,
150                    java.lang.String className, long classPK)
151                    throws com.liferay.portal.kernel.exception.PortalException,
152                            com.liferay.portal.kernel.exception.SystemException {
153                    try {
154                            MethodKey methodKey = new MethodKey(TrashEntryServiceUtil.class,
155                                            "deleteEntry", _deleteEntryParameterTypes3);
156    
157                            MethodHandler methodHandler = new MethodHandler(methodKey,
158                                            className, classPK);
159    
160                            try {
161                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
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                    catch (com.liferay.portal.kernel.exception.SystemException se) {
176                            _log.error(se, se);
177    
178                            throw se;
179                    }
180            }
181    
182            public static com.liferay.portlet.trash.model.TrashEntryList getEntries(
183                    HttpPrincipal httpPrincipal, long groupId)
184                    throws com.liferay.portal.kernel.exception.SystemException,
185                            com.liferay.portal.security.auth.PrincipalException {
186                    try {
187                            MethodKey methodKey = new MethodKey(TrashEntryServiceUtil.class,
188                                            "getEntries", _getEntriesParameterTypes4);
189    
190                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId);
191    
192                            Object returnObj = null;
193    
194                            try {
195                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
196                            }
197                            catch (Exception e) {
198                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
199                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
200                                    }
201    
202                                    if (e instanceof com.liferay.portal.security.auth.PrincipalException) {
203                                            throw (com.liferay.portal.security.auth.PrincipalException)e;
204                                    }
205    
206                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
207                            }
208    
209                            return (com.liferay.portlet.trash.model.TrashEntryList)returnObj;
210                    }
211                    catch (com.liferay.portal.kernel.exception.SystemException se) {
212                            _log.error(se, se);
213    
214                            throw se;
215                    }
216            }
217    
218            public static com.liferay.portlet.trash.model.TrashEntryList getEntries(
219                    HttpPrincipal httpPrincipal, long groupId, int start, int end,
220                    com.liferay.portal.kernel.util.OrderByComparator obc)
221                    throws com.liferay.portal.kernel.exception.SystemException,
222                            com.liferay.portal.security.auth.PrincipalException {
223                    try {
224                            MethodKey methodKey = new MethodKey(TrashEntryServiceUtil.class,
225                                            "getEntries", _getEntriesParameterTypes5);
226    
227                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
228                                            start, end, obc);
229    
230                            Object returnObj = null;
231    
232                            try {
233                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
234                            }
235                            catch (Exception e) {
236                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
237                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
238                                    }
239    
240                                    if (e instanceof com.liferay.portal.security.auth.PrincipalException) {
241                                            throw (com.liferay.portal.security.auth.PrincipalException)e;
242                                    }
243    
244                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
245                            }
246    
247                            return (com.liferay.portlet.trash.model.TrashEntryList)returnObj;
248                    }
249                    catch (com.liferay.portal.kernel.exception.SystemException se) {
250                            _log.error(se, se);
251    
252                            throw se;
253                    }
254            }
255    
256            public static void moveEntry(HttpPrincipal httpPrincipal,
257                    java.lang.String className, long classPK,
258                    long destinationContainerModelId,
259                    com.liferay.portal.service.ServiceContext serviceContext)
260                    throws com.liferay.portal.kernel.exception.PortalException,
261                            com.liferay.portal.kernel.exception.SystemException {
262                    try {
263                            MethodKey methodKey = new MethodKey(TrashEntryServiceUtil.class,
264                                            "moveEntry", _moveEntryParameterTypes6);
265    
266                            MethodHandler methodHandler = new MethodHandler(methodKey,
267                                            className, classPK, destinationContainerModelId,
268                                            serviceContext);
269    
270                            try {
271                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
272                            }
273                            catch (Exception e) {
274                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
275                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
276                                    }
277    
278                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
279                                            throw (com.liferay.portal.kernel.exception.SystemException)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                            com.liferay.portal.kernel.exception.SystemException {
296                    try {
297                            MethodKey methodKey = new MethodKey(TrashEntryServiceUtil.class,
298                                            "restoreEntry", _restoreEntryParameterTypes7);
299    
300                            MethodHandler methodHandler = new MethodHandler(methodKey, entryId);
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                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
313                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
314                                    }
315    
316                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
317                            }
318    
319                            return (com.liferay.portlet.trash.model.TrashEntry)returnObj;
320                    }
321                    catch (com.liferay.portal.kernel.exception.SystemException se) {
322                            _log.error(se, se);
323    
324                            throw se;
325                    }
326            }
327    
328            public static com.liferay.portlet.trash.model.TrashEntry restoreEntry(
329                    HttpPrincipal httpPrincipal, long entryId, long overrideClassPK,
330                    java.lang.String name)
331                    throws com.liferay.portal.kernel.exception.PortalException,
332                            com.liferay.portal.kernel.exception.SystemException {
333                    try {
334                            MethodKey methodKey = new MethodKey(TrashEntryServiceUtil.class,
335                                            "restoreEntry", _restoreEntryParameterTypes8);
336    
337                            MethodHandler methodHandler = new MethodHandler(methodKey, entryId,
338                                            overrideClassPK, name);
339    
340                            Object returnObj = null;
341    
342                            try {
343                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
344                            }
345                            catch (Exception e) {
346                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
347                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
348                                    }
349    
350                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
351                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
352                                    }
353    
354                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
355                            }
356    
357                            return (com.liferay.portlet.trash.model.TrashEntry)returnObj;
358                    }
359                    catch (com.liferay.portal.kernel.exception.SystemException se) {
360                            _log.error(se, se);
361    
362                            throw se;
363                    }
364            }
365    
366            private static Log _log = LogFactoryUtil.getLog(TrashEntryServiceHttp.class);
367            private static final Class<?>[] _deleteEntriesParameterTypes0 = new Class[] {
368                            long.class
369                    };
370            private static final Class<?>[] _deleteEntriesParameterTypes1 = new Class[] {
371                            long[].class
372                    };
373            private static final Class<?>[] _deleteEntryParameterTypes2 = new Class[] {
374                            long.class
375                    };
376            private static final Class<?>[] _deleteEntryParameterTypes3 = new Class[] {
377                            java.lang.String.class, long.class
378                    };
379            private static final Class<?>[] _getEntriesParameterTypes4 = new Class[] {
380                            long.class
381                    };
382            private static final Class<?>[] _getEntriesParameterTypes5 = new Class[] {
383                            long.class, int.class, int.class,
384                            com.liferay.portal.kernel.util.OrderByComparator.class
385                    };
386            private static final Class<?>[] _moveEntryParameterTypes6 = new Class[] {
387                            java.lang.String.class, long.class, long.class,
388                            com.liferay.portal.service.ServiceContext.class
389                    };
390            private static final Class<?>[] _restoreEntryParameterTypes7 = new Class[] {
391                            long.class
392                    };
393            private static final Class<?>[] _restoreEntryParameterTypes8 = new Class[] {
394                            long.class, long.class, java.lang.String.class
395                    };
396    }