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