1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
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.DoubleWrapper;
21  import com.liferay.portal.kernel.util.IntegerWrapper;
22  import com.liferay.portal.kernel.util.LongWrapper;
23  import com.liferay.portal.kernel.util.MethodWrapper;
24  import com.liferay.portal.kernel.util.NullWrapper;
25  import com.liferay.portal.security.auth.HttpPrincipal;
26  import com.liferay.portal.service.http.TunnelUtil;
27  
28  import com.liferay.portlet.shopping.service.ShoppingCouponServiceUtil;
29  
30  /**
31   * <a href="ShoppingCouponServiceHttp.java.html"><b><i>View Source</i></b></a>
32   *
33   * <p>
34   * ServiceBuilder generated this class. Modifications in this class will be
35   * overwritten the next time is generated.
36   * </p>
37   *
38   * <p>
39   * This class provides a HTTP utility for the
40   * {@link com.liferay.portlet.shopping.service.ShoppingCouponServiceUtil} service utility. The
41   * static methods of this class calls the same methods of the service utility.
42   * However, the signatures are different because it requires an additional
43   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
44   * </p>
45   *
46   * <p>
47   * The benefits of using the HTTP utility is that it is fast and allows for
48   * tunneling without the cost of serializing to text. The drawback is that it
49   * only works with Java.
50   * </p>
51   *
52   * <p>
53   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
54   * configure security.
55   * </p>
56   *
57   * <p>
58   * The HTTP utility is only generated for remote services.
59   * </p>
60   *
61   * @author    Brian Wing Shun Chan
62   * @see       ShoppingCouponServiceSoap
63   * @see       com.liferay.portal.security.auth.HttpPrincipal
64   * @see       com.liferay.portlet.shopping.service.ShoppingCouponServiceUtil
65   * @generated
66   */
67  public class ShoppingCouponServiceHttp {
68      public static com.liferay.portlet.shopping.model.ShoppingCoupon addCoupon(
69          HttpPrincipal httpPrincipal, java.lang.String code, boolean autoCode,
70          java.lang.String name, java.lang.String description,
71          int startDateMonth, int startDateDay, int startDateYear,
72          int startDateHour, int startDateMinute, int endDateMonth,
73          int endDateDay, int endDateYear, int endDateHour, int endDateMinute,
74          boolean neverExpire, boolean active, java.lang.String limitCategories,
75          java.lang.String limitSkus, double minOrder, double discount,
76          java.lang.String discountType,
77          com.liferay.portal.service.ServiceContext serviceContext)
78          throws com.liferay.portal.kernel.exception.PortalException,
79              com.liferay.portal.kernel.exception.SystemException {
80          try {
81              Object paramObj0 = code;
82  
83              if (code == null) {
84                  paramObj0 = new NullWrapper("java.lang.String");
85              }
86  
87              Object paramObj1 = new BooleanWrapper(autoCode);
88  
89              Object paramObj2 = name;
90  
91              if (name == null) {
92                  paramObj2 = new NullWrapper("java.lang.String");
93              }
94  
95              Object paramObj3 = description;
96  
97              if (description == null) {
98                  paramObj3 = new NullWrapper("java.lang.String");
99              }
100 
101             Object paramObj4 = new IntegerWrapper(startDateMonth);
102 
103             Object paramObj5 = new IntegerWrapper(startDateDay);
104 
105             Object paramObj6 = new IntegerWrapper(startDateYear);
106 
107             Object paramObj7 = new IntegerWrapper(startDateHour);
108 
109             Object paramObj8 = new IntegerWrapper(startDateMinute);
110 
111             Object paramObj9 = new IntegerWrapper(endDateMonth);
112 
113             Object paramObj10 = new IntegerWrapper(endDateDay);
114 
115             Object paramObj11 = new IntegerWrapper(endDateYear);
116 
117             Object paramObj12 = new IntegerWrapper(endDateHour);
118 
119             Object paramObj13 = new IntegerWrapper(endDateMinute);
120 
121             Object paramObj14 = new BooleanWrapper(neverExpire);
122 
123             Object paramObj15 = new BooleanWrapper(active);
124 
125             Object paramObj16 = limitCategories;
126 
127             if (limitCategories == null) {
128                 paramObj16 = new NullWrapper("java.lang.String");
129             }
130 
131             Object paramObj17 = limitSkus;
132 
133             if (limitSkus == null) {
134                 paramObj17 = new NullWrapper("java.lang.String");
135             }
136 
137             Object paramObj18 = new DoubleWrapper(minOrder);
138 
139             Object paramObj19 = new DoubleWrapper(discount);
140 
141             Object paramObj20 = discountType;
142 
143             if (discountType == null) {
144                 paramObj20 = new NullWrapper("java.lang.String");
145             }
146 
147             Object paramObj21 = serviceContext;
148 
149             if (serviceContext == null) {
150                 paramObj21 = new NullWrapper(
151                         "com.liferay.portal.service.ServiceContext");
152             }
153 
154             MethodWrapper methodWrapper = new MethodWrapper(ShoppingCouponServiceUtil.class.getName(),
155                     "addCoupon",
156                     new Object[] {
157                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
158                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
159                         paramObj10, paramObj11, paramObj12, paramObj13,
160                         paramObj14, paramObj15, paramObj16, paramObj17,
161                         paramObj18, paramObj19, paramObj20, paramObj21
162                     });
163 
164             Object returnObj = null;
165 
166             try {
167                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
168             }
169             catch (Exception e) {
170                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
171                     throw (com.liferay.portal.kernel.exception.PortalException)e;
172                 }
173 
174                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
175                     throw (com.liferay.portal.kernel.exception.SystemException)e;
176                 }
177 
178                 throw new com.liferay.portal.kernel.exception.SystemException(e);
179             }
180 
181             return (com.liferay.portlet.shopping.model.ShoppingCoupon)returnObj;
182         }
183         catch (com.liferay.portal.kernel.exception.SystemException se) {
184             _log.error(se, se);
185 
186             throw se;
187         }
188     }
189 
190     public static void deleteCoupon(HttpPrincipal httpPrincipal, long groupId,
191         long couponId)
192         throws com.liferay.portal.kernel.exception.PortalException,
193             com.liferay.portal.kernel.exception.SystemException {
194         try {
195             Object paramObj0 = new LongWrapper(groupId);
196 
197             Object paramObj1 = new LongWrapper(couponId);
198 
199             MethodWrapper methodWrapper = new MethodWrapper(ShoppingCouponServiceUtil.class.getName(),
200                     "deleteCoupon", new Object[] { paramObj0, paramObj1 });
201 
202             try {
203                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
204             }
205             catch (Exception e) {
206                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
207                     throw (com.liferay.portal.kernel.exception.PortalException)e;
208                 }
209 
210                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
211                     throw (com.liferay.portal.kernel.exception.SystemException)e;
212                 }
213 
214                 throw new com.liferay.portal.kernel.exception.SystemException(e);
215             }
216         }
217         catch (com.liferay.portal.kernel.exception.SystemException se) {
218             _log.error(se, se);
219 
220             throw se;
221         }
222     }
223 
224     public static com.liferay.portlet.shopping.model.ShoppingCoupon getCoupon(
225         HttpPrincipal httpPrincipal, long groupId, long couponId)
226         throws com.liferay.portal.kernel.exception.PortalException,
227             com.liferay.portal.kernel.exception.SystemException {
228         try {
229             Object paramObj0 = new LongWrapper(groupId);
230 
231             Object paramObj1 = new LongWrapper(couponId);
232 
233             MethodWrapper methodWrapper = new MethodWrapper(ShoppingCouponServiceUtil.class.getName(),
234                     "getCoupon", new Object[] { paramObj0, paramObj1 });
235 
236             Object returnObj = null;
237 
238             try {
239                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
240             }
241             catch (Exception e) {
242                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
243                     throw (com.liferay.portal.kernel.exception.PortalException)e;
244                 }
245 
246                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
247                     throw (com.liferay.portal.kernel.exception.SystemException)e;
248                 }
249 
250                 throw new com.liferay.portal.kernel.exception.SystemException(e);
251             }
252 
253             return (com.liferay.portlet.shopping.model.ShoppingCoupon)returnObj;
254         }
255         catch (com.liferay.portal.kernel.exception.SystemException se) {
256             _log.error(se, se);
257 
258             throw se;
259         }
260     }
261 
262     public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCoupon> search(
263         HttpPrincipal httpPrincipal, long groupId, long companyId,
264         java.lang.String code, boolean active, java.lang.String discountType,
265         boolean andOperator, int start, int end)
266         throws com.liferay.portal.kernel.exception.PortalException,
267             com.liferay.portal.kernel.exception.SystemException {
268         try {
269             Object paramObj0 = new LongWrapper(groupId);
270 
271             Object paramObj1 = new LongWrapper(companyId);
272 
273             Object paramObj2 = code;
274 
275             if (code == null) {
276                 paramObj2 = new NullWrapper("java.lang.String");
277             }
278 
279             Object paramObj3 = new BooleanWrapper(active);
280 
281             Object paramObj4 = discountType;
282 
283             if (discountType == null) {
284                 paramObj4 = new NullWrapper("java.lang.String");
285             }
286 
287             Object paramObj5 = new BooleanWrapper(andOperator);
288 
289             Object paramObj6 = new IntegerWrapper(start);
290 
291             Object paramObj7 = new IntegerWrapper(end);
292 
293             MethodWrapper methodWrapper = new MethodWrapper(ShoppingCouponServiceUtil.class.getName(),
294                     "search",
295                     new Object[] {
296                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
297                         paramObj5, paramObj6, paramObj7
298                     });
299 
300             Object returnObj = null;
301 
302             try {
303                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
304             }
305             catch (Exception e) {
306                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
307                     throw (com.liferay.portal.kernel.exception.PortalException)e;
308                 }
309 
310                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
311                     throw (com.liferay.portal.kernel.exception.SystemException)e;
312                 }
313 
314                 throw new com.liferay.portal.kernel.exception.SystemException(e);
315             }
316 
317             return (java.util.List<com.liferay.portlet.shopping.model.ShoppingCoupon>)returnObj;
318         }
319         catch (com.liferay.portal.kernel.exception.SystemException se) {
320             _log.error(se, se);
321 
322             throw se;
323         }
324     }
325 
326     public static com.liferay.portlet.shopping.model.ShoppingCoupon updateCoupon(
327         HttpPrincipal httpPrincipal, long couponId, java.lang.String name,
328         java.lang.String description, int startDateMonth, int startDateDay,
329         int startDateYear, int startDateHour, int startDateMinute,
330         int endDateMonth, int endDateDay, int endDateYear, int endDateHour,
331         int endDateMinute, boolean neverExpire, boolean active,
332         java.lang.String limitCategories, java.lang.String limitSkus,
333         double minOrder, double discount, java.lang.String discountType,
334         com.liferay.portal.service.ServiceContext serviceContext)
335         throws com.liferay.portal.kernel.exception.PortalException,
336             com.liferay.portal.kernel.exception.SystemException {
337         try {
338             Object paramObj0 = new LongWrapper(couponId);
339 
340             Object paramObj1 = name;
341 
342             if (name == null) {
343                 paramObj1 = new NullWrapper("java.lang.String");
344             }
345 
346             Object paramObj2 = description;
347 
348             if (description == null) {
349                 paramObj2 = new NullWrapper("java.lang.String");
350             }
351 
352             Object paramObj3 = new IntegerWrapper(startDateMonth);
353 
354             Object paramObj4 = new IntegerWrapper(startDateDay);
355 
356             Object paramObj5 = new IntegerWrapper(startDateYear);
357 
358             Object paramObj6 = new IntegerWrapper(startDateHour);
359 
360             Object paramObj7 = new IntegerWrapper(startDateMinute);
361 
362             Object paramObj8 = new IntegerWrapper(endDateMonth);
363 
364             Object paramObj9 = new IntegerWrapper(endDateDay);
365 
366             Object paramObj10 = new IntegerWrapper(endDateYear);
367 
368             Object paramObj11 = new IntegerWrapper(endDateHour);
369 
370             Object paramObj12 = new IntegerWrapper(endDateMinute);
371 
372             Object paramObj13 = new BooleanWrapper(neverExpire);
373 
374             Object paramObj14 = new BooleanWrapper(active);
375 
376             Object paramObj15 = limitCategories;
377 
378             if (limitCategories == null) {
379                 paramObj15 = new NullWrapper("java.lang.String");
380             }
381 
382             Object paramObj16 = limitSkus;
383 
384             if (limitSkus == null) {
385                 paramObj16 = new NullWrapper("java.lang.String");
386             }
387 
388             Object paramObj17 = new DoubleWrapper(minOrder);
389 
390             Object paramObj18 = new DoubleWrapper(discount);
391 
392             Object paramObj19 = discountType;
393 
394             if (discountType == null) {
395                 paramObj19 = new NullWrapper("java.lang.String");
396             }
397 
398             Object paramObj20 = serviceContext;
399 
400             if (serviceContext == null) {
401                 paramObj20 = new NullWrapper(
402                         "com.liferay.portal.service.ServiceContext");
403             }
404 
405             MethodWrapper methodWrapper = new MethodWrapper(ShoppingCouponServiceUtil.class.getName(),
406                     "updateCoupon",
407                     new Object[] {
408                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
409                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
410                         paramObj10, paramObj11, paramObj12, paramObj13,
411                         paramObj14, paramObj15, paramObj16, paramObj17,
412                         paramObj18, paramObj19, paramObj20
413                     });
414 
415             Object returnObj = null;
416 
417             try {
418                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
419             }
420             catch (Exception e) {
421                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
422                     throw (com.liferay.portal.kernel.exception.PortalException)e;
423                 }
424 
425                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
426                     throw (com.liferay.portal.kernel.exception.SystemException)e;
427                 }
428 
429                 throw new com.liferay.portal.kernel.exception.SystemException(e);
430             }
431 
432             return (com.liferay.portlet.shopping.model.ShoppingCoupon)returnObj;
433         }
434         catch (com.liferay.portal.kernel.exception.SystemException se) {
435             _log.error(se, se);
436 
437             throw se;
438         }
439     }
440 
441     private static Log _log = LogFactoryUtil.getLog(ShoppingCouponServiceHttp.class);
442 }