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