001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.shopping.service.http;
016    
017    import com.liferay.portal.kernel.log.Log;
018    import com.liferay.portal.kernel.log.LogFactoryUtil;
019    import com.liferay.portal.kernel.util.BooleanWrapper;
020    import com.liferay.portal.kernel.util.DoubleWrapper;
021    import com.liferay.portal.kernel.util.IntegerWrapper;
022    import com.liferay.portal.kernel.util.LongWrapper;
023    import com.liferay.portal.kernel.util.MethodWrapper;
024    import com.liferay.portal.kernel.util.NullWrapper;
025    import com.liferay.portal.security.auth.HttpPrincipal;
026    import com.liferay.portal.service.http.TunnelUtil;
027    
028    import com.liferay.portlet.shopping.service.ShoppingCouponServiceUtil;
029    
030    /**
031     * <p>
032     * This class provides a HTTP utility for the
033     * {@link com.liferay.portlet.shopping.service.ShoppingCouponServiceUtil} service utility. The
034     * static methods of this class calls the same methods of the service utility.
035     * However, the signatures are different because it requires an additional
036     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
037     * </p>
038     *
039     * <p>
040     * The benefits of using the HTTP utility is that it is fast and allows for
041     * tunneling without the cost of serializing to text. The drawback is that it
042     * only works with Java.
043     * </p>
044     *
045     * <p>
046     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
047     * configure security.
048     * </p>
049     *
050     * <p>
051     * The HTTP utility is only generated for remote services.
052     * </p>
053     *
054     * @author    Brian Wing Shun Chan
055     * @see       ShoppingCouponServiceSoap
056     * @see       com.liferay.portal.security.auth.HttpPrincipal
057     * @see       com.liferay.portlet.shopping.service.ShoppingCouponServiceUtil
058     * @generated
059     */
060    public class ShoppingCouponServiceHttp {
061            public static com.liferay.portlet.shopping.model.ShoppingCoupon addCoupon(
062                    HttpPrincipal httpPrincipal, java.lang.String code, boolean autoCode,
063                    java.lang.String name, java.lang.String description,
064                    int startDateMonth, int startDateDay, int startDateYear,
065                    int startDateHour, int startDateMinute, int endDateMonth,
066                    int endDateDay, int endDateYear, int endDateHour, int endDateMinute,
067                    boolean neverExpire, boolean active, java.lang.String limitCategories,
068                    java.lang.String limitSkus, double minOrder, double discount,
069                    java.lang.String discountType,
070                    com.liferay.portal.service.ServiceContext serviceContext)
071                    throws com.liferay.portal.kernel.exception.PortalException,
072                            com.liferay.portal.kernel.exception.SystemException {
073                    try {
074                            Object paramObj0 = code;
075    
076                            if (code == null) {
077                                    paramObj0 = new NullWrapper("java.lang.String");
078                            }
079    
080                            Object paramObj1 = new BooleanWrapper(autoCode);
081    
082                            Object paramObj2 = name;
083    
084                            if (name == null) {
085                                    paramObj2 = new NullWrapper("java.lang.String");
086                            }
087    
088                            Object paramObj3 = description;
089    
090                            if (description == null) {
091                                    paramObj3 = new NullWrapper("java.lang.String");
092                            }
093    
094                            Object paramObj4 = new IntegerWrapper(startDateMonth);
095    
096                            Object paramObj5 = new IntegerWrapper(startDateDay);
097    
098                            Object paramObj6 = new IntegerWrapper(startDateYear);
099    
100                            Object paramObj7 = new IntegerWrapper(startDateHour);
101    
102                            Object paramObj8 = new IntegerWrapper(startDateMinute);
103    
104                            Object paramObj9 = new IntegerWrapper(endDateMonth);
105    
106                            Object paramObj10 = new IntegerWrapper(endDateDay);
107    
108                            Object paramObj11 = new IntegerWrapper(endDateYear);
109    
110                            Object paramObj12 = new IntegerWrapper(endDateHour);
111    
112                            Object paramObj13 = new IntegerWrapper(endDateMinute);
113    
114                            Object paramObj14 = new BooleanWrapper(neverExpire);
115    
116                            Object paramObj15 = new BooleanWrapper(active);
117    
118                            Object paramObj16 = limitCategories;
119    
120                            if (limitCategories == null) {
121                                    paramObj16 = new NullWrapper("java.lang.String");
122                            }
123    
124                            Object paramObj17 = limitSkus;
125    
126                            if (limitSkus == null) {
127                                    paramObj17 = new NullWrapper("java.lang.String");
128                            }
129    
130                            Object paramObj18 = new DoubleWrapper(minOrder);
131    
132                            Object paramObj19 = new DoubleWrapper(discount);
133    
134                            Object paramObj20 = discountType;
135    
136                            if (discountType == null) {
137                                    paramObj20 = new NullWrapper("java.lang.String");
138                            }
139    
140                            Object paramObj21 = serviceContext;
141    
142                            if (serviceContext == null) {
143                                    paramObj21 = new NullWrapper(
144                                                    "com.liferay.portal.service.ServiceContext");
145                            }
146    
147                            MethodWrapper methodWrapper = new MethodWrapper(ShoppingCouponServiceUtil.class.getName(),
148                                            "addCoupon",
149                                            new Object[] {
150                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
151                                                    paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
152                                                    paramObj10, paramObj11, paramObj12, paramObj13,
153                                                    paramObj14, paramObj15, paramObj16, paramObj17,
154                                                    paramObj18, paramObj19, paramObj20, paramObj21
155                                            });
156    
157                            Object returnObj = null;
158    
159                            try {
160                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
161                            }
162                            catch (Exception e) {
163                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
164                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
165                                    }
166    
167                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
168                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
169                                    }
170    
171                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
172                            }
173    
174                            return (com.liferay.portlet.shopping.model.ShoppingCoupon)returnObj;
175                    }
176                    catch (com.liferay.portal.kernel.exception.SystemException se) {
177                            _log.error(se, se);
178    
179                            throw se;
180                    }
181            }
182    
183            public static void deleteCoupon(HttpPrincipal httpPrincipal, long groupId,
184                    long couponId)
185                    throws com.liferay.portal.kernel.exception.PortalException,
186                            com.liferay.portal.kernel.exception.SystemException {
187                    try {
188                            Object paramObj0 = new LongWrapper(groupId);
189    
190                            Object paramObj1 = new LongWrapper(couponId);
191    
192                            MethodWrapper methodWrapper = new MethodWrapper(ShoppingCouponServiceUtil.class.getName(),
193                                            "deleteCoupon", new Object[] { paramObj0, paramObj1 });
194    
195                            try {
196                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
197                            }
198                            catch (Exception e) {
199                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
200                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
201                                    }
202    
203                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
204                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
205                                    }
206    
207                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
208                            }
209                    }
210                    catch (com.liferay.portal.kernel.exception.SystemException se) {
211                            _log.error(se, se);
212    
213                            throw se;
214                    }
215            }
216    
217            public static com.liferay.portlet.shopping.model.ShoppingCoupon getCoupon(
218                    HttpPrincipal httpPrincipal, long groupId, long couponId)
219                    throws com.liferay.portal.kernel.exception.PortalException,
220                            com.liferay.portal.kernel.exception.SystemException {
221                    try {
222                            Object paramObj0 = new LongWrapper(groupId);
223    
224                            Object paramObj1 = new LongWrapper(couponId);
225    
226                            MethodWrapper methodWrapper = new MethodWrapper(ShoppingCouponServiceUtil.class.getName(),
227                                            "getCoupon", new Object[] { paramObj0, paramObj1 });
228    
229                            Object returnObj = null;
230    
231                            try {
232                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
233                            }
234                            catch (Exception e) {
235                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
236                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
237                                    }
238    
239                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
240                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
241                                    }
242    
243                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
244                            }
245    
246                            return (com.liferay.portlet.shopping.model.ShoppingCoupon)returnObj;
247                    }
248                    catch (com.liferay.portal.kernel.exception.SystemException se) {
249                            _log.error(se, se);
250    
251                            throw se;
252                    }
253            }
254    
255            public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCoupon> search(
256                    HttpPrincipal httpPrincipal, long groupId, long companyId,
257                    java.lang.String code, boolean active, java.lang.String discountType,
258                    boolean andOperator, int start, int end)
259                    throws com.liferay.portal.kernel.exception.PortalException,
260                            com.liferay.portal.kernel.exception.SystemException {
261                    try {
262                            Object paramObj0 = new LongWrapper(groupId);
263    
264                            Object paramObj1 = new LongWrapper(companyId);
265    
266                            Object paramObj2 = code;
267    
268                            if (code == null) {
269                                    paramObj2 = new NullWrapper("java.lang.String");
270                            }
271    
272                            Object paramObj3 = new BooleanWrapper(active);
273    
274                            Object paramObj4 = discountType;
275    
276                            if (discountType == null) {
277                                    paramObj4 = new NullWrapper("java.lang.String");
278                            }
279    
280                            Object paramObj5 = new BooleanWrapper(andOperator);
281    
282                            Object paramObj6 = new IntegerWrapper(start);
283    
284                            Object paramObj7 = new IntegerWrapper(end);
285    
286                            MethodWrapper methodWrapper = new MethodWrapper(ShoppingCouponServiceUtil.class.getName(),
287                                            "search",
288                                            new Object[] {
289                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
290                                                    paramObj5, paramObj6, paramObj7
291                                            });
292    
293                            Object returnObj = null;
294    
295                            try {
296                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
297                            }
298                            catch (Exception e) {
299                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
300                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
301                                    }
302    
303                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
304                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
305                                    }
306    
307                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
308                            }
309    
310                            return (java.util.List<com.liferay.portlet.shopping.model.ShoppingCoupon>)returnObj;
311                    }
312                    catch (com.liferay.portal.kernel.exception.SystemException se) {
313                            _log.error(se, se);
314    
315                            throw se;
316                    }
317            }
318    
319            public static com.liferay.portlet.shopping.model.ShoppingCoupon updateCoupon(
320                    HttpPrincipal httpPrincipal, long couponId, java.lang.String name,
321                    java.lang.String description, int startDateMonth, int startDateDay,
322                    int startDateYear, int startDateHour, int startDateMinute,
323                    int endDateMonth, int endDateDay, int endDateYear, int endDateHour,
324                    int endDateMinute, boolean neverExpire, boolean active,
325                    java.lang.String limitCategories, java.lang.String limitSkus,
326                    double minOrder, double discount, java.lang.String discountType,
327                    com.liferay.portal.service.ServiceContext serviceContext)
328                    throws com.liferay.portal.kernel.exception.PortalException,
329                            com.liferay.portal.kernel.exception.SystemException {
330                    try {
331                            Object paramObj0 = new LongWrapper(couponId);
332    
333                            Object paramObj1 = name;
334    
335                            if (name == null) {
336                                    paramObj1 = new NullWrapper("java.lang.String");
337                            }
338    
339                            Object paramObj2 = description;
340    
341                            if (description == null) {
342                                    paramObj2 = new NullWrapper("java.lang.String");
343                            }
344    
345                            Object paramObj3 = new IntegerWrapper(startDateMonth);
346    
347                            Object paramObj4 = new IntegerWrapper(startDateDay);
348    
349                            Object paramObj5 = new IntegerWrapper(startDateYear);
350    
351                            Object paramObj6 = new IntegerWrapper(startDateHour);
352    
353                            Object paramObj7 = new IntegerWrapper(startDateMinute);
354    
355                            Object paramObj8 = new IntegerWrapper(endDateMonth);
356    
357                            Object paramObj9 = new IntegerWrapper(endDateDay);
358    
359                            Object paramObj10 = new IntegerWrapper(endDateYear);
360    
361                            Object paramObj11 = new IntegerWrapper(endDateHour);
362    
363                            Object paramObj12 = new IntegerWrapper(endDateMinute);
364    
365                            Object paramObj13 = new BooleanWrapper(neverExpire);
366    
367                            Object paramObj14 = new BooleanWrapper(active);
368    
369                            Object paramObj15 = limitCategories;
370    
371                            if (limitCategories == null) {
372                                    paramObj15 = new NullWrapper("java.lang.String");
373                            }
374    
375                            Object paramObj16 = limitSkus;
376    
377                            if (limitSkus == null) {
378                                    paramObj16 = new NullWrapper("java.lang.String");
379                            }
380    
381                            Object paramObj17 = new DoubleWrapper(minOrder);
382    
383                            Object paramObj18 = new DoubleWrapper(discount);
384    
385                            Object paramObj19 = discountType;
386    
387                            if (discountType == null) {
388                                    paramObj19 = new NullWrapper("java.lang.String");
389                            }
390    
391                            Object paramObj20 = serviceContext;
392    
393                            if (serviceContext == null) {
394                                    paramObj20 = new NullWrapper(
395                                                    "com.liferay.portal.service.ServiceContext");
396                            }
397    
398                            MethodWrapper methodWrapper = new MethodWrapper(ShoppingCouponServiceUtil.class.getName(),
399                                            "updateCoupon",
400                                            new Object[] {
401                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
402                                                    paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
403                                                    paramObj10, paramObj11, paramObj12, paramObj13,
404                                                    paramObj14, paramObj15, paramObj16, paramObj17,
405                                                    paramObj18, paramObj19, paramObj20
406                                            });
407    
408                            Object returnObj = null;
409    
410                            try {
411                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
412                            }
413                            catch (Exception e) {
414                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
415                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
416                                    }
417    
418                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
419                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
420                                    }
421    
422                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
423                            }
424    
425                            return (com.liferay.portlet.shopping.model.ShoppingCoupon)returnObj;
426                    }
427                    catch (com.liferay.portal.kernel.exception.SystemException se) {
428                            _log.error(se, se);
429    
430                            throw se;
431                    }
432            }
433    
434            private static Log _log = LogFactoryUtil.getLog(ShoppingCouponServiceHttp.class);
435    }