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.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, long plid, java.lang.String code,
70          boolean autoCode, 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          throws com.liferay.portal.PortalException,
78              com.liferay.portal.SystemException {
79          try {
80              Object paramObj0 = new LongWrapper(plid);
81  
82              Object paramObj1 = code;
83  
84              if (code == null) {
85                  paramObj1 = new NullWrapper("java.lang.String");
86              }
87  
88              Object paramObj2 = new BooleanWrapper(autoCode);
89  
90              Object paramObj3 = name;
91  
92              if (name == null) {
93                  paramObj3 = new NullWrapper("java.lang.String");
94              }
95  
96              Object paramObj4 = description;
97  
98              if (description == null) {
99                  paramObj4 = new NullWrapper("java.lang.String");
100             }
101 
102             Object paramObj5 = new IntegerWrapper(startDateMonth);
103 
104             Object paramObj6 = new IntegerWrapper(startDateDay);
105 
106             Object paramObj7 = new IntegerWrapper(startDateYear);
107 
108             Object paramObj8 = new IntegerWrapper(startDateHour);
109 
110             Object paramObj9 = new IntegerWrapper(startDateMinute);
111 
112             Object paramObj10 = new IntegerWrapper(endDateMonth);
113 
114             Object paramObj11 = new IntegerWrapper(endDateDay);
115 
116             Object paramObj12 = new IntegerWrapper(endDateYear);
117 
118             Object paramObj13 = new IntegerWrapper(endDateHour);
119 
120             Object paramObj14 = new IntegerWrapper(endDateMinute);
121 
122             Object paramObj15 = new BooleanWrapper(neverExpire);
123 
124             Object paramObj16 = new BooleanWrapper(active);
125 
126             Object paramObj17 = limitCategories;
127 
128             if (limitCategories == null) {
129                 paramObj17 = new NullWrapper("java.lang.String");
130             }
131 
132             Object paramObj18 = limitSkus;
133 
134             if (limitSkus == null) {
135                 paramObj18 = new NullWrapper("java.lang.String");
136             }
137 
138             Object paramObj19 = new DoubleWrapper(minOrder);
139 
140             Object paramObj20 = new DoubleWrapper(discount);
141 
142             Object paramObj21 = discountType;
143 
144             if (discountType == null) {
145                 paramObj21 = new NullWrapper("java.lang.String");
146             }
147 
148             MethodWrapper methodWrapper = new MethodWrapper(ShoppingCouponServiceUtil.class.getName(),
149                     "addCoupon",
150                     new Object[] {
151                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
152                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
153                         paramObj10, paramObj11, paramObj12, paramObj13,
154                         paramObj14, paramObj15, paramObj16, paramObj17,
155                         paramObj18, paramObj19, paramObj20, paramObj21
156                     });
157 
158             Object returnObj = null;
159 
160             try {
161                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
162             }
163             catch (Exception e) {
164                 if (e instanceof com.liferay.portal.PortalException) {
165                     throw (com.liferay.portal.PortalException)e;
166                 }
167 
168                 if (e instanceof com.liferay.portal.SystemException) {
169                     throw (com.liferay.portal.SystemException)e;
170                 }
171 
172                 throw new com.liferay.portal.SystemException(e);
173             }
174 
175             return (com.liferay.portlet.shopping.model.ShoppingCoupon)returnObj;
176         }
177         catch (com.liferay.portal.SystemException se) {
178             _log.error(se, se);
179 
180             throw se;
181         }
182     }
183 
184     public static void deleteCoupon(HttpPrincipal httpPrincipal, long plid,
185         long couponId)
186         throws com.liferay.portal.PortalException,
187             com.liferay.portal.SystemException {
188         try {
189             Object paramObj0 = new LongWrapper(plid);
190 
191             Object paramObj1 = new LongWrapper(couponId);
192 
193             MethodWrapper methodWrapper = new MethodWrapper(ShoppingCouponServiceUtil.class.getName(),
194                     "deleteCoupon", new Object[] { paramObj0, paramObj1 });
195 
196             try {
197                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
198             }
199             catch (Exception e) {
200                 if (e instanceof com.liferay.portal.PortalException) {
201                     throw (com.liferay.portal.PortalException)e;
202                 }
203 
204                 if (e instanceof com.liferay.portal.SystemException) {
205                     throw (com.liferay.portal.SystemException)e;
206                 }
207 
208                 throw new com.liferay.portal.SystemException(e);
209             }
210         }
211         catch (com.liferay.portal.SystemException se) {
212             _log.error(se, se);
213 
214             throw se;
215         }
216     }
217 
218     public static com.liferay.portlet.shopping.model.ShoppingCoupon getCoupon(
219         HttpPrincipal httpPrincipal, long plid, long couponId)
220         throws com.liferay.portal.PortalException,
221             com.liferay.portal.SystemException {
222         try {
223             Object paramObj0 = new LongWrapper(plid);
224 
225             Object paramObj1 = new LongWrapper(couponId);
226 
227             MethodWrapper methodWrapper = new MethodWrapper(ShoppingCouponServiceUtil.class.getName(),
228                     "getCoupon", new Object[] { paramObj0, paramObj1 });
229 
230             Object returnObj = null;
231 
232             try {
233                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
234             }
235             catch (Exception e) {
236                 if (e instanceof com.liferay.portal.PortalException) {
237                     throw (com.liferay.portal.PortalException)e;
238                 }
239 
240                 if (e instanceof com.liferay.portal.SystemException) {
241                     throw (com.liferay.portal.SystemException)e;
242                 }
243 
244                 throw new com.liferay.portal.SystemException(e);
245             }
246 
247             return (com.liferay.portlet.shopping.model.ShoppingCoupon)returnObj;
248         }
249         catch (com.liferay.portal.SystemException se) {
250             _log.error(se, se);
251 
252             throw se;
253         }
254     }
255 
256     public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCoupon> search(
257         HttpPrincipal httpPrincipal, long plid, long companyId,
258         java.lang.String code, boolean active, java.lang.String discountType,
259         boolean andOperator, int start, int end)
260         throws com.liferay.portal.PortalException,
261             com.liferay.portal.SystemException {
262         try {
263             Object paramObj0 = new LongWrapper(plid);
264 
265             Object paramObj1 = new LongWrapper(companyId);
266 
267             Object paramObj2 = code;
268 
269             if (code == null) {
270                 paramObj2 = new NullWrapper("java.lang.String");
271             }
272 
273             Object paramObj3 = new BooleanWrapper(active);
274 
275             Object paramObj4 = discountType;
276 
277             if (discountType == null) {
278                 paramObj4 = new NullWrapper("java.lang.String");
279             }
280 
281             Object paramObj5 = new BooleanWrapper(andOperator);
282 
283             Object paramObj6 = new IntegerWrapper(start);
284 
285             Object paramObj7 = new IntegerWrapper(end);
286 
287             MethodWrapper methodWrapper = new MethodWrapper(ShoppingCouponServiceUtil.class.getName(),
288                     "search",
289                     new Object[] {
290                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
291                         paramObj5, paramObj6, paramObj7
292                     });
293 
294             Object returnObj = null;
295 
296             try {
297                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
298             }
299             catch (Exception e) {
300                 if (e instanceof com.liferay.portal.PortalException) {
301                     throw (com.liferay.portal.PortalException)e;
302                 }
303 
304                 if (e instanceof com.liferay.portal.SystemException) {
305                     throw (com.liferay.portal.SystemException)e;
306                 }
307 
308                 throw new com.liferay.portal.SystemException(e);
309             }
310 
311             return (java.util.List<com.liferay.portlet.shopping.model.ShoppingCoupon>)returnObj;
312         }
313         catch (com.liferay.portal.SystemException se) {
314             _log.error(se, se);
315 
316             throw se;
317         }
318     }
319 
320     public static com.liferay.portlet.shopping.model.ShoppingCoupon updateCoupon(
321         HttpPrincipal httpPrincipal, long plid, long couponId,
322         java.lang.String name, java.lang.String description,
323         int startDateMonth, int startDateDay, int startDateYear,
324         int startDateHour, int startDateMinute, int endDateMonth,
325         int endDateDay, int endDateYear, int endDateHour, int endDateMinute,
326         boolean neverExpire, boolean active, java.lang.String limitCategories,
327         java.lang.String limitSkus, double minOrder, double discount,
328         java.lang.String discountType)
329         throws com.liferay.portal.PortalException,
330             com.liferay.portal.SystemException {
331         try {
332             Object paramObj0 = new LongWrapper(plid);
333 
334             Object paramObj1 = new LongWrapper(couponId);
335 
336             Object paramObj2 = name;
337 
338             if (name == null) {
339                 paramObj2 = new NullWrapper("java.lang.String");
340             }
341 
342             Object paramObj3 = description;
343 
344             if (description == null) {
345                 paramObj3 = new NullWrapper("java.lang.String");
346             }
347 
348             Object paramObj4 = new IntegerWrapper(startDateMonth);
349 
350             Object paramObj5 = new IntegerWrapper(startDateDay);
351 
352             Object paramObj6 = new IntegerWrapper(startDateYear);
353 
354             Object paramObj7 = new IntegerWrapper(startDateHour);
355 
356             Object paramObj8 = new IntegerWrapper(startDateMinute);
357 
358             Object paramObj9 = new IntegerWrapper(endDateMonth);
359 
360             Object paramObj10 = new IntegerWrapper(endDateDay);
361 
362             Object paramObj11 = new IntegerWrapper(endDateYear);
363 
364             Object paramObj12 = new IntegerWrapper(endDateHour);
365 
366             Object paramObj13 = new IntegerWrapper(endDateMinute);
367 
368             Object paramObj14 = new BooleanWrapper(neverExpire);
369 
370             Object paramObj15 = new BooleanWrapper(active);
371 
372             Object paramObj16 = limitCategories;
373 
374             if (limitCategories == null) {
375                 paramObj16 = new NullWrapper("java.lang.String");
376             }
377 
378             Object paramObj17 = limitSkus;
379 
380             if (limitSkus == null) {
381                 paramObj17 = new NullWrapper("java.lang.String");
382             }
383 
384             Object paramObj18 = new DoubleWrapper(minOrder);
385 
386             Object paramObj19 = new DoubleWrapper(discount);
387 
388             Object paramObj20 = discountType;
389 
390             if (discountType == null) {
391                 paramObj20 = new NullWrapper("java.lang.String");
392             }
393 
394             MethodWrapper methodWrapper = new MethodWrapper(ShoppingCouponServiceUtil.class.getName(),
395                     "updateCoupon",
396                     new Object[] {
397                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
398                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
399                         paramObj10, paramObj11, paramObj12, paramObj13,
400                         paramObj14, paramObj15, paramObj16, paramObj17,
401                         paramObj18, paramObj19, paramObj20
402                     });
403 
404             Object returnObj = null;
405 
406             try {
407                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
408             }
409             catch (Exception e) {
410                 if (e instanceof com.liferay.portal.PortalException) {
411                     throw (com.liferay.portal.PortalException)e;
412                 }
413 
414                 if (e instanceof com.liferay.portal.SystemException) {
415                     throw (com.liferay.portal.SystemException)e;
416                 }
417 
418                 throw new com.liferay.portal.SystemException(e);
419             }
420 
421             return (com.liferay.portlet.shopping.model.ShoppingCoupon)returnObj;
422         }
423         catch (com.liferay.portal.SystemException se) {
424             _log.error(se, se);
425 
426             throw se;
427         }
428     }
429 
430     private static Log _log = LogFactoryUtil.getLog(ShoppingCouponServiceHttp.class);
431 }