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