001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portlet.asset.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.asset.service.AssetEntryServiceUtil;
025    
026    /**
027     * <p>
028     * This class provides a HTTP utility for the
029     * {@link com.liferay.portlet.asset.service.AssetEntryServiceUtil} service utility. The
030     * static methods of this class calls the same methods of the service utility.
031     * However, the signatures are different because it requires an additional
032     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
033     * </p>
034     *
035     * <p>
036     * The benefits of using the HTTP utility is that it is fast and allows for
037     * tunneling without the cost of serializing to text. The drawback is that it
038     * only works with Java.
039     * </p>
040     *
041     * <p>
042     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
043     * configure security.
044     * </p>
045     *
046     * <p>
047     * The HTTP utility is only generated for remote services.
048     * </p>
049     *
050     * @author    Brian Wing Shun Chan
051     * @see       AssetEntryServiceSoap
052     * @see       com.liferay.portal.security.auth.HttpPrincipal
053     * @see       com.liferay.portlet.asset.service.AssetEntryServiceUtil
054     * @generated
055     */
056    public class AssetEntryServiceHttp {
057            public static java.util.List<com.liferay.portlet.asset.model.AssetEntry> getCompanyEntries(
058                    HttpPrincipal httpPrincipal, long companyId, int start, int end)
059                    throws com.liferay.portal.kernel.exception.SystemException {
060                    try {
061                            MethodKey methodKey = new MethodKey(AssetEntryServiceUtil.class.getName(),
062                                            "getCompanyEntries", _getCompanyEntriesParameterTypes0);
063    
064                            MethodHandler methodHandler = new MethodHandler(methodKey,
065                                            companyId, start, end);
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.SystemException) {
074                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
075                                    }
076    
077                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
078                            }
079    
080                            return (java.util.List<com.liferay.portlet.asset.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 int getCompanyEntriesCount(HttpPrincipal httpPrincipal,
090                    long companyId)
091                    throws com.liferay.portal.kernel.exception.SystemException {
092                    try {
093                            MethodKey methodKey = new MethodKey(AssetEntryServiceUtil.class.getName(),
094                                            "getCompanyEntriesCount",
095                                            _getCompanyEntriesCountParameterTypes1);
096    
097                            MethodHandler methodHandler = new MethodHandler(methodKey, companyId);
098    
099                            Object returnObj = null;
100    
101                            try {
102                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
103                            }
104                            catch (Exception e) {
105                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
106                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
107                                    }
108    
109                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
110                            }
111    
112                            return ((Integer)returnObj).intValue();
113                    }
114                    catch (com.liferay.portal.kernel.exception.SystemException se) {
115                            _log.error(se, se);
116    
117                            throw se;
118                    }
119            }
120    
121            public static java.util.List<com.liferay.portlet.asset.model.AssetEntry> getEntries(
122                    HttpPrincipal httpPrincipal,
123                    com.liferay.portlet.asset.service.persistence.AssetEntryQuery entryQuery)
124                    throws com.liferay.portal.kernel.exception.PortalException,
125                            com.liferay.portal.kernel.exception.SystemException {
126                    try {
127                            MethodKey methodKey = new MethodKey(AssetEntryServiceUtil.class.getName(),
128                                            "getEntries", _getEntriesParameterTypes2);
129    
130                            MethodHandler methodHandler = new MethodHandler(methodKey,
131                                            entryQuery);
132    
133                            Object returnObj = null;
134    
135                            try {
136                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
137                            }
138                            catch (Exception e) {
139                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
140                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
141                                    }
142    
143                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
144                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
145                                    }
146    
147                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
148                            }
149    
150                            return (java.util.List<com.liferay.portlet.asset.model.AssetEntry>)returnObj;
151                    }
152                    catch (com.liferay.portal.kernel.exception.SystemException se) {
153                            _log.error(se, se);
154    
155                            throw se;
156                    }
157            }
158    
159            public static int getEntriesCount(HttpPrincipal httpPrincipal,
160                    com.liferay.portlet.asset.service.persistence.AssetEntryQuery entryQuery)
161                    throws com.liferay.portal.kernel.exception.PortalException,
162                            com.liferay.portal.kernel.exception.SystemException {
163                    try {
164                            MethodKey methodKey = new MethodKey(AssetEntryServiceUtil.class.getName(),
165                                            "getEntriesCount", _getEntriesCountParameterTypes3);
166    
167                            MethodHandler methodHandler = new MethodHandler(methodKey,
168                                            entryQuery);
169    
170                            Object returnObj = null;
171    
172                            try {
173                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
174                            }
175                            catch (Exception e) {
176                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
177                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
178                                    }
179    
180                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
181                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
182                                    }
183    
184                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
185                            }
186    
187                            return ((Integer)returnObj).intValue();
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.asset.model.AssetEntry getEntry(
197                    HttpPrincipal httpPrincipal, long entryId)
198                    throws com.liferay.portal.kernel.exception.PortalException,
199                            com.liferay.portal.kernel.exception.SystemException {
200                    try {
201                            MethodKey methodKey = new MethodKey(AssetEntryServiceUtil.class.getName(),
202                                            "getEntry", _getEntryParameterTypes4);
203    
204                            MethodHandler methodHandler = new MethodHandler(methodKey, entryId);
205    
206                            Object returnObj = null;
207    
208                            try {
209                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
210                            }
211                            catch (Exception e) {
212                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
213                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
214                                    }
215    
216                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
217                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
218                                    }
219    
220                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
221                            }
222    
223                            return (com.liferay.portlet.asset.model.AssetEntry)returnObj;
224                    }
225                    catch (com.liferay.portal.kernel.exception.SystemException se) {
226                            _log.error(se, se);
227    
228                            throw se;
229                    }
230            }
231    
232            public static com.liferay.portlet.asset.model.AssetEntry incrementViewCounter(
233                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK)
234                    throws com.liferay.portal.kernel.exception.PortalException,
235                            com.liferay.portal.kernel.exception.SystemException {
236                    try {
237                            MethodKey methodKey = new MethodKey(AssetEntryServiceUtil.class.getName(),
238                                            "incrementViewCounter", _incrementViewCounterParameterTypes5);
239    
240                            MethodHandler methodHandler = new MethodHandler(methodKey,
241                                            className, classPK);
242    
243                            Object returnObj = null;
244    
245                            try {
246                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
247                            }
248                            catch (Exception e) {
249                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
250                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
251                                    }
252    
253                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
254                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
255                                    }
256    
257                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
258                            }
259    
260                            return (com.liferay.portlet.asset.model.AssetEntry)returnObj;
261                    }
262                    catch (com.liferay.portal.kernel.exception.SystemException se) {
263                            _log.error(se, se);
264    
265                            throw se;
266                    }
267            }
268    
269            public static com.liferay.portlet.asset.model.AssetEntry updateEntry(
270                    HttpPrincipal httpPrincipal, long groupId, java.lang.String className,
271                    long classPK, java.lang.String classUuid, long classTypeId,
272                    long[] categoryIds, java.lang.String[] tagNames, boolean visible,
273                    java.util.Date startDate, java.util.Date endDate,
274                    java.util.Date publishDate, java.util.Date expirationDate,
275                    java.lang.String mimeType, java.lang.String title,
276                    java.lang.String description, java.lang.String summary,
277                    java.lang.String url, java.lang.String layoutUuid, int height,
278                    int width, java.lang.Integer priority, boolean sync)
279                    throws com.liferay.portal.kernel.exception.PortalException,
280                            com.liferay.portal.kernel.exception.SystemException {
281                    try {
282                            MethodKey methodKey = new MethodKey(AssetEntryServiceUtil.class.getName(),
283                                            "updateEntry", _updateEntryParameterTypes6);
284    
285                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
286                                            className, classPK, classUuid, classTypeId, categoryIds,
287                                            tagNames, visible, startDate, endDate, publishDate,
288                                            expirationDate, mimeType, title, description, summary, url,
289                                            layoutUuid, height, width, priority, sync);
290    
291                            Object returnObj = null;
292    
293                            try {
294                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
295                            }
296                            catch (Exception e) {
297                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
298                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
299                                    }
300    
301                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
302                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
303                                    }
304    
305                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
306                            }
307    
308                            return (com.liferay.portlet.asset.model.AssetEntry)returnObj;
309                    }
310                    catch (com.liferay.portal.kernel.exception.SystemException se) {
311                            _log.error(se, se);
312    
313                            throw se;
314                    }
315            }
316    
317            private static Log _log = LogFactoryUtil.getLog(AssetEntryServiceHttp.class);
318            private static final Class<?>[] _getCompanyEntriesParameterTypes0 = new Class[] {
319                            long.class, int.class, int.class
320                    };
321            private static final Class<?>[] _getCompanyEntriesCountParameterTypes1 = new Class[] {
322                            long.class
323                    };
324            private static final Class<?>[] _getEntriesParameterTypes2 = new Class[] {
325                            com.liferay.portlet.asset.service.persistence.AssetEntryQuery.class
326                    };
327            private static final Class<?>[] _getEntriesCountParameterTypes3 = new Class[] {
328                            com.liferay.portlet.asset.service.persistence.AssetEntryQuery.class
329                    };
330            private static final Class<?>[] _getEntryParameterTypes4 = new Class[] {
331                            long.class
332                    };
333            private static final Class<?>[] _incrementViewCounterParameterTypes5 = new Class[] {
334                            java.lang.String.class, long.class
335                    };
336            private static final Class<?>[] _updateEntryParameterTypes6 = new Class[] {
337                            long.class, java.lang.String.class, long.class,
338                            java.lang.String.class, long.class, long[].class,
339                            java.lang.String[].class, boolean.class, java.util.Date.class,
340                            java.util.Date.class, java.util.Date.class, java.util.Date.class,
341                            java.lang.String.class, java.lang.String.class,
342                            java.lang.String.class, java.lang.String.class,
343                            java.lang.String.class, java.lang.String.class, int.class, int.class,
344                            java.lang.Integer.class, boolean.class
345                    };
346    }