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.AssetTagServiceUtil;
027    
028    /**
029     * <p>
030     * This class provides a HTTP utility for the
031     * {@link com.liferay.portlet.asset.service.AssetTagServiceUtil} 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       AssetTagServiceSoap
054     * @see       com.liferay.portal.security.auth.HttpPrincipal
055     * @see       com.liferay.portlet.asset.service.AssetTagServiceUtil
056     * @generated
057     */
058    public class AssetTagServiceHttp {
059            public static com.liferay.portlet.asset.model.AssetTag addTag(
060                    HttpPrincipal httpPrincipal, java.lang.String name,
061                    java.lang.String[] tagProperties,
062                    com.liferay.portal.service.ServiceContext serviceContext)
063                    throws com.liferay.portal.kernel.exception.PortalException,
064                            com.liferay.portal.kernel.exception.SystemException {
065                    try {
066                            Object paramObj0 = name;
067    
068                            if (name == null) {
069                                    paramObj0 = new NullWrapper("java.lang.String");
070                            }
071    
072                            Object paramObj1 = tagProperties;
073    
074                            if (tagProperties == null) {
075                                    paramObj1 = new NullWrapper("[Ljava.lang.String;");
076                            }
077    
078                            Object paramObj2 = serviceContext;
079    
080                            if (serviceContext == null) {
081                                    paramObj2 = new NullWrapper(
082                                                    "com.liferay.portal.service.ServiceContext");
083                            }
084    
085                            MethodWrapper methodWrapper = new MethodWrapper(AssetTagServiceUtil.class.getName(),
086                                            "addTag", new Object[] { paramObj0, paramObj1, paramObj2 });
087    
088                            Object returnObj = null;
089    
090                            try {
091                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
092                            }
093                            catch (Exception e) {
094                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
095                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
096                                    }
097    
098                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
099                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
100                                    }
101    
102                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
103                            }
104    
105                            return (com.liferay.portlet.asset.model.AssetTag)returnObj;
106                    }
107                    catch (com.liferay.portal.kernel.exception.SystemException se) {
108                            _log.error(se, se);
109    
110                            throw se;
111                    }
112            }
113    
114            public static void deleteTag(HttpPrincipal httpPrincipal, long tagId)
115                    throws com.liferay.portal.kernel.exception.PortalException,
116                            com.liferay.portal.kernel.exception.SystemException {
117                    try {
118                            Object paramObj0 = new LongWrapper(tagId);
119    
120                            MethodWrapper methodWrapper = new MethodWrapper(AssetTagServiceUtil.class.getName(),
121                                            "deleteTag", new Object[] { paramObj0 });
122    
123                            try {
124                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
125                            }
126                            catch (Exception e) {
127                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
128                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
129                                    }
130    
131                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
132                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
133                                    }
134    
135                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
136                            }
137                    }
138                    catch (com.liferay.portal.kernel.exception.SystemException se) {
139                            _log.error(se, se);
140    
141                            throw se;
142                    }
143            }
144    
145            public static java.util.List<com.liferay.portlet.asset.model.AssetTag> getGroupTags(
146                    HttpPrincipal httpPrincipal, long groupId)
147                    throws com.liferay.portal.kernel.exception.PortalException,
148                            com.liferay.portal.kernel.exception.SystemException {
149                    try {
150                            Object paramObj0 = new LongWrapper(groupId);
151    
152                            MethodWrapper methodWrapper = new MethodWrapper(AssetTagServiceUtil.class.getName(),
153                                            "getGroupTags", new Object[] { paramObj0 });
154    
155                            Object returnObj = null;
156    
157                            try {
158                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
159                            }
160                            catch (Exception e) {
161                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
162                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
163                                    }
164    
165                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
166                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
167                                    }
168    
169                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
170                            }
171    
172                            return (java.util.List<com.liferay.portlet.asset.model.AssetTag>)returnObj;
173                    }
174                    catch (com.liferay.portal.kernel.exception.SystemException se) {
175                            _log.error(se, se);
176    
177                            throw se;
178                    }
179            }
180    
181            public static com.liferay.portlet.asset.model.AssetTag getTag(
182                    HttpPrincipal httpPrincipal, long tagId)
183                    throws com.liferay.portal.kernel.exception.PortalException,
184                            com.liferay.portal.kernel.exception.SystemException {
185                    try {
186                            Object paramObj0 = new LongWrapper(tagId);
187    
188                            MethodWrapper methodWrapper = new MethodWrapper(AssetTagServiceUtil.class.getName(),
189                                            "getTag", new Object[] { paramObj0 });
190    
191                            Object returnObj = null;
192    
193                            try {
194                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
195                            }
196                            catch (Exception e) {
197                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
198                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
199                                    }
200    
201                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
202                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
203                                    }
204    
205                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
206                            }
207    
208                            return (com.liferay.portlet.asset.model.AssetTag)returnObj;
209                    }
210                    catch (com.liferay.portal.kernel.exception.SystemException se) {
211                            _log.error(se, se);
212    
213                            throw se;
214                    }
215            }
216    
217            public static java.util.List<com.liferay.portlet.asset.model.AssetTag> getTags(
218                    HttpPrincipal httpPrincipal, long groupId, long classNameId,
219                    java.lang.String name)
220                    throws com.liferay.portal.kernel.exception.PortalException,
221                            com.liferay.portal.kernel.exception.SystemException {
222                    try {
223                            Object paramObj0 = new LongWrapper(groupId);
224    
225                            Object paramObj1 = new LongWrapper(classNameId);
226    
227                            Object paramObj2 = name;
228    
229                            if (name == null) {
230                                    paramObj2 = new NullWrapper("java.lang.String");
231                            }
232    
233                            MethodWrapper methodWrapper = new MethodWrapper(AssetTagServiceUtil.class.getName(),
234                                            "getTags", new Object[] { paramObj0, paramObj1, paramObj2 });
235    
236                            Object returnObj = null;
237    
238                            try {
239                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
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 (java.util.List<com.liferay.portlet.asset.model.AssetTag>)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 java.util.List<com.liferay.portlet.asset.model.AssetTag> getTags(
263                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK)
264                    throws com.liferay.portal.kernel.exception.PortalException,
265                            com.liferay.portal.kernel.exception.SystemException {
266                    try {
267                            Object paramObj0 = className;
268    
269                            if (className == null) {
270                                    paramObj0 = new NullWrapper("java.lang.String");
271                            }
272    
273                            Object paramObj1 = new LongWrapper(classPK);
274    
275                            MethodWrapper methodWrapper = new MethodWrapper(AssetTagServiceUtil.class.getName(),
276                                            "getTags", new Object[] { paramObj0, paramObj1 });
277    
278                            Object returnObj = null;
279    
280                            try {
281                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
282                            }
283                            catch (Exception e) {
284                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
285                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
286                                    }
287    
288                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
289                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
290                                    }
291    
292                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
293                            }
294    
295                            return (java.util.List<com.liferay.portlet.asset.model.AssetTag>)returnObj;
296                    }
297                    catch (com.liferay.portal.kernel.exception.SystemException se) {
298                            _log.error(se, se);
299    
300                            throw se;
301                    }
302            }
303    
304            public static void mergeTags(HttpPrincipal httpPrincipal, long fromTagId,
305                    long toTagId)
306                    throws com.liferay.portal.kernel.exception.PortalException,
307                            com.liferay.portal.kernel.exception.SystemException {
308                    try {
309                            Object paramObj0 = new LongWrapper(fromTagId);
310    
311                            Object paramObj1 = new LongWrapper(toTagId);
312    
313                            MethodWrapper methodWrapper = new MethodWrapper(AssetTagServiceUtil.class.getName(),
314                                            "mergeTags", new Object[] { paramObj0, paramObj1 });
315    
316                            try {
317                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
318                            }
319                            catch (Exception e) {
320                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
321                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
322                                    }
323    
324                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
325                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
326                                    }
327    
328                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
329                            }
330                    }
331                    catch (com.liferay.portal.kernel.exception.SystemException se) {
332                            _log.error(se, se);
333    
334                            throw se;
335                    }
336            }
337    
338            public static com.liferay.portal.kernel.json.JSONArray search(
339                    HttpPrincipal httpPrincipal, long groupId, java.lang.String name,
340                    java.lang.String[] tagProperties, int start, int end)
341                    throws com.liferay.portal.kernel.exception.SystemException {
342                    try {
343                            Object paramObj0 = new LongWrapper(groupId);
344    
345                            Object paramObj1 = name;
346    
347                            if (name == null) {
348                                    paramObj1 = new NullWrapper("java.lang.String");
349                            }
350    
351                            Object paramObj2 = tagProperties;
352    
353                            if (tagProperties == null) {
354                                    paramObj2 = new NullWrapper("[Ljava.lang.String;");
355                            }
356    
357                            Object paramObj3 = new IntegerWrapper(start);
358    
359                            Object paramObj4 = new IntegerWrapper(end);
360    
361                            MethodWrapper methodWrapper = new MethodWrapper(AssetTagServiceUtil.class.getName(),
362                                            "search",
363                                            new Object[] {
364                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
365                                            });
366    
367                            Object returnObj = null;
368    
369                            try {
370                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
371                            }
372                            catch (Exception e) {
373                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
374                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
375                                    }
376    
377                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
378                            }
379    
380                            return (com.liferay.portal.kernel.json.JSONArray)returnObj;
381                    }
382                    catch (com.liferay.portal.kernel.exception.SystemException se) {
383                            _log.error(se, se);
384    
385                            throw se;
386                    }
387            }
388    
389            public static com.liferay.portlet.asset.model.AssetTag updateTag(
390                    HttpPrincipal httpPrincipal, long tagId, java.lang.String name,
391                    java.lang.String[] tagProperties,
392                    com.liferay.portal.service.ServiceContext serviceContext)
393                    throws com.liferay.portal.kernel.exception.PortalException,
394                            com.liferay.portal.kernel.exception.SystemException {
395                    try {
396                            Object paramObj0 = new LongWrapper(tagId);
397    
398                            Object paramObj1 = name;
399    
400                            if (name == null) {
401                                    paramObj1 = new NullWrapper("java.lang.String");
402                            }
403    
404                            Object paramObj2 = tagProperties;
405    
406                            if (tagProperties == null) {
407                                    paramObj2 = new NullWrapper("[Ljava.lang.String;");
408                            }
409    
410                            Object paramObj3 = serviceContext;
411    
412                            if (serviceContext == null) {
413                                    paramObj3 = new NullWrapper(
414                                                    "com.liferay.portal.service.ServiceContext");
415                            }
416    
417                            MethodWrapper methodWrapper = new MethodWrapper(AssetTagServiceUtil.class.getName(),
418                                            "updateTag",
419                                            new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
420    
421                            Object returnObj = null;
422    
423                            try {
424                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
425                            }
426                            catch (Exception e) {
427                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
428                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
429                                    }
430    
431                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
432                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
433                                    }
434    
435                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
436                            }
437    
438                            return (com.liferay.portlet.asset.model.AssetTag)returnObj;
439                    }
440                    catch (com.liferay.portal.kernel.exception.SystemException se) {
441                            _log.error(se, se);
442    
443                            throw se;
444                    }
445            }
446    
447            private static Log _log = LogFactoryUtil.getLog(AssetTagServiceHttp.class);
448    }