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