001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portlet.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 com.liferay.portlet.shopping.model.ShoppingItem getItem(
176                    HttpPrincipal httpPrincipal, long itemId)
177                    throws com.liferay.portal.kernel.exception.PortalException,
178                            com.liferay.portal.kernel.exception.SystemException {
179                    try {
180                            MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class.getName(),
181                                            "getItem", _getItemParameterTypes3);
182    
183                            MethodHandler methodHandler = new MethodHandler(methodKey, itemId);
184    
185                            Object returnObj = null;
186    
187                            try {
188                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
189                            }
190                            catch (Exception e) {
191                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
192                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
193                                    }
194    
195                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
196                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
197                                    }
198    
199                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
200                            }
201    
202                            return (com.liferay.portlet.shopping.model.ShoppingItem)returnObj;
203                    }
204                    catch (com.liferay.portal.kernel.exception.SystemException se) {
205                            _log.error(se, se);
206    
207                            throw se;
208                    }
209            }
210    
211            public static com.liferay.portlet.shopping.model.ShoppingItem updateItem(
212                    HttpPrincipal httpPrincipal, long itemId, long groupId,
213                    long categoryId, java.lang.String sku, java.lang.String name,
214                    java.lang.String description, java.lang.String properties,
215                    java.lang.String fieldsQuantities, boolean requiresShipping,
216                    int stockQuantity, boolean featured, java.lang.Boolean sale,
217                    boolean smallImage, java.lang.String smallImageURL,
218                    java.io.File smallFile, boolean mediumImage,
219                    java.lang.String mediumImageURL, java.io.File mediumFile,
220                    boolean largeImage, java.lang.String largeImageURL,
221                    java.io.File largeFile,
222                    java.util.List<com.liferay.portlet.shopping.model.ShoppingItemField> itemFields,
223                    java.util.List<com.liferay.portlet.shopping.model.ShoppingItemPrice> itemPrices,
224                    com.liferay.portal.service.ServiceContext serviceContext)
225                    throws com.liferay.portal.kernel.exception.PortalException,
226                            com.liferay.portal.kernel.exception.SystemException {
227                    try {
228                            MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class.getName(),
229                                            "updateItem", _updateItemParameterTypes4);
230    
231                            MethodHandler methodHandler = new MethodHandler(methodKey, itemId,
232                                            groupId, categoryId, sku, name, description, properties,
233                                            fieldsQuantities, requiresShipping, stockQuantity,
234                                            featured, sale, smallImage, smallImageURL, smallFile,
235                                            mediumImage, mediumImageURL, mediumFile, largeImage,
236                                            largeImageURL, largeFile, itemFields, itemPrices,
237                                            serviceContext);
238    
239                            Object returnObj = null;
240    
241                            try {
242                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
243                            }
244                            catch (Exception e) {
245                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
246                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
247                                    }
248    
249                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
250                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
251                                    }
252    
253                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
254                            }
255    
256                            return (com.liferay.portlet.shopping.model.ShoppingItem)returnObj;
257                    }
258                    catch (com.liferay.portal.kernel.exception.SystemException se) {
259                            _log.error(se, se);
260    
261                            throw se;
262                    }
263            }
264    
265            private static Log _log = LogFactoryUtil.getLog(ShoppingItemServiceHttp.class);
266            private static final Class<?>[] _addBookItemsParameterTypes0 = new Class[] {
267                            long.class, long.class, java.lang.String[].class
268                    };
269            private static final Class<?>[] _addItemParameterTypes1 = new Class[] {
270                            long.class, long.class, java.lang.String.class,
271                            java.lang.String.class, java.lang.String.class,
272                            java.lang.String.class, java.lang.String.class, boolean.class,
273                            int.class, boolean.class, java.lang.Boolean.class, boolean.class,
274                            java.lang.String.class, java.io.File.class, boolean.class,
275                            java.lang.String.class, java.io.File.class, boolean.class,
276                            java.lang.String.class, java.io.File.class, java.util.List.class,
277                            java.util.List.class,
278                            com.liferay.portal.service.ServiceContext.class
279                    };
280            private static final Class<?>[] _deleteItemParameterTypes2 = new Class[] {
281                            long.class
282                    };
283            private static final Class<?>[] _getItemParameterTypes3 = new Class[] {
284                            long.class
285                    };
286            private static final Class<?>[] _updateItemParameterTypes4 = new Class[] {
287                            long.class, long.class, long.class, java.lang.String.class,
288                            java.lang.String.class, java.lang.String.class,
289                            java.lang.String.class, java.lang.String.class, boolean.class,
290                            int.class, boolean.class, java.lang.Boolean.class, boolean.class,
291                            java.lang.String.class, java.io.File.class, boolean.class,
292                            java.lang.String.class, java.io.File.class, boolean.class,
293                            java.lang.String.class, java.io.File.class, java.util.List.class,
294                            java.util.List.class,
295                            com.liferay.portal.service.ServiceContext.class
296                    };
297    }