001    /**
002     * Copyright (c) 2000-present 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 aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.log.Log;
020    import com.liferay.portal.kernel.log.LogFactoryUtil;
021    import com.liferay.portal.kernel.util.MethodHandler;
022    import com.liferay.portal.kernel.util.MethodKey;
023    import com.liferay.portal.security.auth.HttpPrincipal;
024    import com.liferay.portal.service.http.TunnelUtil;
025    
026    import com.liferay.portlet.shopping.service.ShoppingCouponServiceUtil;
027    
028    /**
029     * Provides the HTTP utility for the
030     * {@link ShoppingCouponServiceUtil} service utility. The
031     * static methods of this class calls the same methods of the service utility.
032     * However, the signatures are different because it requires an additional
033     * {@link HttpPrincipal} parameter.
034     *
035     * <p>
036     * The benefits of using the HTTP utility is that it is fast and allows for
037     * tunneling without the cost of serializing to text. The drawback is that it
038     * only works with Java.
039     * </p>
040     *
041     * <p>
042     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
043     * configure security.
044     * </p>
045     *
046     * <p>
047     * The HTTP utility is only generated for remote services.
048     * </p>
049     *
050     * @author Brian Wing Shun Chan
051     * @see ShoppingCouponServiceSoap
052     * @see HttpPrincipal
053     * @see ShoppingCouponServiceUtil
054     * @generated
055     */
056    @ProviderType
057    public class ShoppingCouponServiceHttp {
058            public static com.liferay.portlet.shopping.model.ShoppingCoupon addCoupon(
059                    HttpPrincipal httpPrincipal, java.lang.String code, boolean autoCode,
060                    java.lang.String name, java.lang.String description,
061                    int startDateMonth, int startDateDay, int startDateYear,
062                    int startDateHour, int startDateMinute, int endDateMonth,
063                    int endDateDay, int endDateYear, int endDateHour, int endDateMinute,
064                    boolean neverExpire, boolean active, java.lang.String limitCategories,
065                    java.lang.String limitSkus, double minOrder, double discount,
066                    java.lang.String discountType,
067                    com.liferay.portal.service.ServiceContext serviceContext)
068                    throws com.liferay.portal.kernel.exception.PortalException {
069                    try {
070                            MethodKey methodKey = new MethodKey(ShoppingCouponServiceUtil.class,
071                                            "addCoupon", _addCouponParameterTypes0);
072    
073                            MethodHandler methodHandler = new MethodHandler(methodKey, code,
074                                            autoCode, name, description, startDateMonth, startDateDay,
075                                            startDateYear, startDateHour, startDateMinute,
076                                            endDateMonth, endDateDay, endDateYear, endDateHour,
077                                            endDateMinute, neverExpire, active, limitCategories,
078                                            limitSkus, minOrder, discount, discountType, serviceContext);
079    
080                            Object returnObj = null;
081    
082                            try {
083                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
084                            }
085                            catch (Exception e) {
086                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
087                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
088                                    }
089    
090                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
091                            }
092    
093                            return (com.liferay.portlet.shopping.model.ShoppingCoupon)returnObj;
094                    }
095                    catch (com.liferay.portal.kernel.exception.SystemException se) {
096                            _log.error(se, se);
097    
098                            throw se;
099                    }
100            }
101    
102            public static void deleteCoupon(HttpPrincipal httpPrincipal, long groupId,
103                    long couponId)
104                    throws com.liferay.portal.kernel.exception.PortalException {
105                    try {
106                            MethodKey methodKey = new MethodKey(ShoppingCouponServiceUtil.class,
107                                            "deleteCoupon", _deleteCouponParameterTypes1);
108    
109                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
110                                            couponId);
111    
112                            try {
113                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
114                            }
115                            catch (Exception e) {
116                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
117                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
118                                    }
119    
120                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
121                            }
122                    }
123                    catch (com.liferay.portal.kernel.exception.SystemException se) {
124                            _log.error(se, se);
125    
126                            throw se;
127                    }
128            }
129    
130            public static com.liferay.portlet.shopping.model.ShoppingCoupon getCoupon(
131                    HttpPrincipal httpPrincipal, long groupId, long couponId)
132                    throws com.liferay.portal.kernel.exception.PortalException {
133                    try {
134                            MethodKey methodKey = new MethodKey(ShoppingCouponServiceUtil.class,
135                                            "getCoupon", _getCouponParameterTypes2);
136    
137                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
138                                            couponId);
139    
140                            Object returnObj = null;
141    
142                            try {
143                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
144                            }
145                            catch (Exception e) {
146                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
147                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
148                                    }
149    
150                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
151                            }
152    
153                            return (com.liferay.portlet.shopping.model.ShoppingCoupon)returnObj;
154                    }
155                    catch (com.liferay.portal.kernel.exception.SystemException se) {
156                            _log.error(se, se);
157    
158                            throw se;
159                    }
160            }
161    
162            public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCoupon> search(
163                    HttpPrincipal httpPrincipal, long groupId, long companyId,
164                    java.lang.String code, boolean active, java.lang.String discountType,
165                    boolean andOperator, int start, int end)
166                    throws com.liferay.portal.kernel.exception.PortalException {
167                    try {
168                            MethodKey methodKey = new MethodKey(ShoppingCouponServiceUtil.class,
169                                            "search", _searchParameterTypes3);
170    
171                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
172                                            companyId, code, active, discountType, andOperator, start,
173                                            end);
174    
175                            Object returnObj = null;
176    
177                            try {
178                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
179                            }
180                            catch (Exception e) {
181                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
182                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
183                                    }
184    
185                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
186                            }
187    
188                            return (java.util.List<com.liferay.portlet.shopping.model.ShoppingCoupon>)returnObj;
189                    }
190                    catch (com.liferay.portal.kernel.exception.SystemException se) {
191                            _log.error(se, se);
192    
193                            throw se;
194                    }
195            }
196    
197            public static com.liferay.portlet.shopping.model.ShoppingCoupon updateCoupon(
198                    HttpPrincipal httpPrincipal, long couponId, java.lang.String name,
199                    java.lang.String description, int startDateMonth, int startDateDay,
200                    int startDateYear, int startDateHour, int startDateMinute,
201                    int endDateMonth, int endDateDay, int endDateYear, int endDateHour,
202                    int endDateMinute, boolean neverExpire, boolean active,
203                    java.lang.String limitCategories, java.lang.String limitSkus,
204                    double minOrder, double discount, java.lang.String discountType,
205                    com.liferay.portal.service.ServiceContext serviceContext)
206                    throws com.liferay.portal.kernel.exception.PortalException {
207                    try {
208                            MethodKey methodKey = new MethodKey(ShoppingCouponServiceUtil.class,
209                                            "updateCoupon", _updateCouponParameterTypes4);
210    
211                            MethodHandler methodHandler = new MethodHandler(methodKey,
212                                            couponId, name, description, startDateMonth, startDateDay,
213                                            startDateYear, startDateHour, startDateMinute,
214                                            endDateMonth, endDateDay, endDateYear, endDateHour,
215                                            endDateMinute, neverExpire, active, limitCategories,
216                                            limitSkus, minOrder, discount, discountType, serviceContext);
217    
218                            Object returnObj = null;
219    
220                            try {
221                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
222                            }
223                            catch (Exception e) {
224                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
225                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
226                                    }
227    
228                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
229                            }
230    
231                            return (com.liferay.portlet.shopping.model.ShoppingCoupon)returnObj;
232                    }
233                    catch (com.liferay.portal.kernel.exception.SystemException se) {
234                            _log.error(se, se);
235    
236                            throw se;
237                    }
238            }
239    
240            private static Log _log = LogFactoryUtil.getLog(ShoppingCouponServiceHttp.class);
241            private static final Class<?>[] _addCouponParameterTypes0 = new Class[] {
242                            java.lang.String.class, boolean.class, java.lang.String.class,
243                            java.lang.String.class, int.class, int.class, int.class, int.class,
244                            int.class, int.class, int.class, int.class, int.class, int.class,
245                            boolean.class, boolean.class, java.lang.String.class,
246                            java.lang.String.class, double.class, double.class,
247                            java.lang.String.class,
248                            com.liferay.portal.service.ServiceContext.class
249                    };
250            private static final Class<?>[] _deleteCouponParameterTypes1 = new Class[] {
251                            long.class, long.class
252                    };
253            private static final Class<?>[] _getCouponParameterTypes2 = new Class[] {
254                            long.class, long.class
255                    };
256            private static final Class<?>[] _searchParameterTypes3 = new Class[] {
257                            long.class, long.class, java.lang.String.class, boolean.class,
258                            java.lang.String.class, boolean.class, int.class, int.class
259                    };
260            private static final Class<?>[] _updateCouponParameterTypes4 = new Class[] {
261                            long.class, java.lang.String.class, java.lang.String.class,
262                            int.class, int.class, int.class, int.class, int.class, int.class,
263                            int.class, int.class, int.class, int.class, boolean.class,
264                            boolean.class, java.lang.String.class, java.lang.String.class,
265                            double.class, double.class, java.lang.String.class,
266                            com.liferay.portal.service.ServiceContext.class
267                    };
268    }