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.ShoppingCategoryServiceUtil;
025    
026    /**
027     * <p>
028     * This class provides a HTTP utility for the
029     * {@link com.liferay.portlet.shopping.service.ShoppingCategoryServiceUtil} 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       ShoppingCategoryServiceSoap
052     * @see       com.liferay.portal.security.auth.HttpPrincipal
053     * @see       com.liferay.portlet.shopping.service.ShoppingCategoryServiceUtil
054     * @generated
055     */
056    public class ShoppingCategoryServiceHttp {
057            public static com.liferay.portlet.shopping.model.ShoppingCategory addCategory(
058                    HttpPrincipal httpPrincipal, long parentCategoryId,
059                    java.lang.String name, java.lang.String description,
060                    com.liferay.portal.service.ServiceContext serviceContext)
061                    throws com.liferay.portal.kernel.exception.PortalException,
062                            com.liferay.portal.kernel.exception.SystemException {
063                    try {
064                            MethodKey methodKey = new MethodKey(ShoppingCategoryServiceUtil.class.getName(),
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                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
081                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
082                                    }
083    
084                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
085                            }
086    
087                            return (com.liferay.portlet.shopping.model.ShoppingCategory)returnObj;
088                    }
089                    catch (com.liferay.portal.kernel.exception.SystemException se) {
090                            _log.error(se, se);
091    
092                            throw se;
093                    }
094            }
095    
096            public static void deleteCategory(HttpPrincipal httpPrincipal,
097                    long categoryId)
098                    throws com.liferay.portal.kernel.exception.PortalException,
099                            com.liferay.portal.kernel.exception.SystemException {
100                    try {
101                            MethodKey methodKey = new MethodKey(ShoppingCategoryServiceUtil.class.getName(),
102                                            "deleteCategory", _deleteCategoryParameterTypes1);
103    
104                            MethodHandler methodHandler = new MethodHandler(methodKey,
105                                            categoryId);
106    
107                            try {
108                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
109                            }
110                            catch (Exception e) {
111                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
112                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
113                                    }
114    
115                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
116                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
117                                    }
118    
119                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
120                            }
121                    }
122                    catch (com.liferay.portal.kernel.exception.SystemException se) {
123                            _log.error(se, se);
124    
125                            throw se;
126                    }
127            }
128    
129            public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCategory> getCategories(
130                    HttpPrincipal httpPrincipal, long groupId)
131                    throws com.liferay.portal.kernel.exception.SystemException {
132                    try {
133                            MethodKey methodKey = new MethodKey(ShoppingCategoryServiceUtil.class.getName(),
134                                            "getCategories", _getCategoriesParameterTypes2);
135    
136                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId);
137    
138                            Object returnObj = null;
139    
140                            try {
141                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
142                            }
143                            catch (Exception e) {
144                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
145                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
146                                    }
147    
148                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
149                            }
150    
151                            return (java.util.List<com.liferay.portlet.shopping.model.ShoppingCategory>)returnObj;
152                    }
153                    catch (com.liferay.portal.kernel.exception.SystemException se) {
154                            _log.error(se, se);
155    
156                            throw se;
157                    }
158            }
159    
160            public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCategory> getCategories(
161                    HttpPrincipal httpPrincipal, long groupId, long parentCategoryId,
162                    int start, int end)
163                    throws com.liferay.portal.kernel.exception.SystemException {
164                    try {
165                            MethodKey methodKey = new MethodKey(ShoppingCategoryServiceUtil.class.getName(),
166                                            "getCategories", _getCategoriesParameterTypes3);
167    
168                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
169                                            parentCategoryId, start, end);
170    
171                            Object returnObj = null;
172    
173                            try {
174                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
175                            }
176                            catch (Exception e) {
177                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
178                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
179                                    }
180    
181                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
182                            }
183    
184                            return (java.util.List<com.liferay.portlet.shopping.model.ShoppingCategory>)returnObj;
185                    }
186                    catch (com.liferay.portal.kernel.exception.SystemException se) {
187                            _log.error(se, se);
188    
189                            throw se;
190                    }
191            }
192    
193            public static int getCategoriesCount(HttpPrincipal httpPrincipal,
194                    long groupId, long parentCategoryId)
195                    throws com.liferay.portal.kernel.exception.SystemException {
196                    try {
197                            MethodKey methodKey = new MethodKey(ShoppingCategoryServiceUtil.class.getName(),
198                                            "getCategoriesCount", _getCategoriesCountParameterTypes4);
199    
200                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
201                                            parentCategoryId);
202    
203                            Object returnObj = null;
204    
205                            try {
206                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
207                            }
208                            catch (Exception e) {
209                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
210                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
211                                    }
212    
213                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
214                            }
215    
216                            return ((Integer)returnObj).intValue();
217                    }
218                    catch (com.liferay.portal.kernel.exception.SystemException se) {
219                            _log.error(se, se);
220    
221                            throw se;
222                    }
223            }
224    
225            public static com.liferay.portlet.shopping.model.ShoppingCategory getCategory(
226                    HttpPrincipal httpPrincipal, long categoryId)
227                    throws com.liferay.portal.kernel.exception.PortalException,
228                            com.liferay.portal.kernel.exception.SystemException {
229                    try {
230                            MethodKey methodKey = new MethodKey(ShoppingCategoryServiceUtil.class.getName(),
231                                            "getCategory", _getCategoryParameterTypes5);
232    
233                            MethodHandler methodHandler = new MethodHandler(methodKey,
234                                            categoryId);
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.ShoppingCategory)returnObj;
254                    }
255                    catch (com.liferay.portal.kernel.exception.SystemException se) {
256                            _log.error(se, se);
257    
258                            throw se;
259                    }
260            }
261    
262            public static void getSubcategoryIds(HttpPrincipal httpPrincipal,
263                    java.util.List<java.lang.Long> categoryIds, long groupId,
264                    long categoryId)
265                    throws com.liferay.portal.kernel.exception.SystemException {
266                    try {
267                            MethodKey methodKey = new MethodKey(ShoppingCategoryServiceUtil.class.getName(),
268                                            "getSubcategoryIds", _getSubcategoryIdsParameterTypes6);
269    
270                            MethodHandler methodHandler = new MethodHandler(methodKey,
271                                            categoryIds, groupId, categoryId);
272    
273                            try {
274                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
275                            }
276                            catch (Exception e) {
277                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
278                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
279                                    }
280    
281                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
282                            }
283                    }
284                    catch (com.liferay.portal.kernel.exception.SystemException se) {
285                            _log.error(se, se);
286    
287                            throw se;
288                    }
289            }
290    
291            public static com.liferay.portlet.shopping.model.ShoppingCategory updateCategory(
292                    HttpPrincipal httpPrincipal, long categoryId, long parentCategoryId,
293                    java.lang.String name, java.lang.String description,
294                    boolean mergeWithParentCategory,
295                    com.liferay.portal.service.ServiceContext serviceContext)
296                    throws com.liferay.portal.kernel.exception.PortalException,
297                            com.liferay.portal.kernel.exception.SystemException {
298                    try {
299                            MethodKey methodKey = new MethodKey(ShoppingCategoryServiceUtil.class.getName(),
300                                            "updateCategory", _updateCategoryParameterTypes7);
301    
302                            MethodHandler methodHandler = new MethodHandler(methodKey,
303                                            categoryId, parentCategoryId, name, description,
304                                            mergeWithParentCategory, serviceContext);
305    
306                            Object returnObj = null;
307    
308                            try {
309                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
310                            }
311                            catch (Exception e) {
312                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
313                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
314                                    }
315    
316                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
317                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
318                                    }
319    
320                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
321                            }
322    
323                            return (com.liferay.portlet.shopping.model.ShoppingCategory)returnObj;
324                    }
325                    catch (com.liferay.portal.kernel.exception.SystemException se) {
326                            _log.error(se, se);
327    
328                            throw se;
329                    }
330            }
331    
332            private static Log _log = LogFactoryUtil.getLog(ShoppingCategoryServiceHttp.class);
333            private static final Class<?>[] _addCategoryParameterTypes0 = new Class[] {
334                            long.class, java.lang.String.class, java.lang.String.class,
335                            com.liferay.portal.service.ServiceContext.class
336                    };
337            private static final Class<?>[] _deleteCategoryParameterTypes1 = new Class[] {
338                            long.class
339                    };
340            private static final Class<?>[] _getCategoriesParameterTypes2 = new Class[] {
341                            long.class
342                    };
343            private static final Class<?>[] _getCategoriesParameterTypes3 = new Class[] {
344                            long.class, long.class, int.class, int.class
345                    };
346            private static final Class<?>[] _getCategoriesCountParameterTypes4 = new Class[] {
347                            long.class, long.class
348                    };
349            private static final Class<?>[] _getCategoryParameterTypes5 = new Class[] {
350                            long.class
351                    };
352            private static final Class<?>[] _getSubcategoryIdsParameterTypes6 = new Class[] {
353                            java.util.List.class, long.class, long.class
354                    };
355            private static final Class<?>[] _updateCategoryParameterTypes7 = new Class[] {
356                            long.class, long.class, java.lang.String.class,
357                            java.lang.String.class, boolean.class,
358                            com.liferay.portal.service.ServiceContext.class
359                    };
360    }