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.shopping.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.shopping.service.ShoppingItemServiceUtil;
027    
028    /**
029     * Provides the HTTP utility for the
030     * {@link ShoppingItemServiceUtil} 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 ShoppingItemServiceSoap
052     * @see HttpPrincipal
053     * @see ShoppingItemServiceUtil
054     * @generated
055     */
056    @ProviderType
057    public class ShoppingItemServiceHttp {
058            public static com.liferay.portlet.shopping.model.ShoppingItem addItem(
059                    HttpPrincipal httpPrincipal, long groupId, long categoryId,
060                    java.lang.String sku, java.lang.String name,
061                    java.lang.String description, java.lang.String properties,
062                    java.lang.String fieldsQuantities, boolean requiresShipping,
063                    int stockQuantity, boolean featured, java.lang.Boolean sale,
064                    boolean smallImage, java.lang.String smallImageURL,
065                    java.io.File smallFile, boolean mediumImage,
066                    java.lang.String mediumImageURL, java.io.File mediumFile,
067                    boolean largeImage, java.lang.String largeImageURL,
068                    java.io.File largeFile,
069                    java.util.List<com.liferay.portlet.shopping.model.ShoppingItemField> itemFields,
070                    java.util.List<com.liferay.portlet.shopping.model.ShoppingItemPrice> itemPrices,
071                    com.liferay.portal.service.ServiceContext serviceContext)
072                    throws com.liferay.portal.kernel.exception.PortalException {
073                    try {
074                            MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class,
075                                            "addItem", _addItemParameterTypes0);
076    
077                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
078                                            categoryId, sku, name, description, properties,
079                                            fieldsQuantities, requiresShipping, stockQuantity,
080                                            featured, sale, smallImage, smallImageURL, smallFile,
081                                            mediumImage, mediumImageURL, mediumFile, largeImage,
082                                            largeImageURL, largeFile, itemFields, itemPrices,
083                                            serviceContext);
084    
085                            Object returnObj = null;
086    
087                            try {
088                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
089                            }
090                            catch (Exception e) {
091                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
092                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
093                                    }
094    
095                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
096                            }
097    
098                            return (com.liferay.portlet.shopping.model.ShoppingItem)returnObj;
099                    }
100                    catch (com.liferay.portal.kernel.exception.SystemException se) {
101                            _log.error(se, se);
102    
103                            throw se;
104                    }
105            }
106    
107            public static void deleteItem(HttpPrincipal httpPrincipal, long itemId)
108                    throws com.liferay.portal.kernel.exception.PortalException {
109                    try {
110                            MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class,
111                                            "deleteItem", _deleteItemParameterTypes1);
112    
113                            MethodHandler methodHandler = new MethodHandler(methodKey, itemId);
114    
115                            try {
116                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
117                            }
118                            catch (Exception e) {
119                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
120                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
121                                    }
122    
123                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
124                            }
125                    }
126                    catch (com.liferay.portal.kernel.exception.SystemException se) {
127                            _log.error(se, se);
128    
129                            throw se;
130                    }
131            }
132    
133            public static int getCategoriesItemsCount(HttpPrincipal httpPrincipal,
134                    long groupId, java.util.List<java.lang.Long> categoryIds) {
135                    try {
136                            MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class,
137                                            "getCategoriesItemsCount",
138                                            _getCategoriesItemsCountParameterTypes2);
139    
140                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
141                                            categoryIds);
142    
143                            Object returnObj = null;
144    
145                            try {
146                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
147                            }
148                            catch (Exception e) {
149                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
150                            }
151    
152                            return ((Integer)returnObj).intValue();
153                    }
154                    catch (com.liferay.portal.kernel.exception.SystemException se) {
155                            _log.error(se, se);
156    
157                            throw se;
158                    }
159            }
160    
161            public static com.liferay.portlet.shopping.model.ShoppingItem getItem(
162                    HttpPrincipal httpPrincipal, long itemId)
163                    throws com.liferay.portal.kernel.exception.PortalException {
164                    try {
165                            MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class,
166                                            "getItem", _getItemParameterTypes3);
167    
168                            MethodHandler methodHandler = new MethodHandler(methodKey, itemId);
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                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
181                            }
182    
183                            return (com.liferay.portlet.shopping.model.ShoppingItem)returnObj;
184                    }
185                    catch (com.liferay.portal.kernel.exception.SystemException se) {
186                            _log.error(se, se);
187    
188                            throw se;
189                    }
190            }
191    
192            public static java.util.List<com.liferay.portlet.shopping.model.ShoppingItem> getItems(
193                    HttpPrincipal httpPrincipal, long groupId, long categoryId) {
194                    try {
195                            MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class,
196                                            "getItems", _getItemsParameterTypes4);
197    
198                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
199                                            categoryId);
200    
201                            Object returnObj = null;
202    
203                            try {
204                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
205                            }
206                            catch (Exception e) {
207                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
208                            }
209    
210                            return (java.util.List<com.liferay.portlet.shopping.model.ShoppingItem>)returnObj;
211                    }
212                    catch (com.liferay.portal.kernel.exception.SystemException se) {
213                            _log.error(se, se);
214    
215                            throw se;
216                    }
217            }
218    
219            public static java.util.List<com.liferay.portlet.shopping.model.ShoppingItem> getItems(
220                    HttpPrincipal httpPrincipal, long groupId, long categoryId, int start,
221                    int end,
222                    com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portlet.shopping.model.ShoppingItem> obc) {
223                    try {
224                            MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class,
225                                            "getItems", _getItemsParameterTypes5);
226    
227                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
228                                            categoryId, start, end, obc);
229    
230                            Object returnObj = null;
231    
232                            try {
233                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
234                            }
235                            catch (Exception e) {
236                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
237                            }
238    
239                            return (java.util.List<com.liferay.portlet.shopping.model.ShoppingItem>)returnObj;
240                    }
241                    catch (com.liferay.portal.kernel.exception.SystemException se) {
242                            _log.error(se, se);
243    
244                            throw se;
245                    }
246            }
247    
248            public static int getItemsCount(HttpPrincipal httpPrincipal, long groupId,
249                    long categoryId) {
250                    try {
251                            MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class,
252                                            "getItemsCount", _getItemsCountParameterTypes6);
253    
254                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
255                                            categoryId);
256    
257                            Object returnObj = null;
258    
259                            try {
260                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
261                            }
262                            catch (Exception e) {
263                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
264                            }
265    
266                            return ((Integer)returnObj).intValue();
267                    }
268                    catch (com.liferay.portal.kernel.exception.SystemException se) {
269                            _log.error(se, se);
270    
271                            throw se;
272                    }
273            }
274    
275            public static com.liferay.portlet.shopping.model.ShoppingItem[] getItemsPrevAndNext(
276                    HttpPrincipal httpPrincipal, long itemId,
277                    com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portlet.shopping.model.ShoppingItem> obc)
278                    throws com.liferay.portal.kernel.exception.PortalException {
279                    try {
280                            MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class,
281                                            "getItemsPrevAndNext", _getItemsPrevAndNextParameterTypes7);
282    
283                            MethodHandler methodHandler = new MethodHandler(methodKey, itemId,
284                                            obc);
285    
286                            Object returnObj = null;
287    
288                            try {
289                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
290                            }
291                            catch (Exception e) {
292                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
293                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
294                                    }
295    
296                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
297                            }
298    
299                            return (com.liferay.portlet.shopping.model.ShoppingItem[])returnObj;
300                    }
301                    catch (com.liferay.portal.kernel.exception.SystemException se) {
302                            _log.error(se, se);
303    
304                            throw se;
305                    }
306            }
307    
308            public static com.liferay.portlet.shopping.model.ShoppingItem updateItem(
309                    HttpPrincipal httpPrincipal, long itemId, long groupId,
310                    long categoryId, java.lang.String sku, java.lang.String name,
311                    java.lang.String description, java.lang.String properties,
312                    java.lang.String fieldsQuantities, boolean requiresShipping,
313                    int stockQuantity, boolean featured, java.lang.Boolean sale,
314                    boolean smallImage, java.lang.String smallImageURL,
315                    java.io.File smallFile, boolean mediumImage,
316                    java.lang.String mediumImageURL, java.io.File mediumFile,
317                    boolean largeImage, java.lang.String largeImageURL,
318                    java.io.File largeFile,
319                    java.util.List<com.liferay.portlet.shopping.model.ShoppingItemField> itemFields,
320                    java.util.List<com.liferay.portlet.shopping.model.ShoppingItemPrice> itemPrices,
321                    com.liferay.portal.service.ServiceContext serviceContext)
322                    throws com.liferay.portal.kernel.exception.PortalException {
323                    try {
324                            MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class,
325                                            "updateItem", _updateItemParameterTypes8);
326    
327                            MethodHandler methodHandler = new MethodHandler(methodKey, itemId,
328                                            groupId, categoryId, sku, name, description, properties,
329                                            fieldsQuantities, requiresShipping, stockQuantity,
330                                            featured, sale, smallImage, smallImageURL, smallFile,
331                                            mediumImage, mediumImageURL, mediumFile, largeImage,
332                                            largeImageURL, largeFile, itemFields, itemPrices,
333                                            serviceContext);
334    
335                            Object returnObj = null;
336    
337                            try {
338                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
339                            }
340                            catch (Exception e) {
341                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
342                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
343                                    }
344    
345                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
346                            }
347    
348                            return (com.liferay.portlet.shopping.model.ShoppingItem)returnObj;
349                    }
350                    catch (com.liferay.portal.kernel.exception.SystemException se) {
351                            _log.error(se, se);
352    
353                            throw se;
354                    }
355            }
356    
357            private static Log _log = LogFactoryUtil.getLog(ShoppingItemServiceHttp.class);
358            private static final Class<?>[] _addItemParameterTypes0 = new Class[] {
359                            long.class, long.class, java.lang.String.class,
360                            java.lang.String.class, java.lang.String.class,
361                            java.lang.String.class, java.lang.String.class, boolean.class,
362                            int.class, boolean.class, java.lang.Boolean.class, boolean.class,
363                            java.lang.String.class, java.io.File.class, boolean.class,
364                            java.lang.String.class, java.io.File.class, boolean.class,
365                            java.lang.String.class, java.io.File.class, java.util.List.class,
366                            java.util.List.class,
367                            com.liferay.portal.service.ServiceContext.class
368                    };
369            private static final Class<?>[] _deleteItemParameterTypes1 = new Class[] {
370                            long.class
371                    };
372            private static final Class<?>[] _getCategoriesItemsCountParameterTypes2 = new Class[] {
373                            long.class, java.util.List.class
374                    };
375            private static final Class<?>[] _getItemParameterTypes3 = new Class[] {
376                            long.class
377                    };
378            private static final Class<?>[] _getItemsParameterTypes4 = new Class[] {
379                            long.class, long.class
380                    };
381            private static final Class<?>[] _getItemsParameterTypes5 = new Class[] {
382                            long.class, long.class, int.class, int.class,
383                            com.liferay.portal.kernel.util.OrderByComparator.class
384                    };
385            private static final Class<?>[] _getItemsCountParameterTypes6 = new Class[] {
386                            long.class, long.class
387                    };
388            private static final Class<?>[] _getItemsPrevAndNextParameterTypes7 = new Class[] {
389                            long.class, com.liferay.portal.kernel.util.OrderByComparator.class
390                    };
391            private static final Class<?>[] _updateItemParameterTypes8 = new Class[] {
392                            long.class, long.class, long.class, java.lang.String.class,
393                            java.lang.String.class, java.lang.String.class,
394                            java.lang.String.class, java.lang.String.class, boolean.class,
395                            int.class, boolean.class, java.lang.Boolean.class, boolean.class,
396                            java.lang.String.class, java.io.File.class, boolean.class,
397                            java.lang.String.class, java.io.File.class, boolean.class,
398                            java.lang.String.class, java.io.File.class, java.util.List.class,
399                            java.util.List.class,
400                            com.liferay.portal.service.ServiceContext.class
401                    };
402    }