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.MethodHandler;
20  import com.liferay.portal.kernel.util.MethodKey;
21  import com.liferay.portal.security.auth.HttpPrincipal;
22  import com.liferay.portal.service.http.TunnelUtil;
23  
24  import com.liferay.portlet.shopping.service.ShoppingCouponServiceUtil;
25  
26  /**
27   * <a href="ShoppingCouponServiceHttp.java.html"><b><i>View Source</i></b></a>
28   *
29   * <p>
30   * ServiceBuilder generated this class. Modifications in this class will be
31   * overwritten the next time is generated.
32   * </p>
33   *
34   * <p>
35   * This class provides a HTTP utility for the
36   * {@link com.liferay.portlet.shopping.service.ShoppingCouponServiceUtil} service utility. The
37   * static methods of this class calls the same methods of the service utility.
38   * However, the signatures are different because it requires an additional
39   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
40   * </p>
41   *
42   * <p>
43   * The benefits of using the HTTP utility is that it is fast and allows for
44   * tunneling without the cost of serializing to text. The drawback is that it
45   * only works with Java.
46   * </p>
47   *
48   * <p>
49   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
50   * configure security.
51   * </p>
52   *
53   * <p>
54   * The HTTP utility is only generated for remote services.
55   * </p>
56   *
57   * @author    Brian Wing Shun Chan
58   * @see       ShoppingCouponServiceSoap
59   * @see       com.liferay.portal.security.auth.HttpPrincipal
60   * @see       com.liferay.portlet.shopping.service.ShoppingCouponServiceUtil
61   * @generated
62   */
63  public class ShoppingCouponServiceHttp {
64      public static com.liferay.portlet.shopping.model.ShoppingCoupon addCoupon(
65          HttpPrincipal httpPrincipal, java.lang.String code, boolean autoCode,
66          java.lang.String name, java.lang.String description,
67          int startDateMonth, int startDateDay, int startDateYear,
68          int startDateHour, int startDateMinute, int endDateMonth,
69          int endDateDay, int endDateYear, int endDateHour, int endDateMinute,
70          boolean neverExpire, boolean active, java.lang.String limitCategories,
71          java.lang.String limitSkus, double minOrder, double discount,
72          java.lang.String discountType,
73          com.liferay.portal.service.ServiceContext serviceContext)
74          throws com.liferay.portal.PortalException,
75              com.liferay.portal.SystemException {
76          try {
77              MethodKey methodKey = new MethodKey(ShoppingCouponServiceUtil.class.getName(),
78                      "addCoupon", _addCouponParameterTypes0);
79  
80              MethodHandler methodHandler = new MethodHandler(methodKey, code,
81                      autoCode, name, description, startDateMonth, startDateDay,
82                      startDateYear, startDateHour, startDateMinute,
83                      endDateMonth, endDateDay, endDateYear, endDateHour,
84                      endDateMinute, neverExpire, active, limitCategories,
85                      limitSkus, minOrder, discount, discountType, serviceContext);
86  
87              Object returnObj = null;
88  
89              try {
90                  returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
91              }
92              catch (Exception e) {
93                  if (e instanceof com.liferay.portal.PortalException) {
94                      throw (com.liferay.portal.PortalException)e;
95                  }
96  
97                  if (e instanceof com.liferay.portal.SystemException) {
98                      throw (com.liferay.portal.SystemException)e;
99                  }
100 
101                 throw new com.liferay.portal.SystemException(e);
102             }
103 
104             return (com.liferay.portlet.shopping.model.ShoppingCoupon)returnObj;
105         }
106         catch (com.liferay.portal.SystemException se) {
107             _log.error(se, se);
108 
109             throw se;
110         }
111     }
112 
113     public static void deleteCoupon(HttpPrincipal httpPrincipal, long groupId,
114         long couponId)
115         throws com.liferay.portal.PortalException,
116             com.liferay.portal.SystemException {
117         try {
118             MethodKey methodKey = new MethodKey(ShoppingCouponServiceUtil.class.getName(),
119                     "deleteCoupon", _deleteCouponParameterTypes1);
120 
121             MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
122                     couponId);
123 
124             try {
125                 TunnelUtil.invoke(httpPrincipal, methodHandler);
126             }
127             catch (Exception e) {
128                 if (e instanceof com.liferay.portal.PortalException) {
129                     throw (com.liferay.portal.PortalException)e;
130                 }
131 
132                 if (e instanceof com.liferay.portal.SystemException) {
133                     throw (com.liferay.portal.SystemException)e;
134                 }
135 
136                 throw new com.liferay.portal.SystemException(e);
137             }
138         }
139         catch (com.liferay.portal.SystemException se) {
140             _log.error(se, se);
141 
142             throw se;
143         }
144     }
145 
146     public static com.liferay.portlet.shopping.model.ShoppingCoupon getCoupon(
147         HttpPrincipal httpPrincipal, long groupId, long couponId)
148         throws com.liferay.portal.PortalException,
149             com.liferay.portal.SystemException {
150         try {
151             MethodKey methodKey = new MethodKey(ShoppingCouponServiceUtil.class.getName(),
152                     "getCoupon", _getCouponParameterTypes2);
153 
154             MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
155                     couponId);
156 
157             Object returnObj = null;
158 
159             try {
160                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
161             }
162             catch (Exception e) {
163                 if (e instanceof com.liferay.portal.PortalException) {
164                     throw (com.liferay.portal.PortalException)e;
165                 }
166 
167                 if (e instanceof com.liferay.portal.SystemException) {
168                     throw (com.liferay.portal.SystemException)e;
169                 }
170 
171                 throw new com.liferay.portal.SystemException(e);
172             }
173 
174             return (com.liferay.portlet.shopping.model.ShoppingCoupon)returnObj;
175         }
176         catch (com.liferay.portal.SystemException se) {
177             _log.error(se, se);
178 
179             throw se;
180         }
181     }
182 
183     public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCoupon> search(
184         HttpPrincipal httpPrincipal, long groupId, long companyId,
185         java.lang.String code, boolean active, java.lang.String discountType,
186         boolean andOperator, int start, int end)
187         throws com.liferay.portal.PortalException,
188             com.liferay.portal.SystemException {
189         try {
190             MethodKey methodKey = new MethodKey(ShoppingCouponServiceUtil.class.getName(),
191                     "search", _searchParameterTypes3);
192 
193             MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
194                     companyId, code, active, discountType, andOperator, start,
195                     end);
196 
197             Object returnObj = null;
198 
199             try {
200                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
201             }
202             catch (Exception e) {
203                 if (e instanceof com.liferay.portal.PortalException) {
204                     throw (com.liferay.portal.PortalException)e;
205                 }
206 
207                 if (e instanceof com.liferay.portal.SystemException) {
208                     throw (com.liferay.portal.SystemException)e;
209                 }
210 
211                 throw new com.liferay.portal.SystemException(e);
212             }
213 
214             return (java.util.List<com.liferay.portlet.shopping.model.ShoppingCoupon>)returnObj;
215         }
216         catch (com.liferay.portal.SystemException se) {
217             _log.error(se, se);
218 
219             throw se;
220         }
221     }
222 
223     public static com.liferay.portlet.shopping.model.ShoppingCoupon updateCoupon(
224         HttpPrincipal httpPrincipal, long couponId, java.lang.String name,
225         java.lang.String description, int startDateMonth, int startDateDay,
226         int startDateYear, int startDateHour, int startDateMinute,
227         int endDateMonth, int endDateDay, int endDateYear, int endDateHour,
228         int endDateMinute, boolean neverExpire, boolean active,
229         java.lang.String limitCategories, java.lang.String limitSkus,
230         double minOrder, double discount, java.lang.String discountType,
231         com.liferay.portal.service.ServiceContext serviceContext)
232         throws com.liferay.portal.PortalException,
233             com.liferay.portal.SystemException {
234         try {
235             MethodKey methodKey = new MethodKey(ShoppingCouponServiceUtil.class.getName(),
236                     "updateCoupon", _updateCouponParameterTypes4);
237 
238             MethodHandler methodHandler = new MethodHandler(methodKey,
239                     couponId, name, description, startDateMonth, startDateDay,
240                     startDateYear, startDateHour, startDateMinute,
241                     endDateMonth, endDateDay, endDateYear, endDateHour,
242                     endDateMinute, neverExpire, active, limitCategories,
243                     limitSkus, minOrder, discount, discountType, serviceContext);
244 
245             Object returnObj = null;
246 
247             try {
248                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
249             }
250             catch (Exception e) {
251                 if (e instanceof com.liferay.portal.PortalException) {
252                     throw (com.liferay.portal.PortalException)e;
253                 }
254 
255                 if (e instanceof com.liferay.portal.SystemException) {
256                     throw (com.liferay.portal.SystemException)e;
257                 }
258 
259                 throw new com.liferay.portal.SystemException(e);
260             }
261 
262             return (com.liferay.portlet.shopping.model.ShoppingCoupon)returnObj;
263         }
264         catch (com.liferay.portal.SystemException se) {
265             _log.error(se, se);
266 
267             throw se;
268         }
269     }
270 
271     private static Log _log = LogFactoryUtil.getLog(ShoppingCouponServiceHttp.class);
272     private static final Class<?>[] _addCouponParameterTypes0 = new Class[] {
273             java.lang.String.class, boolean.class, java.lang.String.class,
274             java.lang.String.class, int.class, int.class, int.class, int.class,
275             int.class, int.class, int.class, int.class, int.class, int.class,
276             boolean.class, boolean.class, java.lang.String.class,
277             java.lang.String.class, double.class, double.class,
278             java.lang.String.class,
279             com.liferay.portal.service.ServiceContext.class
280         };
281     private static final Class<?>[] _deleteCouponParameterTypes1 = new Class[] {
282             long.class, long.class
283         };
284     private static final Class<?>[] _getCouponParameterTypes2 = new Class[] {
285             long.class, long.class
286         };
287     private static final Class<?>[] _searchParameterTypes3 = new Class[] {
288             long.class, long.class, java.lang.String.class, boolean.class,
289             java.lang.String.class, boolean.class, int.class, int.class
290         };
291     private static final Class<?>[] _updateCouponParameterTypes4 = new Class[] {
292             long.class, java.lang.String.class, java.lang.String.class,
293             int.class, int.class, int.class, int.class, int.class, int.class,
294             int.class, int.class, int.class, int.class, boolean.class,
295             boolean.class, java.lang.String.class, java.lang.String.class,
296             double.class, double.class, java.lang.String.class,
297             com.liferay.portal.service.ServiceContext.class
298         };
299 }