001    /**
002     * Copyright (c) 2000-2011 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.asset.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.asset.service.AssetCategoryServiceUtil;
025    
026    /**
027     * <p>
028     * This class provides a HTTP utility for the
029     * {@link com.liferay.portlet.asset.service.AssetCategoryServiceUtil} 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       AssetCategoryServiceSoap
052     * @see       com.liferay.portal.security.auth.HttpPrincipal
053     * @see       com.liferay.portlet.asset.service.AssetCategoryServiceUtil
054     * @generated
055     */
056    public class AssetCategoryServiceHttp {
057            public static com.liferay.portlet.asset.model.AssetCategory addCategory(
058                    HttpPrincipal httpPrincipal, long parentCategoryId,
059                    java.util.Map<java.util.Locale, java.lang.String> titleMap,
060                    long vocabularyId, java.lang.String[] categoryProperties,
061                    com.liferay.portal.service.ServiceContext serviceContext)
062                    throws com.liferay.portal.kernel.exception.PortalException,
063                            com.liferay.portal.kernel.exception.SystemException {
064                    try {
065                            MethodKey methodKey = new MethodKey(AssetCategoryServiceUtil.class.getName(),
066                                            "addCategory", long.class, java.util.Map.class, long.class,
067                                            java.lang.String[].class,
068                                            com.liferay.portal.service.ServiceContext.class);
069    
070                            MethodHandler methodHandler = new MethodHandler(methodKey,
071                                            parentCategoryId, titleMap, vocabularyId,
072                                            categoryProperties, serviceContext);
073    
074                            Object returnObj = null;
075    
076                            try {
077                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
078                            }
079                            catch (Exception e) {
080                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
081                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
082                                    }
083    
084                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
085                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
086                                    }
087    
088                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
089                            }
090    
091                            return (com.liferay.portlet.asset.model.AssetCategory)returnObj;
092                    }
093                    catch (com.liferay.portal.kernel.exception.SystemException se) {
094                            _log.error(se, se);
095    
096                            throw se;
097                    }
098            }
099    
100            public static void deleteCategory(HttpPrincipal httpPrincipal,
101                    long categoryId)
102                    throws com.liferay.portal.kernel.exception.PortalException,
103                            com.liferay.portal.kernel.exception.SystemException {
104                    try {
105                            MethodKey methodKey = new MethodKey(AssetCategoryServiceUtil.class.getName(),
106                                            "deleteCategory", long.class);
107    
108                            MethodHandler methodHandler = new MethodHandler(methodKey,
109                                            categoryId);
110    
111                            try {
112                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
113                            }
114                            catch (Exception e) {
115                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
116                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
117                                    }
118    
119                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
120                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
121                                    }
122    
123                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
124                            }
125                    }
126                    catch (com.liferay.portal.kernel.exception.SystemException se) {
127                            _log.error(se, se);
128    
129                            throw se;
130                    }
131            }
132    
133            public static java.util.List<com.liferay.portlet.asset.model.AssetCategory> getCategories(
134                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK)
135                    throws com.liferay.portal.kernel.exception.PortalException,
136                            com.liferay.portal.kernel.exception.SystemException {
137                    try {
138                            MethodKey methodKey = new MethodKey(AssetCategoryServiceUtil.class.getName(),
139                                            "getCategories", java.lang.String.class, long.class);
140    
141                            MethodHandler methodHandler = new MethodHandler(methodKey,
142                                            className, classPK);
143    
144                            Object returnObj = null;
145    
146                            try {
147                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
148                            }
149                            catch (Exception e) {
150                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
151                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
152                                    }
153    
154                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
155                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
156                                    }
157    
158                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
159                            }
160    
161                            return (java.util.List<com.liferay.portlet.asset.model.AssetCategory>)returnObj;
162                    }
163                    catch (com.liferay.portal.kernel.exception.SystemException se) {
164                            _log.error(se, se);
165    
166                            throw se;
167                    }
168            }
169    
170            public static com.liferay.portlet.asset.model.AssetCategory getCategory(
171                    HttpPrincipal httpPrincipal, long categoryId)
172                    throws com.liferay.portal.kernel.exception.PortalException,
173                            com.liferay.portal.kernel.exception.SystemException {
174                    try {
175                            MethodKey methodKey = new MethodKey(AssetCategoryServiceUtil.class.getName(),
176                                            "getCategory", long.class);
177    
178                            MethodHandler methodHandler = new MethodHandler(methodKey,
179                                            categoryId);
180    
181                            Object returnObj = null;
182    
183                            try {
184                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
185                            }
186                            catch (Exception e) {
187                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
188                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
189                                    }
190    
191                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
192                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
193                                    }
194    
195                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
196                            }
197    
198                            return (com.liferay.portlet.asset.model.AssetCategory)returnObj;
199                    }
200                    catch (com.liferay.portal.kernel.exception.SystemException se) {
201                            _log.error(se, se);
202    
203                            throw se;
204                    }
205            }
206    
207            public static java.util.List<com.liferay.portlet.asset.model.AssetCategory> getChildCategories(
208                    HttpPrincipal httpPrincipal, long parentCategoryId, int start, int end,
209                    com.liferay.portal.kernel.util.OrderByComparator obc)
210                    throws com.liferay.portal.kernel.exception.PortalException,
211                            com.liferay.portal.kernel.exception.SystemException {
212                    try {
213                            MethodKey methodKey = new MethodKey(AssetCategoryServiceUtil.class.getName(),
214                                            "getChildCategories", long.class, int.class, int.class,
215                                            com.liferay.portal.kernel.util.OrderByComparator.class);
216    
217                            MethodHandler methodHandler = new MethodHandler(methodKey,
218                                            parentCategoryId, start, end, obc);
219    
220                            Object returnObj = null;
221    
222                            try {
223                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
224                            }
225                            catch (Exception e) {
226                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
227                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
228                                    }
229    
230                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
231                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
232                                    }
233    
234                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
235                            }
236    
237                            return (java.util.List<com.liferay.portlet.asset.model.AssetCategory>)returnObj;
238                    }
239                    catch (com.liferay.portal.kernel.exception.SystemException se) {
240                            _log.error(se, se);
241    
242                            throw se;
243                    }
244            }
245    
246            public static java.util.List<com.liferay.portlet.asset.model.AssetCategory> getVocabularyCategories(
247                    HttpPrincipal httpPrincipal, long vocabularyId, int start, int end,
248                    com.liferay.portal.kernel.util.OrderByComparator obc)
249                    throws com.liferay.portal.kernel.exception.PortalException,
250                            com.liferay.portal.kernel.exception.SystemException {
251                    try {
252                            MethodKey methodKey = new MethodKey(AssetCategoryServiceUtil.class.getName(),
253                                            "getVocabularyCategories", long.class, int.class,
254                                            int.class,
255                                            com.liferay.portal.kernel.util.OrderByComparator.class);
256    
257                            MethodHandler methodHandler = new MethodHandler(methodKey,
258                                            vocabularyId, start, end, obc);
259    
260                            Object returnObj = null;
261    
262                            try {
263                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
264                            }
265                            catch (Exception e) {
266                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
267                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
268                                    }
269    
270                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
271                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
272                                    }
273    
274                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
275                            }
276    
277                            return (java.util.List<com.liferay.portlet.asset.model.AssetCategory>)returnObj;
278                    }
279                    catch (com.liferay.portal.kernel.exception.SystemException se) {
280                            _log.error(se, se);
281    
282                            throw se;
283                    }
284            }
285    
286            public static java.util.List<com.liferay.portlet.asset.model.AssetCategory> getVocabularyRootCategories(
287                    HttpPrincipal httpPrincipal, long vocabularyId, int start, int end,
288                    com.liferay.portal.kernel.util.OrderByComparator obc)
289                    throws com.liferay.portal.kernel.exception.PortalException,
290                            com.liferay.portal.kernel.exception.SystemException {
291                    try {
292                            MethodKey methodKey = new MethodKey(AssetCategoryServiceUtil.class.getName(),
293                                            "getVocabularyRootCategories", long.class, int.class,
294                                            int.class,
295                                            com.liferay.portal.kernel.util.OrderByComparator.class);
296    
297                            MethodHandler methodHandler = new MethodHandler(methodKey,
298                                            vocabularyId, start, end, obc);
299    
300                            Object returnObj = null;
301    
302                            try {
303                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
304                            }
305                            catch (Exception e) {
306                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
307                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
308                                    }
309    
310                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
311                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
312                                    }
313    
314                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
315                            }
316    
317                            return (java.util.List<com.liferay.portlet.asset.model.AssetCategory>)returnObj;
318                    }
319                    catch (com.liferay.portal.kernel.exception.SystemException se) {
320                            _log.error(se, se);
321    
322                            throw se;
323                    }
324            }
325    
326            public static com.liferay.portal.kernel.json.JSONArray search(
327                    HttpPrincipal httpPrincipal, long groupId, java.lang.String name,
328                    java.lang.String[] categoryProperties, int start, int end)
329                    throws com.liferay.portal.kernel.exception.SystemException {
330                    try {
331                            MethodKey methodKey = new MethodKey(AssetCategoryServiceUtil.class.getName(),
332                                            "search", long.class, java.lang.String.class,
333                                            java.lang.String[].class, int.class, int.class);
334    
335                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
336                                            name, categoryProperties, start, end);
337    
338                            Object returnObj = null;
339    
340                            try {
341                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
342                            }
343                            catch (Exception e) {
344                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
345                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
346                                    }
347    
348                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
349                            }
350    
351                            return (com.liferay.portal.kernel.json.JSONArray)returnObj;
352                    }
353                    catch (com.liferay.portal.kernel.exception.SystemException se) {
354                            _log.error(se, se);
355    
356                            throw se;
357                    }
358            }
359    
360            public static com.liferay.portlet.asset.model.AssetCategory updateCategory(
361                    HttpPrincipal httpPrincipal, long categoryId, long parentCategoryId,
362                    java.util.Map<java.util.Locale, java.lang.String> titleMap,
363                    long vocabularyId, java.lang.String[] categoryProperties,
364                    com.liferay.portal.service.ServiceContext serviceContext)
365                    throws com.liferay.portal.kernel.exception.PortalException,
366                            com.liferay.portal.kernel.exception.SystemException {
367                    try {
368                            MethodKey methodKey = new MethodKey(AssetCategoryServiceUtil.class.getName(),
369                                            "updateCategory", long.class, long.class,
370                                            java.util.Map.class, long.class, java.lang.String[].class,
371                                            com.liferay.portal.service.ServiceContext.class);
372    
373                            MethodHandler methodHandler = new MethodHandler(methodKey,
374                                            categoryId, parentCategoryId, titleMap, vocabularyId,
375                                            categoryProperties, serviceContext);
376    
377                            Object returnObj = null;
378    
379                            try {
380                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
381                            }
382                            catch (Exception e) {
383                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
384                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
385                                    }
386    
387                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
388                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
389                                    }
390    
391                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
392                            }
393    
394                            return (com.liferay.portlet.asset.model.AssetCategory)returnObj;
395                    }
396                    catch (com.liferay.portal.kernel.exception.SystemException se) {
397                            _log.error(se, se);
398    
399                            throw se;
400                    }
401            }
402    
403            private static Log _log = LogFactoryUtil.getLog(AssetCategoryServiceHttp.class);
404    }