001    /**
002     * Copyright (c) 2000-2012 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 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.shopping.service.ShoppingItemServiceUtil;
025    
026    /**
027     * <p>
028     * This class provides a HTTP utility for the
029     * {@link com.liferay.portlet.shopping.service.ShoppingItemServiceUtil} 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       ShoppingItemServiceSoap
052     * @see       com.liferay.portal.security.auth.HttpPrincipal
053     * @see       com.liferay.portlet.shopping.service.ShoppingItemServiceUtil
054     * @generated
055     */
056    public class ShoppingItemServiceHttp {
057            public static void addBookItems(HttpPrincipal httpPrincipal, long groupId,
058                    long categoryId, java.lang.String[] isbns)
059                    throws com.liferay.portal.kernel.exception.PortalException,
060                            com.liferay.portal.kernel.exception.SystemException {
061                    try {
062                            MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class.getName(),
063                                            "addBookItems", _addBookItemsParameterTypes0);
064    
065                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
066                                            categoryId, isbns);
067    
068                            try {
069                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
070                            }
071                            catch (Exception e) {
072                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
073                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
074                                    }
075    
076                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
077                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
078                                    }
079    
080                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
081                            }
082                    }
083                    catch (com.liferay.portal.kernel.exception.SystemException se) {
084                            _log.error(se, se);
085    
086                            throw se;
087                    }
088            }
089    
090            public static com.liferay.portlet.shopping.model.ShoppingItem addItem(
091                    HttpPrincipal httpPrincipal, long groupId, long categoryId,
092                    java.lang.String sku, java.lang.String name,
093                    java.lang.String description, java.lang.String properties,
094                    java.lang.String fieldsQuantities, boolean requiresShipping,
095                    int stockQuantity, boolean featured, java.lang.Boolean sale,
096                    boolean smallImage, java.lang.String smallImageURL,
097                    java.io.File smallFile, boolean mediumImage,
098                    java.lang.String mediumImageURL, java.io.File mediumFile,
099                    boolean largeImage, java.lang.String largeImageURL,
100                    java.io.File largeFile,
101                    java.util.List<com.liferay.portlet.shopping.model.ShoppingItemField> itemFields,
102                    java.util.List<com.liferay.portlet.shopping.model.ShoppingItemPrice> itemPrices,
103                    com.liferay.portal.service.ServiceContext serviceContext)
104                    throws com.liferay.portal.kernel.exception.PortalException,
105                            com.liferay.portal.kernel.exception.SystemException {
106                    try {
107                            MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class.getName(),
108                                            "addItem", _addItemParameterTypes1);
109    
110                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
111                                            categoryId, sku, name, description, properties,
112                                            fieldsQuantities, requiresShipping, stockQuantity,
113                                            featured, sale, smallImage, smallImageURL, smallFile,
114                                            mediumImage, mediumImageURL, mediumFile, largeImage,
115                                            largeImageURL, largeFile, itemFields, itemPrices,
116                                            serviceContext);
117    
118                            Object returnObj = null;
119    
120                            try {
121                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
122                            }
123                            catch (Exception e) {
124                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
125                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
126                                    }
127    
128                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
129                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
130                                    }
131    
132                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
133                            }
134    
135                            return (com.liferay.portlet.shopping.model.ShoppingItem)returnObj;
136                    }
137                    catch (com.liferay.portal.kernel.exception.SystemException se) {
138                            _log.error(se, se);
139    
140                            throw se;
141                    }
142            }
143    
144            public static void deleteItem(HttpPrincipal httpPrincipal, long itemId)
145                    throws com.liferay.portal.kernel.exception.PortalException,
146                            com.liferay.portal.kernel.exception.SystemException {
147                    try {
148                            MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class.getName(),
149                                            "deleteItem", _deleteItemParameterTypes2);
150    
151                            MethodHandler methodHandler = new MethodHandler(methodKey, itemId);
152    
153                            try {
154                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
155                            }
156                            catch (Exception e) {
157                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
158                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
159                                    }
160    
161                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
162                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
163                                    }
164    
165                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
166                            }
167                    }
168                    catch (com.liferay.portal.kernel.exception.SystemException se) {
169                            _log.error(se, se);
170    
171                            throw se;
172                    }
173            }
174    
175            public static int getCategoriesItemsCount(HttpPrincipal httpPrincipal,
176                    long groupId, java.util.List<java.lang.Long> categoryIds)
177                    throws com.liferay.portal.kernel.exception.SystemException {
178                    try {
179                            MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class.getName(),
180                                            "getCategoriesItemsCount",
181                                            _getCategoriesItemsCountParameterTypes3);
182    
183                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
184                                            categoryIds);
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.SystemException) {
193                                            throw (com.liferay.portal.kernel.exception.SystemException)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.portlet.shopping.model.ShoppingItem getItem(
209                    HttpPrincipal httpPrincipal, long itemId)
210                    throws com.liferay.portal.kernel.exception.PortalException,
211                            com.liferay.portal.kernel.exception.SystemException {
212                    try {
213                            MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class.getName(),
214                                            "getItem", _getItemParameterTypes4);
215    
216                            MethodHandler methodHandler = new MethodHandler(methodKey, itemId);
217    
218                            Object returnObj = null;
219    
220                            try {
221                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
222                            }
223                            catch (Exception e) {
224                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
225                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
226                                    }
227    
228                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
229                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
230                                    }
231    
232                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
233                            }
234    
235                            return (com.liferay.portlet.shopping.model.ShoppingItem)returnObj;
236                    }
237                    catch (com.liferay.portal.kernel.exception.SystemException se) {
238                            _log.error(se, se);
239    
240                            throw se;
241                    }
242            }
243    
244            public static java.util.List<com.liferay.portlet.shopping.model.ShoppingItem> getItems(
245                    HttpPrincipal httpPrincipal, long groupId, long categoryId)
246                    throws com.liferay.portal.kernel.exception.SystemException {
247                    try {
248                            MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class.getName(),
249                                            "getItems", _getItemsParameterTypes5);
250    
251                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
252                                            categoryId);
253    
254                            Object returnObj = null;
255    
256                            try {
257                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
258                            }
259                            catch (Exception e) {
260                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
261                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
262                                    }
263    
264                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
265                            }
266    
267                            return (java.util.List<com.liferay.portlet.shopping.model.ShoppingItem>)returnObj;
268                    }
269                    catch (com.liferay.portal.kernel.exception.SystemException se) {
270                            _log.error(se, se);
271    
272                            throw se;
273                    }
274            }
275    
276            public static java.util.List<com.liferay.portlet.shopping.model.ShoppingItem> getItems(
277                    HttpPrincipal httpPrincipal, long groupId, long categoryId, int start,
278                    int end, com.liferay.portal.kernel.util.OrderByComparator obc)
279                    throws com.liferay.portal.kernel.exception.SystemException {
280                    try {
281                            MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class.getName(),
282                                            "getItems", _getItemsParameterTypes6);
283    
284                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
285                                            categoryId, start, end, obc);
286    
287                            Object returnObj = null;
288    
289                            try {
290                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
291                            }
292                            catch (Exception e) {
293                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
294                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
295                                    }
296    
297                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
298                            }
299    
300                            return (java.util.List<com.liferay.portlet.shopping.model.ShoppingItem>)returnObj;
301                    }
302                    catch (com.liferay.portal.kernel.exception.SystemException se) {
303                            _log.error(se, se);
304    
305                            throw se;
306                    }
307            }
308    
309            public static int getItemsCount(HttpPrincipal httpPrincipal, long groupId,
310                    long categoryId)
311                    throws com.liferay.portal.kernel.exception.SystemException {
312                    try {
313                            MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class.getName(),
314                                            "getItemsCount", _getItemsCountParameterTypes7);
315    
316                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
317                                            categoryId);
318    
319                            Object returnObj = null;
320    
321                            try {
322                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
323                            }
324                            catch (Exception e) {
325                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
326                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
327                                    }
328    
329                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
330                            }
331    
332                            return ((Integer)returnObj).intValue();
333                    }
334                    catch (com.liferay.portal.kernel.exception.SystemException se) {
335                            _log.error(se, se);
336    
337                            throw se;
338                    }
339            }
340    
341            public static com.liferay.portlet.shopping.model.ShoppingItem[] getItemsPrevAndNext(
342                    HttpPrincipal httpPrincipal, long itemId,
343                    com.liferay.portal.kernel.util.OrderByComparator obc)
344                    throws com.liferay.portal.kernel.exception.PortalException,
345                            com.liferay.portal.kernel.exception.SystemException {
346                    try {
347                            MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class.getName(),
348                                            "getItemsPrevAndNext", _getItemsPrevAndNextParameterTypes8);
349    
350                            MethodHandler methodHandler = new MethodHandler(methodKey, itemId,
351                                            obc);
352    
353                            Object returnObj = null;
354    
355                            try {
356                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
357                            }
358                            catch (Exception e) {
359                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
360                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
361                                    }
362    
363                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
364                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
365                                    }
366    
367                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
368                            }
369    
370                            return (com.liferay.portlet.shopping.model.ShoppingItem[])returnObj;
371                    }
372                    catch (com.liferay.portal.kernel.exception.SystemException se) {
373                            _log.error(se, se);
374    
375                            throw se;
376                    }
377            }
378    
379            public static com.liferay.portlet.shopping.model.ShoppingItem updateItem(
380                    HttpPrincipal httpPrincipal, long itemId, long groupId,
381                    long categoryId, java.lang.String sku, java.lang.String name,
382                    java.lang.String description, java.lang.String properties,
383                    java.lang.String fieldsQuantities, boolean requiresShipping,
384                    int stockQuantity, boolean featured, java.lang.Boolean sale,
385                    boolean smallImage, java.lang.String smallImageURL,
386                    java.io.File smallFile, boolean mediumImage,
387                    java.lang.String mediumImageURL, java.io.File mediumFile,
388                    boolean largeImage, java.lang.String largeImageURL,
389                    java.io.File largeFile,
390                    java.util.List<com.liferay.portlet.shopping.model.ShoppingItemField> itemFields,
391                    java.util.List<com.liferay.portlet.shopping.model.ShoppingItemPrice> itemPrices,
392                    com.liferay.portal.service.ServiceContext serviceContext)
393                    throws com.liferay.portal.kernel.exception.PortalException,
394                            com.liferay.portal.kernel.exception.SystemException {
395                    try {
396                            MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class.getName(),
397                                            "updateItem", _updateItemParameterTypes9);
398    
399                            MethodHandler methodHandler = new MethodHandler(methodKey, itemId,
400                                            groupId, categoryId, sku, name, description, properties,
401                                            fieldsQuantities, requiresShipping, stockQuantity,
402                                            featured, sale, smallImage, smallImageURL, smallFile,
403                                            mediumImage, mediumImageURL, mediumFile, largeImage,
404                                            largeImageURL, largeFile, itemFields, itemPrices,
405                                            serviceContext);
406    
407                            Object returnObj = null;
408    
409                            try {
410                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
411                            }
412                            catch (Exception e) {
413                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
414                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
415                                    }
416    
417                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
418                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
419                                    }
420    
421                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
422                            }
423    
424                            return (com.liferay.portlet.shopping.model.ShoppingItem)returnObj;
425                    }
426                    catch (com.liferay.portal.kernel.exception.SystemException se) {
427                            _log.error(se, se);
428    
429                            throw se;
430                    }
431            }
432    
433            private static Log _log = LogFactoryUtil.getLog(ShoppingItemServiceHttp.class);
434            private static final Class<?>[] _addBookItemsParameterTypes0 = new Class[] {
435                            long.class, long.class, java.lang.String[].class
436                    };
437            private static final Class<?>[] _addItemParameterTypes1 = new Class[] {
438                            long.class, long.class, java.lang.String.class,
439                            java.lang.String.class, java.lang.String.class,
440                            java.lang.String.class, java.lang.String.class, boolean.class,
441                            int.class, boolean.class, java.lang.Boolean.class, boolean.class,
442                            java.lang.String.class, java.io.File.class, boolean.class,
443                            java.lang.String.class, java.io.File.class, boolean.class,
444                            java.lang.String.class, java.io.File.class, java.util.List.class,
445                            java.util.List.class,
446                            com.liferay.portal.service.ServiceContext.class
447                    };
448            private static final Class<?>[] _deleteItemParameterTypes2 = new Class[] {
449                            long.class
450                    };
451            private static final Class<?>[] _getCategoriesItemsCountParameterTypes3 = new Class[] {
452                            long.class, java.util.List.class
453                    };
454            private static final Class<?>[] _getItemParameterTypes4 = new Class[] {
455                            long.class
456                    };
457            private static final Class<?>[] _getItemsParameterTypes5 = new Class[] {
458                            long.class, long.class
459                    };
460            private static final Class<?>[] _getItemsParameterTypes6 = new Class[] {
461                            long.class, long.class, int.class, int.class,
462                            com.liferay.portal.kernel.util.OrderByComparator.class
463                    };
464            private static final Class<?>[] _getItemsCountParameterTypes7 = new Class[] {
465                            long.class, long.class
466                    };
467            private static final Class<?>[] _getItemsPrevAndNextParameterTypes8 = new Class[] {
468                            long.class, com.liferay.portal.kernel.util.OrderByComparator.class
469                    };
470            private static final Class<?>[] _updateItemParameterTypes9 = new Class[] {
471                            long.class, long.class, long.class, java.lang.String.class,
472                            java.lang.String.class, java.lang.String.class,
473                            java.lang.String.class, java.lang.String.class, boolean.class,
474                            int.class, boolean.class, java.lang.Boolean.class, boolean.class,
475                            java.lang.String.class, java.io.File.class, boolean.class,
476                            java.lang.String.class, java.io.File.class, boolean.class,
477                            java.lang.String.class, java.io.File.class, java.util.List.class,
478                            java.util.List.class,
479                            com.liferay.portal.service.ServiceContext.class
480                    };
481    }