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     * <p>
028     * This class provides a HTTP utility for the
029     * {@link com.liferay.portlet.shopping.service.ShoppingCouponServiceUtil} service utility. The
030     * static methods of this class calls the same methods of the service utility.
031     * However, the signatures are different because it requires an additional
032     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
033     * </p>
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       com.liferay.portal.security.auth.HttpPrincipal
053     * @see       com.liferay.portlet.shopping.service.ShoppingCouponServiceUtil
054     * @generated
055     */
056    public class ShoppingCouponServiceHttp {
057            public static com.liferay.portlet.shopping.model.ShoppingCoupon addCoupon(
058                    HttpPrincipal httpPrincipal, java.lang.String code, boolean autoCode,
059                    java.lang.String name, java.lang.String description,
060                    int startDateMonth, int startDateDay, int startDateYear,
061                    int startDateHour, int startDateMinute, int endDateMonth,
062                    int endDateDay, int endDateYear, int endDateHour, int endDateMinute,
063                    boolean neverExpire, boolean active, java.lang.String limitCategories,
064                    java.lang.String limitSkus, double minOrder, double discount,
065                    java.lang.String discountType,
066                    com.liferay.portal.service.ServiceContext serviceContext)
067                    throws com.liferay.portal.kernel.exception.PortalException,
068                            com.liferay.portal.kernel.exception.SystemException {
069                    try {
070                            MethodKey methodKey = new MethodKey(ShoppingCouponServiceUtil.class.getName(),
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                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
091                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
092                                    }
093    
094                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
095                            }
096    
097                            return (com.liferay.portlet.shopping.model.ShoppingCoupon)returnObj;
098                    }
099                    catch (com.liferay.portal.kernel.exception.SystemException se) {
100                            _log.error(se, se);
101    
102                            throw se;
103                    }
104            }
105    
106            public static void deleteCoupon(HttpPrincipal httpPrincipal, long groupId,
107                    long couponId)
108                    throws com.liferay.portal.kernel.exception.PortalException,
109                            com.liferay.portal.kernel.exception.SystemException {
110                    try {
111                            MethodKey methodKey = new MethodKey(ShoppingCouponServiceUtil.class.getName(),
112                                            "deleteCoupon", _deleteCouponParameterTypes1);
113    
114                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
115                                            couponId);
116    
117                            try {
118                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
119                            }
120                            catch (Exception e) {
121                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
122                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
123                                    }
124    
125                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
126                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
127                                    }
128    
129                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
130                            }
131                    }
132                    catch (com.liferay.portal.kernel.exception.SystemException se) {
133                            _log.error(se, se);
134    
135                            throw se;
136                    }
137            }
138    
139            public static com.liferay.portlet.shopping.model.ShoppingCoupon getCoupon(
140                    HttpPrincipal httpPrincipal, long groupId, long couponId)
141                    throws com.liferay.portal.kernel.exception.PortalException,
142                            com.liferay.portal.kernel.exception.SystemException {
143                    try {
144                            MethodKey methodKey = new MethodKey(ShoppingCouponServiceUtil.class.getName(),
145                                            "getCoupon", _getCouponParameterTypes2);
146    
147                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
148                                            couponId);
149    
150                            Object returnObj = null;
151    
152                            try {
153                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
154                            }
155                            catch (Exception e) {
156                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
157                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
158                                    }
159    
160                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
161                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
162                                    }
163    
164                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
165                            }
166    
167                            return (com.liferay.portlet.shopping.model.ShoppingCoupon)returnObj;
168                    }
169                    catch (com.liferay.portal.kernel.exception.SystemException se) {
170                            _log.error(se, se);
171    
172                            throw se;
173                    }
174            }
175    
176            public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCoupon> search(
177                    HttpPrincipal httpPrincipal, long groupId, long companyId,
178                    java.lang.String code, boolean active, java.lang.String discountType,
179                    boolean andOperator, int start, int end)
180                    throws com.liferay.portal.kernel.exception.PortalException,
181                            com.liferay.portal.kernel.exception.SystemException {
182                    try {
183                            MethodKey methodKey = new MethodKey(ShoppingCouponServiceUtil.class.getName(),
184                                            "search", _searchParameterTypes3);
185    
186                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
187                                            companyId, code, active, discountType, andOperator, start,
188                                            end);
189    
190                            Object returnObj = null;
191    
192                            try {
193                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
194                            }
195                            catch (Exception e) {
196                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
197                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
198                                    }
199    
200                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
201                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
202                                    }
203    
204                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
205                            }
206    
207                            return (java.util.List<com.liferay.portlet.shopping.model.ShoppingCoupon>)returnObj;
208                    }
209                    catch (com.liferay.portal.kernel.exception.SystemException se) {
210                            _log.error(se, se);
211    
212                            throw se;
213                    }
214            }
215    
216            public static com.liferay.portlet.shopping.model.ShoppingCoupon updateCoupon(
217                    HttpPrincipal httpPrincipal, long couponId, java.lang.String name,
218                    java.lang.String description, int startDateMonth, int startDateDay,
219                    int startDateYear, int startDateHour, int startDateMinute,
220                    int endDateMonth, int endDateDay, int endDateYear, int endDateHour,
221                    int endDateMinute, boolean neverExpire, boolean active,
222                    java.lang.String limitCategories, java.lang.String limitSkus,
223                    double minOrder, double discount, java.lang.String discountType,
224                    com.liferay.portal.service.ServiceContext serviceContext)
225                    throws com.liferay.portal.kernel.exception.PortalException,
226                            com.liferay.portal.kernel.exception.SystemException {
227                    try {
228                            MethodKey methodKey = new MethodKey(ShoppingCouponServiceUtil.class.getName(),
229                                            "updateCoupon", _updateCouponParameterTypes4);
230    
231                            MethodHandler methodHandler = new MethodHandler(methodKey,
232                                            couponId, name, description, startDateMonth, startDateDay,
233                                            startDateYear, startDateHour, startDateMinute,
234                                            endDateMonth, endDateDay, endDateYear, endDateHour,
235                                            endDateMinute, neverExpire, active, limitCategories,
236                                            limitSkus, minOrder, discount, discountType, serviceContext);
237    
238                            Object returnObj = null;
239    
240                            try {
241                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
242                            }
243                            catch (Exception e) {
244                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
245                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
246                                    }
247    
248                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
249                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
250                                    }
251    
252                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
253                            }
254    
255                            return (com.liferay.portlet.shopping.model.ShoppingCoupon)returnObj;
256                    }
257                    catch (com.liferay.portal.kernel.exception.SystemException se) {
258                            _log.error(se, se);
259    
260                            throw se;
261                    }
262            }
263    
264            private static Log _log = LogFactoryUtil.getLog(ShoppingCouponServiceHttp.class);
265            private static final Class<?>[] _addCouponParameterTypes0 = new Class[] {
266                            java.lang.String.class, boolean.class, java.lang.String.class,
267                            java.lang.String.class, int.class, int.class, int.class, int.class,
268                            int.class, int.class, int.class, int.class, int.class, int.class,
269                            boolean.class, boolean.class, java.lang.String.class,
270                            java.lang.String.class, double.class, double.class,
271                            java.lang.String.class,
272                            com.liferay.portal.service.ServiceContext.class
273                    };
274            private static final Class<?>[] _deleteCouponParameterTypes1 = new Class[] {
275                            long.class, long.class
276                    };
277            private static final Class<?>[] _getCouponParameterTypes2 = new Class[] {
278                            long.class, long.class
279                    };
280            private static final Class<?>[] _searchParameterTypes3 = new Class[] {
281                            long.class, long.class, java.lang.String.class, boolean.class,
282                            java.lang.String.class, boolean.class, int.class, int.class
283                    };
284            private static final Class<?>[] _updateCouponParameterTypes4 = new Class[] {
285                            long.class, java.lang.String.class, java.lang.String.class,
286                            int.class, int.class, int.class, int.class, int.class, int.class,
287                            int.class, int.class, int.class, int.class, boolean.class,
288                            boolean.class, java.lang.String.class, java.lang.String.class,
289                            double.class, double.class, java.lang.String.class,
290                            com.liferay.portal.service.ServiceContext.class
291                    };
292    }