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.ShoppingCategoryServiceUtil;
027    
028    /**
029     * Provides the HTTP utility for the
030     * {@link com.liferay.portlet.shopping.service.ShoppingCategoryServiceUtil} 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 com.liferay.portal.security.auth.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 ShoppingCategoryServiceSoap
052     * @see com.liferay.portal.security.auth.HttpPrincipal
053     * @see com.liferay.portlet.shopping.service.ShoppingCategoryServiceUtil
054     * @generated
055     */
056    @ProviderType
057    public class ShoppingCategoryServiceHttp {
058            public static com.liferay.portlet.shopping.model.ShoppingCategory addCategory(
059                    HttpPrincipal httpPrincipal, long parentCategoryId,
060                    java.lang.String name, java.lang.String description,
061                    com.liferay.portal.service.ServiceContext serviceContext)
062                    throws com.liferay.portal.kernel.exception.PortalException {
063                    try {
064                            MethodKey methodKey = new MethodKey(ShoppingCategoryServiceUtil.class,
065                                            "addCategory", _addCategoryParameterTypes0);
066    
067                            MethodHandler methodHandler = new MethodHandler(methodKey,
068                                            parentCategoryId, name, description, serviceContext);
069    
070                            Object returnObj = null;
071    
072                            try {
073                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
074                            }
075                            catch (Exception e) {
076                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
077                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
078                                    }
079    
080                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
081                            }
082    
083                            return (com.liferay.portlet.shopping.model.ShoppingCategory)returnObj;
084                    }
085                    catch (com.liferay.portal.kernel.exception.SystemException se) {
086                            _log.error(se, se);
087    
088                            throw se;
089                    }
090            }
091    
092            public static void deleteCategory(HttpPrincipal httpPrincipal,
093                    long categoryId)
094                    throws com.liferay.portal.kernel.exception.PortalException {
095                    try {
096                            MethodKey methodKey = new MethodKey(ShoppingCategoryServiceUtil.class,
097                                            "deleteCategory", _deleteCategoryParameterTypes1);
098    
099                            MethodHandler methodHandler = new MethodHandler(methodKey,
100                                            categoryId);
101    
102                            try {
103                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
104                            }
105                            catch (Exception e) {
106                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
107                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
108                                    }
109    
110                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
111                            }
112                    }
113                    catch (com.liferay.portal.kernel.exception.SystemException se) {
114                            _log.error(se, se);
115    
116                            throw se;
117                    }
118            }
119    
120            public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCategory> getCategories(
121                    HttpPrincipal httpPrincipal, long groupId) {
122                    try {
123                            MethodKey methodKey = new MethodKey(ShoppingCategoryServiceUtil.class,
124                                            "getCategories", _getCategoriesParameterTypes2);
125    
126                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId);
127    
128                            Object returnObj = null;
129    
130                            try {
131                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
132                            }
133                            catch (Exception e) {
134                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
135                            }
136    
137                            return (java.util.List<com.liferay.portlet.shopping.model.ShoppingCategory>)returnObj;
138                    }
139                    catch (com.liferay.portal.kernel.exception.SystemException se) {
140                            _log.error(se, se);
141    
142                            throw se;
143                    }
144            }
145    
146            public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCategory> getCategories(
147                    HttpPrincipal httpPrincipal, long groupId, long parentCategoryId,
148                    int start, int end) {
149                    try {
150                            MethodKey methodKey = new MethodKey(ShoppingCategoryServiceUtil.class,
151                                            "getCategories", _getCategoriesParameterTypes3);
152    
153                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
154                                            parentCategoryId, start, end);
155    
156                            Object returnObj = null;
157    
158                            try {
159                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
160                            }
161                            catch (Exception e) {
162                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
163                            }
164    
165                            return (java.util.List<com.liferay.portlet.shopping.model.ShoppingCategory>)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 int getCategoriesCount(HttpPrincipal httpPrincipal,
175                    long groupId, long parentCategoryId) {
176                    try {
177                            MethodKey methodKey = new MethodKey(ShoppingCategoryServiceUtil.class,
178                                            "getCategoriesCount", _getCategoriesCountParameterTypes4);
179    
180                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
181                                            parentCategoryId);
182    
183                            Object returnObj = null;
184    
185                            try {
186                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
187                            }
188                            catch (Exception e) {
189                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
190                            }
191    
192                            return ((Integer)returnObj).intValue();
193                    }
194                    catch (com.liferay.portal.kernel.exception.SystemException se) {
195                            _log.error(se, se);
196    
197                            throw se;
198                    }
199            }
200    
201            public static com.liferay.portlet.shopping.model.ShoppingCategory getCategory(
202                    HttpPrincipal httpPrincipal, long categoryId)
203                    throws com.liferay.portal.kernel.exception.PortalException {
204                    try {
205                            MethodKey methodKey = new MethodKey(ShoppingCategoryServiceUtil.class,
206                                            "getCategory", _getCategoryParameterTypes5);
207    
208                            MethodHandler methodHandler = new MethodHandler(methodKey,
209                                            categoryId);
210    
211                            Object returnObj = null;
212    
213                            try {
214                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
215                            }
216                            catch (Exception e) {
217                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
218                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
219                                    }
220    
221                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
222                            }
223    
224                            return (com.liferay.portlet.shopping.model.ShoppingCategory)returnObj;
225                    }
226                    catch (com.liferay.portal.kernel.exception.SystemException se) {
227                            _log.error(se, se);
228    
229                            throw se;
230                    }
231            }
232    
233            public static void getSubcategoryIds(HttpPrincipal httpPrincipal,
234                    java.util.List<java.lang.Long> categoryIds, long groupId,
235                    long categoryId) {
236                    try {
237                            MethodKey methodKey = new MethodKey(ShoppingCategoryServiceUtil.class,
238                                            "getSubcategoryIds", _getSubcategoryIdsParameterTypes6);
239    
240                            MethodHandler methodHandler = new MethodHandler(methodKey,
241                                            categoryIds, groupId, categoryId);
242    
243                            try {
244                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
245                            }
246                            catch (Exception e) {
247                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
248                            }
249                    }
250                    catch (com.liferay.portal.kernel.exception.SystemException se) {
251                            _log.error(se, se);
252    
253                            throw se;
254                    }
255            }
256    
257            public static com.liferay.portlet.shopping.model.ShoppingCategory updateCategory(
258                    HttpPrincipal httpPrincipal, long categoryId, long parentCategoryId,
259                    java.lang.String name, java.lang.String description,
260                    boolean mergeWithParentCategory,
261                    com.liferay.portal.service.ServiceContext serviceContext)
262                    throws com.liferay.portal.kernel.exception.PortalException {
263                    try {
264                            MethodKey methodKey = new MethodKey(ShoppingCategoryServiceUtil.class,
265                                            "updateCategory", _updateCategoryParameterTypes7);
266    
267                            MethodHandler methodHandler = new MethodHandler(methodKey,
268                                            categoryId, parentCategoryId, name, description,
269                                            mergeWithParentCategory, serviceContext);
270    
271                            Object returnObj = null;
272    
273                            try {
274                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
275                            }
276                            catch (Exception e) {
277                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
278                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
279                                    }
280    
281                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
282                            }
283    
284                            return (com.liferay.portlet.shopping.model.ShoppingCategory)returnObj;
285                    }
286                    catch (com.liferay.portal.kernel.exception.SystemException se) {
287                            _log.error(se, se);
288    
289                            throw se;
290                    }
291            }
292    
293            private static Log _log = LogFactoryUtil.getLog(ShoppingCategoryServiceHttp.class);
294            private static final Class<?>[] _addCategoryParameterTypes0 = new Class[] {
295                            long.class, java.lang.String.class, java.lang.String.class,
296                            com.liferay.portal.service.ServiceContext.class
297                    };
298            private static final Class<?>[] _deleteCategoryParameterTypes1 = new Class[] {
299                            long.class
300                    };
301            private static final Class<?>[] _getCategoriesParameterTypes2 = new Class[] {
302                            long.class
303                    };
304            private static final Class<?>[] _getCategoriesParameterTypes3 = new Class[] {
305                            long.class, long.class, int.class, int.class
306                    };
307            private static final Class<?>[] _getCategoriesCountParameterTypes4 = new Class[] {
308                            long.class, long.class
309                    };
310            private static final Class<?>[] _getCategoryParameterTypes5 = new Class[] {
311                            long.class
312                    };
313            private static final Class<?>[] _getSubcategoryIdsParameterTypes6 = new Class[] {
314                            java.util.List.class, long.class, long.class
315                    };
316            private static final Class<?>[] _updateCategoryParameterTypes7 = new Class[] {
317                            long.class, long.class, java.lang.String.class,
318                            java.lang.String.class, boolean.class,
319                            com.liferay.portal.service.ServiceContext.class
320                    };
321    }