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.asset.service.http;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.asset.kernel.service.AssetEntryServiceUtil;
020    
021    import com.liferay.portal.kernel.log.Log;
022    import com.liferay.portal.kernel.log.LogFactoryUtil;
023    import com.liferay.portal.kernel.security.auth.HttpPrincipal;
024    import com.liferay.portal.kernel.service.http.TunnelUtil;
025    import com.liferay.portal.kernel.util.MethodHandler;
026    import com.liferay.portal.kernel.util.MethodKey;
027    
028    /**
029     * Provides the HTTP utility for the
030     * {@link AssetEntryServiceUtil} 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 AssetEntryServiceSoap
052     * @see HttpPrincipal
053     * @see AssetEntryServiceUtil
054     * @generated
055     */
056    @ProviderType
057    public class AssetEntryServiceHttp {
058            public static com.liferay.asset.kernel.model.AssetEntry fetchEntry(
059                    HttpPrincipal httpPrincipal, long entryId)
060                    throws com.liferay.portal.kernel.exception.PortalException {
061                    try {
062                            MethodKey methodKey = new MethodKey(AssetEntryServiceUtil.class,
063                                            "fetchEntry", _fetchEntryParameterTypes0);
064    
065                            MethodHandler methodHandler = new MethodHandler(methodKey, entryId);
066    
067                            Object returnObj = null;
068    
069                            try {
070                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
071                            }
072                            catch (Exception e) {
073                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
074                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
075                                    }
076    
077                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
078                            }
079    
080                            return (com.liferay.asset.kernel.model.AssetEntry)returnObj;
081                    }
082                    catch (com.liferay.portal.kernel.exception.SystemException se) {
083                            _log.error(se, se);
084    
085                            throw se;
086                    }
087            }
088    
089            public static java.util.List<com.liferay.asset.kernel.model.AssetEntry> getCompanyEntries(
090                    HttpPrincipal httpPrincipal, long companyId, int start, int end) {
091                    try {
092                            MethodKey methodKey = new MethodKey(AssetEntryServiceUtil.class,
093                                            "getCompanyEntries", _getCompanyEntriesParameterTypes1);
094    
095                            MethodHandler methodHandler = new MethodHandler(methodKey,
096                                            companyId, start, end);
097    
098                            Object returnObj = null;
099    
100                            try {
101                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
102                            }
103                            catch (Exception e) {
104                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
105                            }
106    
107                            return (java.util.List<com.liferay.asset.kernel.model.AssetEntry>)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 int getCompanyEntriesCount(HttpPrincipal httpPrincipal,
117                    long companyId) {
118                    try {
119                            MethodKey methodKey = new MethodKey(AssetEntryServiceUtil.class,
120                                            "getCompanyEntriesCount",
121                                            _getCompanyEntriesCountParameterTypes2);
122    
123                            MethodHandler methodHandler = new MethodHandler(methodKey, companyId);
124    
125                            Object returnObj = null;
126    
127                            try {
128                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
129                            }
130                            catch (Exception e) {
131                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
132                            }
133    
134                            return ((Integer)returnObj).intValue();
135                    }
136                    catch (com.liferay.portal.kernel.exception.SystemException se) {
137                            _log.error(se, se);
138    
139                            throw se;
140                    }
141            }
142    
143            public static java.util.List<com.liferay.asset.kernel.model.AssetEntry> getEntries(
144                    HttpPrincipal httpPrincipal,
145                    com.liferay.asset.kernel.service.persistence.AssetEntryQuery entryQuery)
146                    throws com.liferay.portal.kernel.exception.PortalException {
147                    try {
148                            MethodKey methodKey = new MethodKey(AssetEntryServiceUtil.class,
149                                            "getEntries", _getEntriesParameterTypes3);
150    
151                            MethodHandler methodHandler = new MethodHandler(methodKey,
152                                            entryQuery);
153    
154                            Object returnObj = null;
155    
156                            try {
157                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
158                            }
159                            catch (Exception e) {
160                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
161                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
162                                    }
163    
164                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
165                            }
166    
167                            return (java.util.List<com.liferay.asset.kernel.model.AssetEntry>)returnObj;
168                    }
169                    catch (com.liferay.portal.kernel.exception.SystemException se) {
170                            _log.error(se, se);
171    
172                            throw se;
173                    }
174            }
175    
176            public static int getEntriesCount(HttpPrincipal httpPrincipal,
177                    com.liferay.asset.kernel.service.persistence.AssetEntryQuery entryQuery)
178                    throws com.liferay.portal.kernel.exception.PortalException {
179                    try {
180                            MethodKey methodKey = new MethodKey(AssetEntryServiceUtil.class,
181                                            "getEntriesCount", _getEntriesCountParameterTypes4);
182    
183                            MethodHandler methodHandler = new MethodHandler(methodKey,
184                                            entryQuery);
185    
186                            Object returnObj = null;
187    
188                            try {
189                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
190                            }
191                            catch (Exception e) {
192                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
193                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
194                                    }
195    
196                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
197                            }
198    
199                            return ((Integer)returnObj).intValue();
200                    }
201                    catch (com.liferay.portal.kernel.exception.SystemException se) {
202                            _log.error(se, se);
203    
204                            throw se;
205                    }
206            }
207    
208            public static com.liferay.asset.kernel.model.AssetEntry getEntry(
209                    HttpPrincipal httpPrincipal, long entryId)
210                    throws com.liferay.portal.kernel.exception.PortalException {
211                    try {
212                            MethodKey methodKey = new MethodKey(AssetEntryServiceUtil.class,
213                                            "getEntry", _getEntryParameterTypes5);
214    
215                            MethodHandler methodHandler = new MethodHandler(methodKey, entryId);
216    
217                            Object returnObj = null;
218    
219                            try {
220                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
221                            }
222                            catch (Exception e) {
223                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
224                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
225                                    }
226    
227                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
228                            }
229    
230                            return (com.liferay.asset.kernel.model.AssetEntry)returnObj;
231                    }
232                    catch (com.liferay.portal.kernel.exception.SystemException se) {
233                            _log.error(se, se);
234    
235                            throw se;
236                    }
237            }
238    
239            public static com.liferay.asset.kernel.model.AssetEntry incrementViewCounter(
240                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK)
241                    throws com.liferay.portal.kernel.exception.PortalException {
242                    try {
243                            MethodKey methodKey = new MethodKey(AssetEntryServiceUtil.class,
244                                            "incrementViewCounter", _incrementViewCounterParameterTypes6);
245    
246                            MethodHandler methodHandler = new MethodHandler(methodKey,
247                                            className, classPK);
248    
249                            Object returnObj = null;
250    
251                            try {
252                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
253                            }
254                            catch (Exception e) {
255                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
256                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
257                                    }
258    
259                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
260                            }
261    
262                            return (com.liferay.asset.kernel.model.AssetEntry)returnObj;
263                    }
264                    catch (com.liferay.portal.kernel.exception.SystemException se) {
265                            _log.error(se, se);
266    
267                            throw se;
268                    }
269            }
270    
271            public static com.liferay.asset.kernel.model.AssetEntry updateEntry(
272                    HttpPrincipal httpPrincipal, long groupId, java.util.Date createDate,
273                    java.util.Date modifiedDate, java.lang.String className, long classPK,
274                    java.lang.String classUuid, long classTypeId, long[] categoryIds,
275                    java.lang.String[] tagNames, boolean listable, boolean visible,
276                    java.util.Date startDate, java.util.Date endDate,
277                    java.util.Date publishDate, java.util.Date expirationDate,
278                    java.lang.String mimeType, java.lang.String title,
279                    java.lang.String description, java.lang.String summary,
280                    java.lang.String url, java.lang.String layoutUuid, int height,
281                    int width, java.lang.Double priority)
282                    throws com.liferay.portal.kernel.exception.PortalException {
283                    try {
284                            MethodKey methodKey = new MethodKey(AssetEntryServiceUtil.class,
285                                            "updateEntry", _updateEntryParameterTypes7);
286    
287                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
288                                            createDate, modifiedDate, className, classPK, classUuid,
289                                            classTypeId, categoryIds, tagNames, listable, visible,
290                                            startDate, endDate, publishDate, expirationDate, mimeType,
291                                            title, description, summary, url, layoutUuid, height,
292                                            width, priority);
293    
294                            Object returnObj = null;
295    
296                            try {
297                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
298                            }
299                            catch (Exception e) {
300                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
301                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
302                                    }
303    
304                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
305                            }
306    
307                            return (com.liferay.asset.kernel.model.AssetEntry)returnObj;
308                    }
309                    catch (com.liferay.portal.kernel.exception.SystemException se) {
310                            _log.error(se, se);
311    
312                            throw se;
313                    }
314            }
315    
316            public static com.liferay.asset.kernel.model.AssetEntry updateEntry(
317                    HttpPrincipal httpPrincipal, long groupId, java.util.Date createDate,
318                    java.util.Date modifiedDate, java.lang.String className, long classPK,
319                    java.lang.String classUuid, long classTypeId, long[] categoryIds,
320                    java.lang.String[] tagNames, boolean listable, boolean visible,
321                    java.util.Date startDate, java.util.Date endDate,
322                    java.util.Date expirationDate, java.lang.String mimeType,
323                    java.lang.String title, java.lang.String description,
324                    java.lang.String summary, java.lang.String url,
325                    java.lang.String layoutUuid, int height, int width,
326                    java.lang.Double priority)
327                    throws com.liferay.portal.kernel.exception.PortalException {
328                    try {
329                            MethodKey methodKey = new MethodKey(AssetEntryServiceUtil.class,
330                                            "updateEntry", _updateEntryParameterTypes8);
331    
332                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
333                                            createDate, modifiedDate, className, classPK, classUuid,
334                                            classTypeId, categoryIds, tagNames, listable, visible,
335                                            startDate, endDate, expirationDate, mimeType, title,
336                                            description, summary, url, layoutUuid, height, width,
337                                            priority);
338    
339                            Object returnObj = null;
340    
341                            try {
342                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
343                            }
344                            catch (Exception e) {
345                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
346                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
347                                    }
348    
349                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
350                            }
351    
352                            return (com.liferay.asset.kernel.model.AssetEntry)returnObj;
353                    }
354                    catch (com.liferay.portal.kernel.exception.SystemException se) {
355                            _log.error(se, se);
356    
357                            throw se;
358                    }
359            }
360    
361            public static com.liferay.asset.kernel.model.AssetEntry updateEntry(
362                    HttpPrincipal httpPrincipal, long groupId, java.util.Date createDate,
363                    java.util.Date modifiedDate, java.lang.String className, long classPK,
364                    java.lang.String classUuid, long classTypeId, long[] categoryIds,
365                    java.lang.String[] tagNames, boolean visible, java.util.Date startDate,
366                    java.util.Date endDate, java.util.Date expirationDate,
367                    java.lang.String mimeType, java.lang.String title,
368                    java.lang.String description, java.lang.String summary,
369                    java.lang.String url, java.lang.String layoutUuid, int height,
370                    int width, java.lang.Integer priority, boolean sync)
371                    throws com.liferay.portal.kernel.exception.PortalException {
372                    try {
373                            MethodKey methodKey = new MethodKey(AssetEntryServiceUtil.class,
374                                            "updateEntry", _updateEntryParameterTypes9);
375    
376                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
377                                            createDate, modifiedDate, className, classPK, classUuid,
378                                            classTypeId, categoryIds, tagNames, visible, startDate,
379                                            endDate, expirationDate, mimeType, title, description,
380                                            summary, url, layoutUuid, height, width, priority, sync);
381    
382                            Object returnObj = null;
383    
384                            try {
385                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
386                            }
387                            catch (Exception e) {
388                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
389                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
390                                    }
391    
392                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
393                            }
394    
395                            return (com.liferay.asset.kernel.model.AssetEntry)returnObj;
396                    }
397                    catch (com.liferay.portal.kernel.exception.SystemException se) {
398                            _log.error(se, se);
399    
400                            throw se;
401                    }
402            }
403    
404            private static Log _log = LogFactoryUtil.getLog(AssetEntryServiceHttp.class);
405            private static final Class<?>[] _fetchEntryParameterTypes0 = new Class[] {
406                            long.class
407                    };
408            private static final Class<?>[] _getCompanyEntriesParameterTypes1 = new Class[] {
409                            long.class, int.class, int.class
410                    };
411            private static final Class<?>[] _getCompanyEntriesCountParameterTypes2 = new Class[] {
412                            long.class
413                    };
414            private static final Class<?>[] _getEntriesParameterTypes3 = new Class[] {
415                            com.liferay.asset.kernel.service.persistence.AssetEntryQuery.class
416                    };
417            private static final Class<?>[] _getEntriesCountParameterTypes4 = new Class[] {
418                            com.liferay.asset.kernel.service.persistence.AssetEntryQuery.class
419                    };
420            private static final Class<?>[] _getEntryParameterTypes5 = new Class[] {
421                            long.class
422                    };
423            private static final Class<?>[] _incrementViewCounterParameterTypes6 = new Class[] {
424                            java.lang.String.class, long.class
425                    };
426            private static final Class<?>[] _updateEntryParameterTypes7 = new Class[] {
427                            long.class, java.util.Date.class, java.util.Date.class,
428                            java.lang.String.class, long.class, java.lang.String.class,
429                            long.class, long[].class, java.lang.String[].class, boolean.class,
430                            boolean.class, java.util.Date.class, java.util.Date.class,
431                            java.util.Date.class, java.util.Date.class, java.lang.String.class,
432                            java.lang.String.class, java.lang.String.class,
433                            java.lang.String.class, java.lang.String.class,
434                            java.lang.String.class, int.class, int.class, java.lang.Double.class
435                    };
436            private static final Class<?>[] _updateEntryParameterTypes8 = new Class[] {
437                            long.class, java.util.Date.class, java.util.Date.class,
438                            java.lang.String.class, long.class, java.lang.String.class,
439                            long.class, long[].class, java.lang.String[].class, boolean.class,
440                            boolean.class, java.util.Date.class, java.util.Date.class,
441                            java.util.Date.class, java.lang.String.class, java.lang.String.class,
442                            java.lang.String.class, java.lang.String.class,
443                            java.lang.String.class, java.lang.String.class, int.class, int.class,
444                            java.lang.Double.class
445                    };
446            private static final Class<?>[] _updateEntryParameterTypes9 = new Class[] {
447                            long.class, java.util.Date.class, java.util.Date.class,
448                            java.lang.String.class, long.class, java.lang.String.class,
449                            long.class, long[].class, java.lang.String[].class, boolean.class,
450                            java.util.Date.class, java.util.Date.class, java.util.Date.class,
451                            java.lang.String.class, java.lang.String.class,
452                            java.lang.String.class, java.lang.String.class,
453                            java.lang.String.class, java.lang.String.class, int.class, int.class,
454                            java.lang.Integer.class, boolean.class
455                    };
456    }