1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portlet.shopping.service.http;
16  
17  import com.liferay.portal.kernel.log.Log;
18  import com.liferay.portal.kernel.log.LogFactoryUtil;
19  import com.liferay.portal.kernel.util.MethodHandler;
20  import com.liferay.portal.kernel.util.MethodKey;
21  import com.liferay.portal.security.auth.HttpPrincipal;
22  import com.liferay.portal.service.http.TunnelUtil;
23  
24  import com.liferay.portlet.shopping.service.ShoppingItemServiceUtil;
25  
26  /**
27   * <a href="ShoppingItemServiceHttp.java.html"><b><i>View Source</i></b></a>
28   *
29   * <p>
30   * ServiceBuilder generated this class. Modifications in this class will be
31   * overwritten the next time is generated.
32   * </p>
33   *
34   * <p>
35   * This class provides a HTTP utility for the
36   * {@link com.liferay.portlet.shopping.service.ShoppingItemServiceUtil} service utility. The
37   * static methods of this class calls the same methods of the service utility.
38   * However, the signatures are different because it requires an additional
39   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
40   * </p>
41   *
42   * <p>
43   * The benefits of using the HTTP utility is that it is fast and allows for
44   * tunneling without the cost of serializing to text. The drawback is that it
45   * only works with Java.
46   * </p>
47   *
48   * <p>
49   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
50   * configure security.
51   * </p>
52   *
53   * <p>
54   * The HTTP utility is only generated for remote services.
55   * </p>
56   *
57   * @author    Brian Wing Shun Chan
58   * @see       ShoppingItemServiceSoap
59   * @see       com.liferay.portal.security.auth.HttpPrincipal
60   * @see       com.liferay.portlet.shopping.service.ShoppingItemServiceUtil
61   * @generated
62   */
63  public class ShoppingItemServiceHttp {
64      public static void addBookItems(HttpPrincipal httpPrincipal,
65          long categoryId, java.lang.String[] isbns)
66          throws com.liferay.portal.PortalException,
67              com.liferay.portal.SystemException {
68          try {
69              MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class.getName(),
70                      "addBookItems", _addBookItemsParameterTypes0);
71  
72              MethodHandler methodHandler = new MethodHandler(methodKey,
73                      categoryId, isbns);
74  
75              try {
76                  TunnelUtil.invoke(httpPrincipal, methodHandler);
77              }
78              catch (Exception e) {
79                  if (e instanceof com.liferay.portal.PortalException) {
80                      throw (com.liferay.portal.PortalException)e;
81                  }
82  
83                  if (e instanceof com.liferay.portal.SystemException) {
84                      throw (com.liferay.portal.SystemException)e;
85                  }
86  
87                  throw new com.liferay.portal.SystemException(e);
88              }
89          }
90          catch (com.liferay.portal.SystemException se) {
91              _log.error(se, se);
92  
93              throw se;
94          }
95      }
96  
97      public static com.liferay.portlet.shopping.model.ShoppingItem addItem(
98          HttpPrincipal httpPrincipal, long categoryId, java.lang.String sku,
99          java.lang.String name, java.lang.String description,
100         java.lang.String properties, java.lang.String fieldsQuantities,
101         boolean requiresShipping, int stockQuantity, boolean featured,
102         java.lang.Boolean sale, boolean smallImage,
103         java.lang.String smallImageURL, java.io.File smallFile,
104         boolean mediumImage, java.lang.String mediumImageURL,
105         java.io.File mediumFile, boolean largeImage,
106         java.lang.String largeImageURL, java.io.File largeFile,
107         java.util.List<com.liferay.portlet.shopping.model.ShoppingItemField> itemFields,
108         java.util.List<com.liferay.portlet.shopping.model.ShoppingItemPrice> itemPrices,
109         com.liferay.portal.service.ServiceContext serviceContext)
110         throws com.liferay.portal.PortalException,
111             com.liferay.portal.SystemException {
112         try {
113             MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class.getName(),
114                     "addItem", _addItemParameterTypes1);
115 
116             MethodHandler methodHandler = new MethodHandler(methodKey,
117                     categoryId, sku, name, description, properties,
118                     fieldsQuantities, requiresShipping, stockQuantity,
119                     featured, sale, smallImage, smallImageURL, smallFile,
120                     mediumImage, mediumImageURL, mediumFile, largeImage,
121                     largeImageURL, largeFile, itemFields, itemPrices,
122                     serviceContext);
123 
124             Object returnObj = null;
125 
126             try {
127                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
128             }
129             catch (Exception e) {
130                 if (e instanceof com.liferay.portal.PortalException) {
131                     throw (com.liferay.portal.PortalException)e;
132                 }
133 
134                 if (e instanceof com.liferay.portal.SystemException) {
135                     throw (com.liferay.portal.SystemException)e;
136                 }
137 
138                 throw new com.liferay.portal.SystemException(e);
139             }
140 
141             return (com.liferay.portlet.shopping.model.ShoppingItem)returnObj;
142         }
143         catch (com.liferay.portal.SystemException se) {
144             _log.error(se, se);
145 
146             throw se;
147         }
148     }
149 
150     public static void deleteItem(HttpPrincipal httpPrincipal, long itemId)
151         throws com.liferay.portal.PortalException,
152             com.liferay.portal.SystemException {
153         try {
154             MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class.getName(),
155                     "deleteItem", _deleteItemParameterTypes2);
156 
157             MethodHandler methodHandler = new MethodHandler(methodKey, itemId);
158 
159             try {
160                 TunnelUtil.invoke(httpPrincipal, methodHandler);
161             }
162             catch (Exception e) {
163                 if (e instanceof com.liferay.portal.PortalException) {
164                     throw (com.liferay.portal.PortalException)e;
165                 }
166 
167                 if (e instanceof com.liferay.portal.SystemException) {
168                     throw (com.liferay.portal.SystemException)e;
169                 }
170 
171                 throw new com.liferay.portal.SystemException(e);
172             }
173         }
174         catch (com.liferay.portal.SystemException se) {
175             _log.error(se, se);
176 
177             throw se;
178         }
179     }
180 
181     public static com.liferay.portlet.shopping.model.ShoppingItem getItem(
182         HttpPrincipal httpPrincipal, long itemId)
183         throws com.liferay.portal.PortalException,
184             com.liferay.portal.SystemException {
185         try {
186             MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class.getName(),
187                     "getItem", _getItemParameterTypes3);
188 
189             MethodHandler methodHandler = new MethodHandler(methodKey, itemId);
190 
191             Object returnObj = null;
192 
193             try {
194                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
195             }
196             catch (Exception e) {
197                 if (e instanceof com.liferay.portal.PortalException) {
198                     throw (com.liferay.portal.PortalException)e;
199                 }
200 
201                 if (e instanceof com.liferay.portal.SystemException) {
202                     throw (com.liferay.portal.SystemException)e;
203                 }
204 
205                 throw new com.liferay.portal.SystemException(e);
206             }
207 
208             return (com.liferay.portlet.shopping.model.ShoppingItem)returnObj;
209         }
210         catch (com.liferay.portal.SystemException se) {
211             _log.error(se, se);
212 
213             throw se;
214         }
215     }
216 
217     public static com.liferay.portlet.shopping.model.ShoppingItem updateItem(
218         HttpPrincipal httpPrincipal, long itemId, long categoryId,
219         java.lang.String sku, java.lang.String name,
220         java.lang.String description, java.lang.String properties,
221         java.lang.String fieldsQuantities, boolean requiresShipping,
222         int stockQuantity, boolean featured, java.lang.Boolean sale,
223         boolean smallImage, java.lang.String smallImageURL,
224         java.io.File smallFile, boolean mediumImage,
225         java.lang.String mediumImageURL, java.io.File mediumFile,
226         boolean largeImage, java.lang.String largeImageURL,
227         java.io.File largeFile,
228         java.util.List<com.liferay.portlet.shopping.model.ShoppingItemField> itemFields,
229         java.util.List<com.liferay.portlet.shopping.model.ShoppingItemPrice> itemPrices,
230         com.liferay.portal.service.ServiceContext serviceContext)
231         throws com.liferay.portal.PortalException,
232             com.liferay.portal.SystemException {
233         try {
234             MethodKey methodKey = new MethodKey(ShoppingItemServiceUtil.class.getName(),
235                     "updateItem", _updateItemParameterTypes4);
236 
237             MethodHandler methodHandler = new MethodHandler(methodKey, itemId,
238                     categoryId, sku, name, description, properties,
239                     fieldsQuantities, requiresShipping, stockQuantity,
240                     featured, sale, smallImage, smallImageURL, smallFile,
241                     mediumImage, mediumImageURL, mediumFile, largeImage,
242                     largeImageURL, largeFile, itemFields, itemPrices,
243                     serviceContext);
244 
245             Object returnObj = null;
246 
247             try {
248                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
249             }
250             catch (Exception e) {
251                 if (e instanceof com.liferay.portal.PortalException) {
252                     throw (com.liferay.portal.PortalException)e;
253                 }
254 
255                 if (e instanceof com.liferay.portal.SystemException) {
256                     throw (com.liferay.portal.SystemException)e;
257                 }
258 
259                 throw new com.liferay.portal.SystemException(e);
260             }
261 
262             return (com.liferay.portlet.shopping.model.ShoppingItem)returnObj;
263         }
264         catch (com.liferay.portal.SystemException se) {
265             _log.error(se, se);
266 
267             throw se;
268         }
269     }
270 
271     private static Log _log = LogFactoryUtil.getLog(ShoppingItemServiceHttp.class);
272     private static final Class<?>[] _addBookItemsParameterTypes0 = new Class[] {
273             long.class, java.lang.String[].class
274         };
275     private static final Class<?>[] _addItemParameterTypes1 = new Class[] {
276             long.class, java.lang.String.class, java.lang.String.class,
277             java.lang.String.class, java.lang.String.class,
278             java.lang.String.class, boolean.class, int.class, boolean.class,
279             java.lang.Boolean.class, boolean.class, java.lang.String.class,
280             java.io.File.class, boolean.class, java.lang.String.class,
281             java.io.File.class, boolean.class, java.lang.String.class,
282             java.io.File.class, java.util.List.class, java.util.List.class,
283             com.liferay.portal.service.ServiceContext.class
284         };
285     private static final Class<?>[] _deleteItemParameterTypes2 = new Class[] {
286             long.class
287         };
288     private static final Class<?>[] _getItemParameterTypes3 = new Class[] {
289             long.class
290         };
291     private static final Class<?>[] _updateItemParameterTypes4 = new Class[] {
292             long.class, long.class, java.lang.String.class,
293             java.lang.String.class, java.lang.String.class,
294             java.lang.String.class, java.lang.String.class, boolean.class,
295             int.class, boolean.class, java.lang.Boolean.class, boolean.class,
296             java.lang.String.class, java.io.File.class, boolean.class,
297             java.lang.String.class, java.io.File.class, boolean.class,
298             java.lang.String.class, java.io.File.class, java.util.List.class,
299             java.util.List.class,
300             com.liferay.portal.service.ServiceContext.class
301         };
302 }