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