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