001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.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     * Provides the HTTP utility for the
028     * {@link com.liferay.portlet.shopping.service.ShoppingItemServiceUtil} service utility. The
029     * static methods of this class calls the same methods of the service utility.
030     * However, the signatures are different because it requires an additional
031     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
032     *
033     * <p>
034     * The benefits of using the HTTP utility is that it is fast and allows for
035     * tunneling without the cost of serializing to text. The drawback is that it
036     * only works with Java.
037     * </p>
038     *
039     * <p>
040     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
041     * configure security.
042     * </p>
043     *
044     * <p>
045     * The HTTP utility is only generated for remote services.
046     * </p>
047     *
048     * @author Brian Wing Shun Chan
049     * @see ShoppingItemServiceSoap
050     * @see com.liferay.portal.security.auth.HttpPrincipal
051     * @see com.liferay.portlet.shopping.service.ShoppingItemServiceUtil
052     * @generated
053     */
054    public class ShoppingItemServiceHttp {
055            public static void addBookItems(HttpPrincipal httpPrincipal, long groupId,
056                    long categoryId, java.lang.String[] isbns)
057                    throws com.liferay.portal.kernel.exception.PortalException,
058                            com.liferay.portal.kernel.exception.SystemException {
059                    try {
060                            MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class,
061                                            "addBookItems", _addBookItemsParameterTypes0);
062    
063                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
064                                            categoryId, isbns);
065    
066                            try {
067                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
068                            }
069                            catch (Exception e) {
070                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
071                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
072                                    }
073    
074                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
075                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
076                                    }
077    
078                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
079                            }
080                    }
081                    catch (com.liferay.portal.kernel.exception.SystemException se) {
082                            _log.error(se, se);
083    
084                            throw se;
085                    }
086            }
087    
088            public static com.liferay.portlet.shopping.model.ShoppingItem addItem(
089                    HttpPrincipal httpPrincipal, long groupId, long categoryId,
090                    java.lang.String sku, java.lang.String name,
091                    java.lang.String description, java.lang.String properties,
092                    java.lang.String fieldsQuantities, boolean requiresShipping,
093                    int stockQuantity, boolean featured, java.lang.Boolean sale,
094                    boolean smallImage, java.lang.String smallImageURL,
095                    java.io.File smallFile, boolean mediumImage,
096                    java.lang.String mediumImageURL, java.io.File mediumFile,
097                    boolean largeImage, java.lang.String largeImageURL,
098                    java.io.File largeFile,
099                    java.util.List<com.liferay.portlet.shopping.model.ShoppingItemField> itemFields,
100                    java.util.List<com.liferay.portlet.shopping.model.ShoppingItemPrice> itemPrices,
101                    com.liferay.portal.service.ServiceContext serviceContext)
102                    throws com.liferay.portal.kernel.exception.PortalException,
103                            com.liferay.portal.kernel.exception.SystemException {
104                    try {
105                            MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class,
106                                            "addItem", _addItemParameterTypes1);
107    
108                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
109                                            categoryId, sku, name, description, properties,
110                                            fieldsQuantities, requiresShipping, stockQuantity,
111                                            featured, sale, smallImage, smallImageURL, smallFile,
112                                            mediumImage, mediumImageURL, mediumFile, largeImage,
113                                            largeImageURL, largeFile, itemFields, itemPrices,
114                                            serviceContext);
115    
116                            Object returnObj = null;
117    
118                            try {
119                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
120                            }
121                            catch (Exception e) {
122                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
123                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
124                                    }
125    
126                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
127                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
128                                    }
129    
130                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
131                            }
132    
133                            return (com.liferay.portlet.shopping.model.ShoppingItem)returnObj;
134                    }
135                    catch (com.liferay.portal.kernel.exception.SystemException se) {
136                            _log.error(se, se);
137    
138                            throw se;
139                    }
140            }
141    
142            public static void deleteItem(HttpPrincipal httpPrincipal, long itemId)
143                    throws com.liferay.portal.kernel.exception.PortalException,
144                            com.liferay.portal.kernel.exception.SystemException {
145                    try {
146                            MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class,
147                                            "deleteItem", _deleteItemParameterTypes2);
148    
149                            MethodHandler methodHandler = new MethodHandler(methodKey, itemId);
150    
151                            try {
152                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
153                            }
154                            catch (Exception e) {
155                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
156                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
157                                    }
158    
159                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
160                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
161                                    }
162    
163                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
164                            }
165                    }
166                    catch (com.liferay.portal.kernel.exception.SystemException se) {
167                            _log.error(se, se);
168    
169                            throw se;
170                    }
171            }
172    
173            public static int getCategoriesItemsCount(HttpPrincipal httpPrincipal,
174                    long groupId, java.util.List<java.lang.Long> categoryIds)
175                    throws com.liferay.portal.kernel.exception.SystemException {
176                    try {
177                            MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class,
178                                            "getCategoriesItemsCount",
179                                            _getCategoriesItemsCountParameterTypes3);
180    
181                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
182                                            categoryIds);
183    
184                            Object returnObj = null;
185    
186                            try {
187                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
188                            }
189                            catch (Exception e) {
190                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
191                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
192                                    }
193    
194                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
195                            }
196    
197                            return ((Integer)returnObj).intValue();
198                    }
199                    catch (com.liferay.portal.kernel.exception.SystemException se) {
200                            _log.error(se, se);
201    
202                            throw se;
203                    }
204            }
205    
206            public static com.liferay.portlet.shopping.model.ShoppingItem getItem(
207                    HttpPrincipal httpPrincipal, long itemId)
208                    throws com.liferay.portal.kernel.exception.PortalException,
209                            com.liferay.portal.kernel.exception.SystemException {
210                    try {
211                            MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class,
212                                            "getItem", _getItemParameterTypes4);
213    
214                            MethodHandler methodHandler = new MethodHandler(methodKey, itemId);
215    
216                            Object returnObj = null;
217    
218                            try {
219                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
220                            }
221                            catch (Exception e) {
222                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
223                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
224                                    }
225    
226                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
227                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
228                                    }
229    
230                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
231                            }
232    
233                            return (com.liferay.portlet.shopping.model.ShoppingItem)returnObj;
234                    }
235                    catch (com.liferay.portal.kernel.exception.SystemException se) {
236                            _log.error(se, se);
237    
238                            throw se;
239                    }
240            }
241    
242            public static java.util.List<com.liferay.portlet.shopping.model.ShoppingItem> getItems(
243                    HttpPrincipal httpPrincipal, long groupId, long categoryId)
244                    throws com.liferay.portal.kernel.exception.SystemException {
245                    try {
246                            MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class,
247                                            "getItems", _getItemsParameterTypes5);
248    
249                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
250                                            categoryId);
251    
252                            Object returnObj = null;
253    
254                            try {
255                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
256                            }
257                            catch (Exception e) {
258                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
259                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
260                                    }
261    
262                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
263                            }
264    
265                            return (java.util.List<com.liferay.portlet.shopping.model.ShoppingItem>)returnObj;
266                    }
267                    catch (com.liferay.portal.kernel.exception.SystemException se) {
268                            _log.error(se, se);
269    
270                            throw se;
271                    }
272            }
273    
274            public static java.util.List<com.liferay.portlet.shopping.model.ShoppingItem> getItems(
275                    HttpPrincipal httpPrincipal, long groupId, long categoryId, int start,
276                    int end, com.liferay.portal.kernel.util.OrderByComparator obc)
277                    throws com.liferay.portal.kernel.exception.SystemException {
278                    try {
279                            MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class,
280                                            "getItems", _getItemsParameterTypes6);
281    
282                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
283                                            categoryId, start, end, obc);
284    
285                            Object returnObj = null;
286    
287                            try {
288                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
289                            }
290                            catch (Exception e) {
291                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
292                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
293                                    }
294    
295                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
296                            }
297    
298                            return (java.util.List<com.liferay.portlet.shopping.model.ShoppingItem>)returnObj;
299                    }
300                    catch (com.liferay.portal.kernel.exception.SystemException se) {
301                            _log.error(se, se);
302    
303                            throw se;
304                    }
305            }
306    
307            public static int getItemsCount(HttpPrincipal httpPrincipal, long groupId,
308                    long categoryId)
309                    throws com.liferay.portal.kernel.exception.SystemException {
310                    try {
311                            MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class,
312                                            "getItemsCount", _getItemsCountParameterTypes7);
313    
314                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
315                                            categoryId);
316    
317                            Object returnObj = null;
318    
319                            try {
320                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
321                            }
322                            catch (Exception e) {
323                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
324                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
325                                    }
326    
327                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
328                            }
329    
330                            return ((Integer)returnObj).intValue();
331                    }
332                    catch (com.liferay.portal.kernel.exception.SystemException se) {
333                            _log.error(se, se);
334    
335                            throw se;
336                    }
337            }
338    
339            public static com.liferay.portlet.shopping.model.ShoppingItem[] getItemsPrevAndNext(
340                    HttpPrincipal httpPrincipal, long itemId,
341                    com.liferay.portal.kernel.util.OrderByComparator obc)
342                    throws com.liferay.portal.kernel.exception.PortalException,
343                            com.liferay.portal.kernel.exception.SystemException {
344                    try {
345                            MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class,
346                                            "getItemsPrevAndNext", _getItemsPrevAndNextParameterTypes8);
347    
348                            MethodHandler methodHandler = new MethodHandler(methodKey, itemId,
349                                            obc);
350    
351                            Object returnObj = null;
352    
353                            try {
354                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
355                            }
356                            catch (Exception e) {
357                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
358                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
359                                    }
360    
361                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
362                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
363                                    }
364    
365                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
366                            }
367    
368                            return (com.liferay.portlet.shopping.model.ShoppingItem[])returnObj;
369                    }
370                    catch (com.liferay.portal.kernel.exception.SystemException se) {
371                            _log.error(se, se);
372    
373                            throw se;
374                    }
375            }
376    
377            public static com.liferay.portlet.shopping.model.ShoppingItem updateItem(
378                    HttpPrincipal httpPrincipal, long itemId, long groupId,
379                    long categoryId, java.lang.String sku, java.lang.String name,
380                    java.lang.String description, java.lang.String properties,
381                    java.lang.String fieldsQuantities, boolean requiresShipping,
382                    int stockQuantity, boolean featured, java.lang.Boolean sale,
383                    boolean smallImage, java.lang.String smallImageURL,
384                    java.io.File smallFile, boolean mediumImage,
385                    java.lang.String mediumImageURL, java.io.File mediumFile,
386                    boolean largeImage, java.lang.String largeImageURL,
387                    java.io.File largeFile,
388                    java.util.List<com.liferay.portlet.shopping.model.ShoppingItemField> itemFields,
389                    java.util.List<com.liferay.portlet.shopping.model.ShoppingItemPrice> itemPrices,
390                    com.liferay.portal.service.ServiceContext serviceContext)
391                    throws com.liferay.portal.kernel.exception.PortalException,
392                            com.liferay.portal.kernel.exception.SystemException {
393                    try {
394                            MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class,
395                                            "updateItem", _updateItemParameterTypes9);
396    
397                            MethodHandler methodHandler = new MethodHandler(methodKey, itemId,
398                                            groupId, categoryId, sku, name, description, properties,
399                                            fieldsQuantities, requiresShipping, stockQuantity,
400                                            featured, sale, smallImage, smallImageURL, smallFile,
401                                            mediumImage, mediumImageURL, mediumFile, largeImage,
402                                            largeImageURL, largeFile, itemFields, itemPrices,
403                                            serviceContext);
404    
405                            Object returnObj = null;
406    
407                            try {
408                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
409                            }
410                            catch (Exception e) {
411                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
412                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
413                                    }
414    
415                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
416                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
417                                    }
418    
419                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
420                            }
421    
422                            return (com.liferay.portlet.shopping.model.ShoppingItem)returnObj;
423                    }
424                    catch (com.liferay.portal.kernel.exception.SystemException se) {
425                            _log.error(se, se);
426    
427                            throw se;
428                    }
429            }
430    
431            private static Log _log = LogFactoryUtil.getLog(ShoppingItemServiceHttp.class);
432            private static final Class<?>[] _addBookItemsParameterTypes0 = new Class[] {
433                            long.class, long.class, java.lang.String[].class
434                    };
435            private static final Class<?>[] _addItemParameterTypes1 = new Class[] {
436                            long.class, long.class, java.lang.String.class,
437                            java.lang.String.class, java.lang.String.class,
438                            java.lang.String.class, java.lang.String.class, boolean.class,
439                            int.class, boolean.class, java.lang.Boolean.class, boolean.class,
440                            java.lang.String.class, java.io.File.class, boolean.class,
441                            java.lang.String.class, java.io.File.class, boolean.class,
442                            java.lang.String.class, java.io.File.class, java.util.List.class,
443                            java.util.List.class,
444                            com.liferay.portal.service.ServiceContext.class
445                    };
446            private static final Class<?>[] _deleteItemParameterTypes2 = new Class[] {
447                            long.class
448                    };
449            private static final Class<?>[] _getCategoriesItemsCountParameterTypes3 = new Class[] {
450                            long.class, java.util.List.class
451                    };
452            private static final Class<?>[] _getItemParameterTypes4 = new Class[] {
453                            long.class
454                    };
455            private static final Class<?>[] _getItemsParameterTypes5 = new Class[] {
456                            long.class, long.class
457                    };
458            private static final Class<?>[] _getItemsParameterTypes6 = new Class[] {
459                            long.class, long.class, int.class, int.class,
460                            com.liferay.portal.kernel.util.OrderByComparator.class
461                    };
462            private static final Class<?>[] _getItemsCountParameterTypes7 = new Class[] {
463                            long.class, long.class
464                    };
465            private static final Class<?>[] _getItemsPrevAndNextParameterTypes8 = new Class[] {
466                            long.class, com.liferay.portal.kernel.util.OrderByComparator.class
467                    };
468            private static final Class<?>[] _updateItemParameterTypes9 = new Class[] {
469                            long.class, long.class, long.class, java.lang.String.class,
470                            java.lang.String.class, java.lang.String.class,
471                            java.lang.String.class, java.lang.String.class, boolean.class,
472                            int.class, boolean.class, java.lang.Boolean.class, boolean.class,
473                            java.lang.String.class, java.io.File.class, boolean.class,
474                            java.lang.String.class, java.io.File.class, boolean.class,
475                            java.lang.String.class, java.io.File.class, java.util.List.class,
476                            java.util.List.class,
477                            com.liferay.portal.service.ServiceContext.class
478                    };
479    }