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.BooleanWrapper;
20  import com.liferay.portal.kernel.util.IntegerWrapper;
21  import com.liferay.portal.kernel.util.LongWrapper;
22  import com.liferay.portal.kernel.util.MethodWrapper;
23  import com.liferay.portal.kernel.util.NullWrapper;
24  import com.liferay.portal.security.auth.HttpPrincipal;
25  import com.liferay.portal.service.http.TunnelUtil;
26  
27  import com.liferay.portlet.shopping.service.ShoppingItemServiceUtil;
28  
29  /**
30   * <a href="ShoppingItemServiceHttp.java.html"><b><i>View Source</i></b></a>
31   *
32   * <p>
33   * ServiceBuilder generated this class. Modifications in this class will be
34   * overwritten the next time is generated.
35   * </p>
36   *
37   * <p>
38   * This class provides a HTTP utility for the
39   * {@link com.liferay.portlet.shopping.service.ShoppingItemServiceUtil} service utility. The
40   * static methods of this class calls the same methods of the service utility.
41   * However, the signatures are different because it requires an additional
42   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
43   * </p>
44   *
45   * <p>
46   * The benefits of using the HTTP utility is that it is fast and allows for
47   * tunneling without the cost of serializing to text. The drawback is that it
48   * only works with Java.
49   * </p>
50   *
51   * <p>
52   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
53   * configure security.
54   * </p>
55   *
56   * <p>
57   * The HTTP utility is only generated for remote services.
58   * </p>
59   *
60   * @author    Brian Wing Shun Chan
61   * @see       ShoppingItemServiceSoap
62   * @see       com.liferay.portal.security.auth.HttpPrincipal
63   * @see       com.liferay.portlet.shopping.service.ShoppingItemServiceUtil
64   * @generated
65   */
66  public class ShoppingItemServiceHttp {
67      public static void addBookItems(HttpPrincipal httpPrincipal,
68          long categoryId, java.lang.String[] isbns)
69          throws com.liferay.portal.PortalException,
70              com.liferay.portal.SystemException {
71          try {
72              Object paramObj0 = new LongWrapper(categoryId);
73  
74              Object paramObj1 = isbns;
75  
76              if (isbns == null) {
77                  paramObj1 = new NullWrapper("[Ljava.lang.String;");
78              }
79  
80              MethodWrapper methodWrapper = new MethodWrapper(ShoppingItemServiceUtil.class.getName(),
81                      "addBookItems", new Object[] { paramObj0, paramObj1 });
82  
83              try {
84                  TunnelUtil.invoke(httpPrincipal, methodWrapper);
85              }
86              catch (Exception e) {
87                  if (e instanceof com.liferay.portal.PortalException) {
88                      throw (com.liferay.portal.PortalException)e;
89                  }
90  
91                  if (e instanceof com.liferay.portal.SystemException) {
92                      throw (com.liferay.portal.SystemException)e;
93                  }
94  
95                  throw new com.liferay.portal.SystemException(e);
96              }
97          }
98          catch (com.liferay.portal.SystemException se) {
99              _log.error(se, se);
100 
101             throw se;
102         }
103     }
104 
105     public static com.liferay.portlet.shopping.model.ShoppingItem addItem(
106         HttpPrincipal httpPrincipal, long categoryId, java.lang.String sku,
107         java.lang.String name, java.lang.String description,
108         java.lang.String properties, java.lang.String fieldsQuantities,
109         boolean requiresShipping, int stockQuantity, boolean featured,
110         java.lang.Boolean sale, boolean smallImage,
111         java.lang.String smallImageURL, java.io.File smallFile,
112         boolean mediumImage, java.lang.String mediumImageURL,
113         java.io.File mediumFile, boolean largeImage,
114         java.lang.String largeImageURL, java.io.File largeFile,
115         java.util.List<com.liferay.portlet.shopping.model.ShoppingItemField> itemFields,
116         java.util.List<com.liferay.portlet.shopping.model.ShoppingItemPrice> itemPrices,
117         boolean addCommunityPermissions, boolean addGuestPermissions)
118         throws com.liferay.portal.PortalException,
119             com.liferay.portal.SystemException {
120         try {
121             Object paramObj0 = new LongWrapper(categoryId);
122 
123             Object paramObj1 = sku;
124 
125             if (sku == null) {
126                 paramObj1 = new NullWrapper("java.lang.String");
127             }
128 
129             Object paramObj2 = name;
130 
131             if (name == null) {
132                 paramObj2 = new NullWrapper("java.lang.String");
133             }
134 
135             Object paramObj3 = description;
136 
137             if (description == null) {
138                 paramObj3 = new NullWrapper("java.lang.String");
139             }
140 
141             Object paramObj4 = properties;
142 
143             if (properties == null) {
144                 paramObj4 = new NullWrapper("java.lang.String");
145             }
146 
147             Object paramObj5 = fieldsQuantities;
148 
149             if (fieldsQuantities == null) {
150                 paramObj5 = new NullWrapper("java.lang.String");
151             }
152 
153             Object paramObj6 = new BooleanWrapper(requiresShipping);
154 
155             Object paramObj7 = new IntegerWrapper(stockQuantity);
156 
157             Object paramObj8 = new BooleanWrapper(featured);
158 
159             Object paramObj9 = sale;
160 
161             if (sale == null) {
162                 paramObj9 = new NullWrapper("java.lang.Boolean");
163             }
164 
165             Object paramObj10 = new BooleanWrapper(smallImage);
166 
167             Object paramObj11 = smallImageURL;
168 
169             if (smallImageURL == null) {
170                 paramObj11 = new NullWrapper("java.lang.String");
171             }
172 
173             Object paramObj12 = smallFile;
174 
175             if (smallFile == null) {
176                 paramObj12 = new NullWrapper("java.io.File");
177             }
178 
179             Object paramObj13 = new BooleanWrapper(mediumImage);
180 
181             Object paramObj14 = mediumImageURL;
182 
183             if (mediumImageURL == null) {
184                 paramObj14 = new NullWrapper("java.lang.String");
185             }
186 
187             Object paramObj15 = mediumFile;
188 
189             if (mediumFile == null) {
190                 paramObj15 = new NullWrapper("java.io.File");
191             }
192 
193             Object paramObj16 = new BooleanWrapper(largeImage);
194 
195             Object paramObj17 = largeImageURL;
196 
197             if (largeImageURL == null) {
198                 paramObj17 = new NullWrapper("java.lang.String");
199             }
200 
201             Object paramObj18 = largeFile;
202 
203             if (largeFile == null) {
204                 paramObj18 = new NullWrapper("java.io.File");
205             }
206 
207             Object paramObj19 = itemFields;
208 
209             if (itemFields == null) {
210                 paramObj19 = new NullWrapper("java.util.List");
211             }
212 
213             Object paramObj20 = itemPrices;
214 
215             if (itemPrices == null) {
216                 paramObj20 = new NullWrapper("java.util.List");
217             }
218 
219             Object paramObj21 = new BooleanWrapper(addCommunityPermissions);
220 
221             Object paramObj22 = new BooleanWrapper(addGuestPermissions);
222 
223             MethodWrapper methodWrapper = new MethodWrapper(ShoppingItemServiceUtil.class.getName(),
224                     "addItem",
225                     new Object[] {
226                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
227                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
228                         paramObj10, paramObj11, paramObj12, paramObj13,
229                         paramObj14, paramObj15, paramObj16, paramObj17,
230                         paramObj18, paramObj19, paramObj20, paramObj21,
231                         paramObj22
232                     });
233 
234             Object returnObj = null;
235 
236             try {
237                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
238             }
239             catch (Exception e) {
240                 if (e instanceof com.liferay.portal.PortalException) {
241                     throw (com.liferay.portal.PortalException)e;
242                 }
243 
244                 if (e instanceof com.liferay.portal.SystemException) {
245                     throw (com.liferay.portal.SystemException)e;
246                 }
247 
248                 throw new com.liferay.portal.SystemException(e);
249             }
250 
251             return (com.liferay.portlet.shopping.model.ShoppingItem)returnObj;
252         }
253         catch (com.liferay.portal.SystemException se) {
254             _log.error(se, se);
255 
256             throw se;
257         }
258     }
259 
260     public static com.liferay.portlet.shopping.model.ShoppingItem addItem(
261         HttpPrincipal httpPrincipal, long categoryId, java.lang.String sku,
262         java.lang.String name, java.lang.String description,
263         java.lang.String properties, java.lang.String fieldsQuantities,
264         boolean requiresShipping, int stockQuantity, boolean featured,
265         java.lang.Boolean sale, boolean smallImage,
266         java.lang.String smallImageURL, java.io.File smallFile,
267         boolean mediumImage, java.lang.String mediumImageURL,
268         java.io.File mediumFile, boolean largeImage,
269         java.lang.String largeImageURL, java.io.File largeFile,
270         java.util.List<com.liferay.portlet.shopping.model.ShoppingItemField> itemFields,
271         java.util.List<com.liferay.portlet.shopping.model.ShoppingItemPrice> itemPrices,
272         java.lang.String[] communityPermissions,
273         java.lang.String[] guestPermissions)
274         throws com.liferay.portal.PortalException,
275             com.liferay.portal.SystemException {
276         try {
277             Object paramObj0 = new LongWrapper(categoryId);
278 
279             Object paramObj1 = sku;
280 
281             if (sku == null) {
282                 paramObj1 = new NullWrapper("java.lang.String");
283             }
284 
285             Object paramObj2 = name;
286 
287             if (name == null) {
288                 paramObj2 = new NullWrapper("java.lang.String");
289             }
290 
291             Object paramObj3 = description;
292 
293             if (description == null) {
294                 paramObj3 = new NullWrapper("java.lang.String");
295             }
296 
297             Object paramObj4 = properties;
298 
299             if (properties == null) {
300                 paramObj4 = new NullWrapper("java.lang.String");
301             }
302 
303             Object paramObj5 = fieldsQuantities;
304 
305             if (fieldsQuantities == null) {
306                 paramObj5 = new NullWrapper("java.lang.String");
307             }
308 
309             Object paramObj6 = new BooleanWrapper(requiresShipping);
310 
311             Object paramObj7 = new IntegerWrapper(stockQuantity);
312 
313             Object paramObj8 = new BooleanWrapper(featured);
314 
315             Object paramObj9 = sale;
316 
317             if (sale == null) {
318                 paramObj9 = new NullWrapper("java.lang.Boolean");
319             }
320 
321             Object paramObj10 = new BooleanWrapper(smallImage);
322 
323             Object paramObj11 = smallImageURL;
324 
325             if (smallImageURL == null) {
326                 paramObj11 = new NullWrapper("java.lang.String");
327             }
328 
329             Object paramObj12 = smallFile;
330 
331             if (smallFile == null) {
332                 paramObj12 = new NullWrapper("java.io.File");
333             }
334 
335             Object paramObj13 = new BooleanWrapper(mediumImage);
336 
337             Object paramObj14 = mediumImageURL;
338 
339             if (mediumImageURL == null) {
340                 paramObj14 = new NullWrapper("java.lang.String");
341             }
342 
343             Object paramObj15 = mediumFile;
344 
345             if (mediumFile == null) {
346                 paramObj15 = new NullWrapper("java.io.File");
347             }
348 
349             Object paramObj16 = new BooleanWrapper(largeImage);
350 
351             Object paramObj17 = largeImageURL;
352 
353             if (largeImageURL == null) {
354                 paramObj17 = new NullWrapper("java.lang.String");
355             }
356 
357             Object paramObj18 = largeFile;
358 
359             if (largeFile == null) {
360                 paramObj18 = new NullWrapper("java.io.File");
361             }
362 
363             Object paramObj19 = itemFields;
364 
365             if (itemFields == null) {
366                 paramObj19 = new NullWrapper("java.util.List");
367             }
368 
369             Object paramObj20 = itemPrices;
370 
371             if (itemPrices == null) {
372                 paramObj20 = new NullWrapper("java.util.List");
373             }
374 
375             Object paramObj21 = communityPermissions;
376 
377             if (communityPermissions == null) {
378                 paramObj21 = new NullWrapper("[Ljava.lang.String;");
379             }
380 
381             Object paramObj22 = guestPermissions;
382 
383             if (guestPermissions == null) {
384                 paramObj22 = new NullWrapper("[Ljava.lang.String;");
385             }
386 
387             MethodWrapper methodWrapper = new MethodWrapper(ShoppingItemServiceUtil.class.getName(),
388                     "addItem",
389                     new Object[] {
390                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
391                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
392                         paramObj10, paramObj11, paramObj12, paramObj13,
393                         paramObj14, paramObj15, paramObj16, paramObj17,
394                         paramObj18, paramObj19, paramObj20, paramObj21,
395                         paramObj22
396                     });
397 
398             Object returnObj = null;
399 
400             try {
401                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
402             }
403             catch (Exception e) {
404                 if (e instanceof com.liferay.portal.PortalException) {
405                     throw (com.liferay.portal.PortalException)e;
406                 }
407 
408                 if (e instanceof com.liferay.portal.SystemException) {
409                     throw (com.liferay.portal.SystemException)e;
410                 }
411 
412                 throw new com.liferay.portal.SystemException(e);
413             }
414 
415             return (com.liferay.portlet.shopping.model.ShoppingItem)returnObj;
416         }
417         catch (com.liferay.portal.SystemException se) {
418             _log.error(se, se);
419 
420             throw se;
421         }
422     }
423 
424     public static void deleteItem(HttpPrincipal httpPrincipal, long itemId)
425         throws com.liferay.portal.PortalException,
426             com.liferay.portal.SystemException {
427         try {
428             Object paramObj0 = new LongWrapper(itemId);
429 
430             MethodWrapper methodWrapper = new MethodWrapper(ShoppingItemServiceUtil.class.getName(),
431                     "deleteItem", new Object[] { paramObj0 });
432 
433             try {
434                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
435             }
436             catch (Exception e) {
437                 if (e instanceof com.liferay.portal.PortalException) {
438                     throw (com.liferay.portal.PortalException)e;
439                 }
440 
441                 if (e instanceof com.liferay.portal.SystemException) {
442                     throw (com.liferay.portal.SystemException)e;
443                 }
444 
445                 throw new com.liferay.portal.SystemException(e);
446             }
447         }
448         catch (com.liferay.portal.SystemException se) {
449             _log.error(se, se);
450 
451             throw se;
452         }
453     }
454 
455     public static com.liferay.portlet.shopping.model.ShoppingItem getItem(
456         HttpPrincipal httpPrincipal, long itemId)
457         throws com.liferay.portal.PortalException,
458             com.liferay.portal.SystemException {
459         try {
460             Object paramObj0 = new LongWrapper(itemId);
461 
462             MethodWrapper methodWrapper = new MethodWrapper(ShoppingItemServiceUtil.class.getName(),
463                     "getItem", new Object[] { paramObj0 });
464 
465             Object returnObj = null;
466 
467             try {
468                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
469             }
470             catch (Exception e) {
471                 if (e instanceof com.liferay.portal.PortalException) {
472                     throw (com.liferay.portal.PortalException)e;
473                 }
474 
475                 if (e instanceof com.liferay.portal.SystemException) {
476                     throw (com.liferay.portal.SystemException)e;
477                 }
478 
479                 throw new com.liferay.portal.SystemException(e);
480             }
481 
482             return (com.liferay.portlet.shopping.model.ShoppingItem)returnObj;
483         }
484         catch (com.liferay.portal.SystemException se) {
485             _log.error(se, se);
486 
487             throw se;
488         }
489     }
490 
491     public static com.liferay.portlet.shopping.model.ShoppingItem updateItem(
492         HttpPrincipal httpPrincipal, long itemId, long categoryId,
493         java.lang.String sku, java.lang.String name,
494         java.lang.String description, java.lang.String properties,
495         java.lang.String fieldsQuantities, boolean requiresShipping,
496         int stockQuantity, boolean featured, java.lang.Boolean sale,
497         boolean smallImage, java.lang.String smallImageURL,
498         java.io.File smallFile, boolean mediumImage,
499         java.lang.String mediumImageURL, java.io.File mediumFile,
500         boolean largeImage, java.lang.String largeImageURL,
501         java.io.File largeFile,
502         java.util.List<com.liferay.portlet.shopping.model.ShoppingItemField> itemFields,
503         java.util.List<com.liferay.portlet.shopping.model.ShoppingItemPrice> itemPrices)
504         throws com.liferay.portal.PortalException,
505             com.liferay.portal.SystemException {
506         try {
507             Object paramObj0 = new LongWrapper(itemId);
508 
509             Object paramObj1 = new LongWrapper(categoryId);
510 
511             Object paramObj2 = sku;
512 
513             if (sku == null) {
514                 paramObj2 = new NullWrapper("java.lang.String");
515             }
516 
517             Object paramObj3 = name;
518 
519             if (name == null) {
520                 paramObj3 = new NullWrapper("java.lang.String");
521             }
522 
523             Object paramObj4 = description;
524 
525             if (description == null) {
526                 paramObj4 = new NullWrapper("java.lang.String");
527             }
528 
529             Object paramObj5 = properties;
530 
531             if (properties == null) {
532                 paramObj5 = new NullWrapper("java.lang.String");
533             }
534 
535             Object paramObj6 = fieldsQuantities;
536 
537             if (fieldsQuantities == null) {
538                 paramObj6 = new NullWrapper("java.lang.String");
539             }
540 
541             Object paramObj7 = new BooleanWrapper(requiresShipping);
542 
543             Object paramObj8 = new IntegerWrapper(stockQuantity);
544 
545             Object paramObj9 = new BooleanWrapper(featured);
546 
547             Object paramObj10 = sale;
548 
549             if (sale == null) {
550                 paramObj10 = new NullWrapper("java.lang.Boolean");
551             }
552 
553             Object paramObj11 = new BooleanWrapper(smallImage);
554 
555             Object paramObj12 = smallImageURL;
556 
557             if (smallImageURL == null) {
558                 paramObj12 = new NullWrapper("java.lang.String");
559             }
560 
561             Object paramObj13 = smallFile;
562 
563             if (smallFile == null) {
564                 paramObj13 = new NullWrapper("java.io.File");
565             }
566 
567             Object paramObj14 = new BooleanWrapper(mediumImage);
568 
569             Object paramObj15 = mediumImageURL;
570 
571             if (mediumImageURL == null) {
572                 paramObj15 = new NullWrapper("java.lang.String");
573             }
574 
575             Object paramObj16 = mediumFile;
576 
577             if (mediumFile == null) {
578                 paramObj16 = new NullWrapper("java.io.File");
579             }
580 
581             Object paramObj17 = new BooleanWrapper(largeImage);
582 
583             Object paramObj18 = largeImageURL;
584 
585             if (largeImageURL == null) {
586                 paramObj18 = new NullWrapper("java.lang.String");
587             }
588 
589             Object paramObj19 = largeFile;
590 
591             if (largeFile == null) {
592                 paramObj19 = new NullWrapper("java.io.File");
593             }
594 
595             Object paramObj20 = itemFields;
596 
597             if (itemFields == null) {
598                 paramObj20 = new NullWrapper("java.util.List");
599             }
600 
601             Object paramObj21 = itemPrices;
602 
603             if (itemPrices == null) {
604                 paramObj21 = new NullWrapper("java.util.List");
605             }
606 
607             MethodWrapper methodWrapper = new MethodWrapper(ShoppingItemServiceUtil.class.getName(),
608                     "updateItem",
609                     new Object[] {
610                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
611                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
612                         paramObj10, paramObj11, paramObj12, paramObj13,
613                         paramObj14, paramObj15, paramObj16, paramObj17,
614                         paramObj18, paramObj19, paramObj20, paramObj21
615                     });
616 
617             Object returnObj = null;
618 
619             try {
620                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
621             }
622             catch (Exception e) {
623                 if (e instanceof com.liferay.portal.PortalException) {
624                     throw (com.liferay.portal.PortalException)e;
625                 }
626 
627                 if (e instanceof com.liferay.portal.SystemException) {
628                     throw (com.liferay.portal.SystemException)e;
629                 }
630 
631                 throw new com.liferay.portal.SystemException(e);
632             }
633 
634             return (com.liferay.portlet.shopping.model.ShoppingItem)returnObj;
635         }
636         catch (com.liferay.portal.SystemException se) {
637             _log.error(se, se);
638 
639             throw se;
640         }
641     }
642 
643     private static Log _log = LogFactoryUtil.getLog(ShoppingItemServiceHttp.class);
644 }