001    /**
002     * Copyright (c) 2000-2010 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.IntegerWrapper;
020    import com.liferay.portal.kernel.util.LongWrapper;
021    import com.liferay.portal.kernel.util.MethodWrapper;
022    import com.liferay.portal.kernel.util.NullWrapper;
023    import com.liferay.portal.security.auth.HttpPrincipal;
024    import com.liferay.portal.service.http.TunnelUtil;
025    
026    import com.liferay.portlet.asset.service.AssetCategoryServiceUtil;
027    
028    /**
029     * <p>
030     * This class provides a HTTP utility for the
031     * {@link com.liferay.portlet.asset.service.AssetCategoryServiceUtil} service utility. The
032     * static methods of this class calls the same methods of the service utility.
033     * However, the signatures are different because it requires an additional
034     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
035     * </p>
036     *
037     * <p>
038     * The benefits of using the HTTP utility is that it is fast and allows for
039     * tunneling without the cost of serializing to text. The drawback is that it
040     * only works with Java.
041     * </p>
042     *
043     * <p>
044     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
045     * configure security.
046     * </p>
047     *
048     * <p>
049     * The HTTP utility is only generated for remote services.
050     * </p>
051     *
052     * @author    Brian Wing Shun Chan
053     * @see       AssetCategoryServiceSoap
054     * @see       com.liferay.portal.security.auth.HttpPrincipal
055     * @see       com.liferay.portlet.asset.service.AssetCategoryServiceUtil
056     * @generated
057     */
058    public class AssetCategoryServiceHttp {
059            public static com.liferay.portlet.asset.model.AssetCategory addCategory(
060                    HttpPrincipal httpPrincipal, long parentCategoryId,
061                    java.util.Map<java.util.Locale, java.lang.String> titleMap,
062                    long vocabularyId, java.lang.String[] categoryProperties,
063                    com.liferay.portal.service.ServiceContext serviceContext)
064                    throws com.liferay.portal.kernel.exception.PortalException,
065                            com.liferay.portal.kernel.exception.SystemException {
066                    try {
067                            Object paramObj0 = new LongWrapper(parentCategoryId);
068    
069                            Object paramObj1 = titleMap;
070    
071                            if (titleMap == null) {
072                                    paramObj1 = new NullWrapper("java.util.Map");
073                            }
074    
075                            Object paramObj2 = new LongWrapper(vocabularyId);
076    
077                            Object paramObj3 = categoryProperties;
078    
079                            if (categoryProperties == null) {
080                                    paramObj3 = new NullWrapper("[Ljava.lang.String;");
081                            }
082    
083                            Object paramObj4 = serviceContext;
084    
085                            if (serviceContext == null) {
086                                    paramObj4 = new NullWrapper(
087                                                    "com.liferay.portal.service.ServiceContext");
088                            }
089    
090                            MethodWrapper methodWrapper = new MethodWrapper(AssetCategoryServiceUtil.class.getName(),
091                                            "addCategory",
092                                            new Object[] {
093                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
094                                            });
095    
096                            Object returnObj = null;
097    
098                            try {
099                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
100                            }
101                            catch (Exception e) {
102                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
103                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
104                                    }
105    
106                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
107                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
108                                    }
109    
110                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
111                            }
112    
113                            return (com.liferay.portlet.asset.model.AssetCategory)returnObj;
114                    }
115                    catch (com.liferay.portal.kernel.exception.SystemException se) {
116                            _log.error(se, se);
117    
118                            throw se;
119                    }
120            }
121    
122            public static void deleteCategory(HttpPrincipal httpPrincipal,
123                    long categoryId)
124                    throws com.liferay.portal.kernel.exception.PortalException,
125                            com.liferay.portal.kernel.exception.SystemException {
126                    try {
127                            Object paramObj0 = new LongWrapper(categoryId);
128    
129                            MethodWrapper methodWrapper = new MethodWrapper(AssetCategoryServiceUtil.class.getName(),
130                                            "deleteCategory", new Object[] { paramObj0 });
131    
132                            try {
133                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
134                            }
135                            catch (Exception e) {
136                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
137                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
138                                    }
139    
140                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
141                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
142                                    }
143    
144                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
145                            }
146                    }
147                    catch (com.liferay.portal.kernel.exception.SystemException se) {
148                            _log.error(se, se);
149    
150                            throw se;
151                    }
152            }
153    
154            public static java.util.List<com.liferay.portlet.asset.model.AssetCategory> getCategories(
155                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK)
156                    throws com.liferay.portal.kernel.exception.PortalException,
157                            com.liferay.portal.kernel.exception.SystemException {
158                    try {
159                            Object paramObj0 = className;
160    
161                            if (className == null) {
162                                    paramObj0 = new NullWrapper("java.lang.String");
163                            }
164    
165                            Object paramObj1 = new LongWrapper(classPK);
166    
167                            MethodWrapper methodWrapper = new MethodWrapper(AssetCategoryServiceUtil.class.getName(),
168                                            "getCategories", new Object[] { paramObj0, paramObj1 });
169    
170                            Object returnObj = null;
171    
172                            try {
173                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
174                            }
175                            catch (Exception e) {
176                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
177                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
178                                    }
179    
180                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
181                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
182                                    }
183    
184                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
185                            }
186    
187                            return (java.util.List<com.liferay.portlet.asset.model.AssetCategory>)returnObj;
188                    }
189                    catch (com.liferay.portal.kernel.exception.SystemException se) {
190                            _log.error(se, se);
191    
192                            throw se;
193                    }
194            }
195    
196            public static com.liferay.portlet.asset.model.AssetCategory getCategory(
197                    HttpPrincipal httpPrincipal, long categoryId)
198                    throws com.liferay.portal.kernel.exception.PortalException,
199                            com.liferay.portal.kernel.exception.SystemException {
200                    try {
201                            Object paramObj0 = new LongWrapper(categoryId);
202    
203                            MethodWrapper methodWrapper = new MethodWrapper(AssetCategoryServiceUtil.class.getName(),
204                                            "getCategory", new Object[] { paramObj0 });
205    
206                            Object returnObj = null;
207    
208                            try {
209                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
210                            }
211                            catch (Exception e) {
212                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
213                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
214                                    }
215    
216                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
217                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
218                                    }
219    
220                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
221                            }
222    
223                            return (com.liferay.portlet.asset.model.AssetCategory)returnObj;
224                    }
225                    catch (com.liferay.portal.kernel.exception.SystemException se) {
226                            _log.error(se, se);
227    
228                            throw se;
229                    }
230            }
231    
232            public static java.util.List<com.liferay.portlet.asset.model.AssetCategory> getChildCategories(
233                    HttpPrincipal httpPrincipal, long parentCategoryId, int start, int end,
234                    com.liferay.portal.kernel.util.OrderByComparator obc)
235                    throws com.liferay.portal.kernel.exception.PortalException,
236                            com.liferay.portal.kernel.exception.SystemException {
237                    try {
238                            Object paramObj0 = new LongWrapper(parentCategoryId);
239    
240                            Object paramObj1 = new IntegerWrapper(start);
241    
242                            Object paramObj2 = new IntegerWrapper(end);
243    
244                            Object paramObj3 = obc;
245    
246                            if (obc == null) {
247                                    paramObj3 = new NullWrapper(
248                                                    "com.liferay.portal.kernel.util.OrderByComparator");
249                            }
250    
251                            MethodWrapper methodWrapper = new MethodWrapper(AssetCategoryServiceUtil.class.getName(),
252                                            "getChildCategories",
253                                            new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
254    
255                            Object returnObj = null;
256    
257                            try {
258                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
259                            }
260                            catch (Exception e) {
261                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
262                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
263                                    }
264    
265                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
266                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
267                                    }
268    
269                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
270                            }
271    
272                            return (java.util.List<com.liferay.portlet.asset.model.AssetCategory>)returnObj;
273                    }
274                    catch (com.liferay.portal.kernel.exception.SystemException se) {
275                            _log.error(se, se);
276    
277                            throw se;
278                    }
279            }
280    
281            public static java.util.List<com.liferay.portlet.asset.model.AssetCategory> getVocabularyCategories(
282                    HttpPrincipal httpPrincipal, long vocabularyId, int start, int end,
283                    com.liferay.portal.kernel.util.OrderByComparator obc)
284                    throws com.liferay.portal.kernel.exception.PortalException,
285                            com.liferay.portal.kernel.exception.SystemException {
286                    try {
287                            Object paramObj0 = new LongWrapper(vocabularyId);
288    
289                            Object paramObj1 = new IntegerWrapper(start);
290    
291                            Object paramObj2 = new IntegerWrapper(end);
292    
293                            Object paramObj3 = obc;
294    
295                            if (obc == null) {
296                                    paramObj3 = new NullWrapper(
297                                                    "com.liferay.portal.kernel.util.OrderByComparator");
298                            }
299    
300                            MethodWrapper methodWrapper = new MethodWrapper(AssetCategoryServiceUtil.class.getName(),
301                                            "getVocabularyCategories",
302                                            new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
303    
304                            Object returnObj = null;
305    
306                            try {
307                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
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 (java.util.List<com.liferay.portlet.asset.model.AssetCategory>)returnObj;
322                    }
323                    catch (com.liferay.portal.kernel.exception.SystemException se) {
324                            _log.error(se, se);
325    
326                            throw se;
327                    }
328            }
329    
330            public static java.util.List<com.liferay.portlet.asset.model.AssetCategory> getVocabularyRootCategories(
331                    HttpPrincipal httpPrincipal, long vocabularyId, int start, int end,
332                    com.liferay.portal.kernel.util.OrderByComparator obc)
333                    throws com.liferay.portal.kernel.exception.PortalException,
334                            com.liferay.portal.kernel.exception.SystemException {
335                    try {
336                            Object paramObj0 = new LongWrapper(vocabularyId);
337    
338                            Object paramObj1 = new IntegerWrapper(start);
339    
340                            Object paramObj2 = new IntegerWrapper(end);
341    
342                            Object paramObj3 = obc;
343    
344                            if (obc == null) {
345                                    paramObj3 = new NullWrapper(
346                                                    "com.liferay.portal.kernel.util.OrderByComparator");
347                            }
348    
349                            MethodWrapper methodWrapper = new MethodWrapper(AssetCategoryServiceUtil.class.getName(),
350                                            "getVocabularyRootCategories",
351                                            new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
352    
353                            Object returnObj = null;
354    
355                            try {
356                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
357                            }
358                            catch (Exception e) {
359                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
360                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
361                                    }
362    
363                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
364                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
365                                    }
366    
367                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
368                            }
369    
370                            return (java.util.List<com.liferay.portlet.asset.model.AssetCategory>)returnObj;
371                    }
372                    catch (com.liferay.portal.kernel.exception.SystemException se) {
373                            _log.error(se, se);
374    
375                            throw se;
376                    }
377            }
378    
379            public static com.liferay.portal.kernel.json.JSONArray search(
380                    HttpPrincipal httpPrincipal, long groupId, java.lang.String name,
381                    java.lang.String[] categoryProperties, int start, int end)
382                    throws com.liferay.portal.kernel.exception.SystemException {
383                    try {
384                            Object paramObj0 = new LongWrapper(groupId);
385    
386                            Object paramObj1 = name;
387    
388                            if (name == null) {
389                                    paramObj1 = new NullWrapper("java.lang.String");
390                            }
391    
392                            Object paramObj2 = categoryProperties;
393    
394                            if (categoryProperties == null) {
395                                    paramObj2 = new NullWrapper("[Ljava.lang.String;");
396                            }
397    
398                            Object paramObj3 = new IntegerWrapper(start);
399    
400                            Object paramObj4 = new IntegerWrapper(end);
401    
402                            MethodWrapper methodWrapper = new MethodWrapper(AssetCategoryServiceUtil.class.getName(),
403                                            "search",
404                                            new Object[] {
405                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
406                                            });
407    
408                            Object returnObj = null;
409    
410                            try {
411                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
412                            }
413                            catch (Exception e) {
414                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
415                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
416                                    }
417    
418                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
419                            }
420    
421                            return (com.liferay.portal.kernel.json.JSONArray)returnObj;
422                    }
423                    catch (com.liferay.portal.kernel.exception.SystemException se) {
424                            _log.error(se, se);
425    
426                            throw se;
427                    }
428            }
429    
430            public static com.liferay.portlet.asset.model.AssetCategory updateCategory(
431                    HttpPrincipal httpPrincipal, long categoryId, long parentCategoryId,
432                    java.util.Map<java.util.Locale, java.lang.String> titleMap,
433                    long vocabularyId, java.lang.String[] categoryProperties,
434                    com.liferay.portal.service.ServiceContext serviceContext)
435                    throws com.liferay.portal.kernel.exception.PortalException,
436                            com.liferay.portal.kernel.exception.SystemException {
437                    try {
438                            Object paramObj0 = new LongWrapper(categoryId);
439    
440                            Object paramObj1 = new LongWrapper(parentCategoryId);
441    
442                            Object paramObj2 = titleMap;
443    
444                            if (titleMap == null) {
445                                    paramObj2 = new NullWrapper("java.util.Map");
446                            }
447    
448                            Object paramObj3 = new LongWrapper(vocabularyId);
449    
450                            Object paramObj4 = categoryProperties;
451    
452                            if (categoryProperties == null) {
453                                    paramObj4 = new NullWrapper("[Ljava.lang.String;");
454                            }
455    
456                            Object paramObj5 = serviceContext;
457    
458                            if (serviceContext == null) {
459                                    paramObj5 = new NullWrapper(
460                                                    "com.liferay.portal.service.ServiceContext");
461                            }
462    
463                            MethodWrapper methodWrapper = new MethodWrapper(AssetCategoryServiceUtil.class.getName(),
464                                            "updateCategory",
465                                            new Object[] {
466                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
467                                                    paramObj5
468                                            });
469    
470                            Object returnObj = null;
471    
472                            try {
473                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
474                            }
475                            catch (Exception e) {
476                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
477                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
478                                    }
479    
480                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
481                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
482                                    }
483    
484                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
485                            }
486    
487                            return (com.liferay.portlet.asset.model.AssetCategory)returnObj;
488                    }
489                    catch (com.liferay.portal.kernel.exception.SystemException se) {
490                            _log.error(se, se);
491    
492                            throw se;
493                    }
494            }
495    
496            private static Log _log = LogFactoryUtil.getLog(AssetCategoryServiceHttp.class);
497    }