001    /**
002     * Copyright (c) 2000-2011 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", long.class, long.class,
064                                            java.lang.String[].class);
065    
066                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
067                                            categoryId, isbns);
068    
069                            try {
070                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
071                            }
072                            catch (Exception e) {
073                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
074                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
075                                    }
076    
077                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
078                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
079                                    }
080    
081                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
082                            }
083                    }
084                    catch (com.liferay.portal.kernel.exception.SystemException se) {
085                            _log.error(se, se);
086    
087                            throw se;
088                    }
089            }
090    
091            public static com.liferay.portlet.shopping.model.ShoppingItem addItem(
092                    HttpPrincipal httpPrincipal, long groupId, long categoryId,
093                    java.lang.String sku, java.lang.String name,
094                    java.lang.String description, java.lang.String properties,
095                    java.lang.String fieldsQuantities, boolean requiresShipping,
096                    int stockQuantity, boolean featured, java.lang.Boolean sale,
097                    boolean smallImage, java.lang.String smallImageURL,
098                    java.io.File smallFile, boolean mediumImage,
099                    java.lang.String mediumImageURL, java.io.File mediumFile,
100                    boolean largeImage, java.lang.String largeImageURL,
101                    java.io.File largeFile,
102                    java.util.List<com.liferay.portlet.shopping.model.ShoppingItemField> itemFields,
103                    java.util.List<com.liferay.portlet.shopping.model.ShoppingItemPrice> itemPrices,
104                    com.liferay.portal.service.ServiceContext serviceContext)
105                    throws com.liferay.portal.kernel.exception.PortalException,
106                            com.liferay.portal.kernel.exception.SystemException {
107                    try {
108                            MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class.getName(),
109                                            "addItem", long.class, long.class, java.lang.String.class,
110                                            java.lang.String.class, java.lang.String.class,
111                                            java.lang.String.class, java.lang.String.class,
112                                            boolean.class, int.class, boolean.class,
113                                            java.lang.Boolean.class, boolean.class,
114                                            java.lang.String.class, java.io.File.class, boolean.class,
115                                            java.lang.String.class, java.io.File.class, boolean.class,
116                                            java.lang.String.class, java.io.File.class,
117                                            java.util.List.class, java.util.List.class,
118                                            com.liferay.portal.service.ServiceContext.class);
119    
120                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
121                                            categoryId, sku, name, description, properties,
122                                            fieldsQuantities, requiresShipping, stockQuantity,
123                                            featured, sale, smallImage, smallImageURL, smallFile,
124                                            mediumImage, mediumImageURL, mediumFile, largeImage,
125                                            largeImageURL, largeFile, itemFields, itemPrices,
126                                            serviceContext);
127    
128                            Object returnObj = null;
129    
130                            try {
131                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
132                            }
133                            catch (Exception e) {
134                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
135                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
136                                    }
137    
138                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
139                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
140                                    }
141    
142                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
143                            }
144    
145                            return (com.liferay.portlet.shopping.model.ShoppingItem)returnObj;
146                    }
147                    catch (com.liferay.portal.kernel.exception.SystemException se) {
148                            _log.error(se, se);
149    
150                            throw se;
151                    }
152            }
153    
154            public static void deleteItem(HttpPrincipal httpPrincipal, long itemId)
155                    throws com.liferay.portal.kernel.exception.PortalException,
156                            com.liferay.portal.kernel.exception.SystemException {
157                    try {
158                            MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class.getName(),
159                                            "deleteItem", long.class);
160    
161                            MethodHandler methodHandler = new MethodHandler(methodKey, itemId);
162    
163                            try {
164                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
165                            }
166                            catch (Exception e) {
167                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
168                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
169                                    }
170    
171                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
172                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
173                                    }
174    
175                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
176                            }
177                    }
178                    catch (com.liferay.portal.kernel.exception.SystemException se) {
179                            _log.error(se, se);
180    
181                            throw se;
182                    }
183            }
184    
185            public static com.liferay.portlet.shopping.model.ShoppingItem getItem(
186                    HttpPrincipal httpPrincipal, long itemId)
187                    throws com.liferay.portal.kernel.exception.PortalException,
188                            com.liferay.portal.kernel.exception.SystemException {
189                    try {
190                            MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class.getName(),
191                                            "getItem", long.class);
192    
193                            MethodHandler methodHandler = new MethodHandler(methodKey, itemId);
194    
195                            Object returnObj = null;
196    
197                            try {
198                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
199                            }
200                            catch (Exception e) {
201                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
202                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
203                                    }
204    
205                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
206                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
207                                    }
208    
209                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
210                            }
211    
212                            return (com.liferay.portlet.shopping.model.ShoppingItem)returnObj;
213                    }
214                    catch (com.liferay.portal.kernel.exception.SystemException se) {
215                            _log.error(se, se);
216    
217                            throw se;
218                    }
219            }
220    
221            public static com.liferay.portlet.shopping.model.ShoppingItem updateItem(
222                    HttpPrincipal httpPrincipal, long itemId, long groupId,
223                    long categoryId, java.lang.String sku, java.lang.String name,
224                    java.lang.String description, java.lang.String properties,
225                    java.lang.String fieldsQuantities, boolean requiresShipping,
226                    int stockQuantity, boolean featured, java.lang.Boolean sale,
227                    boolean smallImage, java.lang.String smallImageURL,
228                    java.io.File smallFile, boolean mediumImage,
229                    java.lang.String mediumImageURL, java.io.File mediumFile,
230                    boolean largeImage, java.lang.String largeImageURL,
231                    java.io.File largeFile,
232                    java.util.List<com.liferay.portlet.shopping.model.ShoppingItemField> itemFields,
233                    java.util.List<com.liferay.portlet.shopping.model.ShoppingItemPrice> itemPrices,
234                    com.liferay.portal.service.ServiceContext serviceContext)
235                    throws com.liferay.portal.kernel.exception.PortalException,
236                            com.liferay.portal.kernel.exception.SystemException {
237                    try {
238                            MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class.getName(),
239                                            "updateItem", long.class, long.class, long.class,
240                                            java.lang.String.class, java.lang.String.class,
241                                            java.lang.String.class, java.lang.String.class,
242                                            java.lang.String.class, boolean.class, int.class,
243                                            boolean.class, java.lang.Boolean.class, boolean.class,
244                                            java.lang.String.class, java.io.File.class, boolean.class,
245                                            java.lang.String.class, java.io.File.class, boolean.class,
246                                            java.lang.String.class, java.io.File.class,
247                                            java.util.List.class, java.util.List.class,
248                                            com.liferay.portal.service.ServiceContext.class);
249    
250                            MethodHandler methodHandler = new MethodHandler(methodKey, itemId,
251                                            groupId, categoryId, sku, name, description, properties,
252                                            fieldsQuantities, requiresShipping, stockQuantity,
253                                            featured, sale, smallImage, smallImageURL, smallFile,
254                                            mediumImage, mediumImageURL, mediumFile, largeImage,
255                                            largeImageURL, largeFile, itemFields, itemPrices,
256                                            serviceContext);
257    
258                            Object returnObj = null;
259    
260                            try {
261                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
262                            }
263                            catch (Exception e) {
264                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
265                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
266                                    }
267    
268                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
269                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
270                                    }
271    
272                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
273                            }
274    
275                            return (com.liferay.portlet.shopping.model.ShoppingItem)returnObj;
276                    }
277                    catch (com.liferay.portal.kernel.exception.SystemException se) {
278                            _log.error(se, se);
279    
280                            throw se;
281                    }
282            }
283    
284            private static Log _log = LogFactoryUtil.getLog(ShoppingItemServiceHttp.class);
285    }