001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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", _addTagParameterTypes0);
066    
067                            MethodHandler methodHandler = new MethodHandler(methodKey, name,
068                                            tagProperties, serviceContext);
069    
070                            Object returnObj = null;
071    
072                            try {
073                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
074                            }
075                            catch (Exception e) {
076                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
077                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
078                                    }
079    
080                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
081                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
082                                    }
083    
084                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
085                            }
086    
087                            return (com.liferay.portlet.asset.model.AssetTag)returnObj;
088                    }
089                    catch (com.liferay.portal.kernel.exception.SystemException se) {
090                            _log.error(se, se);
091    
092                            throw se;
093                    }
094            }
095    
096            public static void deleteTag(HttpPrincipal httpPrincipal, long tagId)
097                    throws com.liferay.portal.kernel.exception.PortalException,
098                            com.liferay.portal.kernel.exception.SystemException {
099                    try {
100                            MethodKey methodKey = new MethodKey(AssetTagServiceUtil.class.getName(),
101                                            "deleteTag", _deleteTagParameterTypes1);
102    
103                            MethodHandler methodHandler = new MethodHandler(methodKey, tagId);
104    
105                            try {
106                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
107                            }
108                            catch (Exception e) {
109                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
110                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
111                                    }
112    
113                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
114                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
115                                    }
116    
117                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
118                            }
119                    }
120                    catch (com.liferay.portal.kernel.exception.SystemException se) {
121                            _log.error(se, se);
122    
123                            throw se;
124                    }
125            }
126    
127            public static java.util.List<com.liferay.portlet.asset.model.AssetTag> getGroupTags(
128                    HttpPrincipal httpPrincipal, long groupId)
129                    throws com.liferay.portal.kernel.exception.PortalException,
130                            com.liferay.portal.kernel.exception.SystemException {
131                    try {
132                            MethodKey methodKey = new MethodKey(AssetTagServiceUtil.class.getName(),
133                                            "getGroupTags", _getGroupTagsParameterTypes2);
134    
135                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId);
136    
137                            Object returnObj = null;
138    
139                            try {
140                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
141                            }
142                            catch (Exception e) {
143                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
144                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
145                                    }
146    
147                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
148                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
149                                    }
150    
151                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
152                            }
153    
154                            return (java.util.List<com.liferay.portlet.asset.model.AssetTag>)returnObj;
155                    }
156                    catch (com.liferay.portal.kernel.exception.SystemException se) {
157                            _log.error(se, se);
158    
159                            throw se;
160                    }
161            }
162    
163            public static com.liferay.portlet.asset.model.AssetTag getTag(
164                    HttpPrincipal httpPrincipal, long tagId)
165                    throws com.liferay.portal.kernel.exception.PortalException,
166                            com.liferay.portal.kernel.exception.SystemException {
167                    try {
168                            MethodKey methodKey = new MethodKey(AssetTagServiceUtil.class.getName(),
169                                            "getTag", _getTagParameterTypes3);
170    
171                            MethodHandler methodHandler = new MethodHandler(methodKey, tagId);
172    
173                            Object returnObj = null;
174    
175                            try {
176                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
177                            }
178                            catch (Exception e) {
179                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
180                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
181                                    }
182    
183                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
184                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
185                                    }
186    
187                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
188                            }
189    
190                            return (com.liferay.portlet.asset.model.AssetTag)returnObj;
191                    }
192                    catch (com.liferay.portal.kernel.exception.SystemException se) {
193                            _log.error(se, se);
194    
195                            throw se;
196                    }
197            }
198    
199            public static java.util.List<com.liferay.portlet.asset.model.AssetTag> getTags(
200                    HttpPrincipal httpPrincipal, long groupId, long classNameId,
201                    java.lang.String name)
202                    throws com.liferay.portal.kernel.exception.PortalException,
203                            com.liferay.portal.kernel.exception.SystemException {
204                    try {
205                            MethodKey methodKey = new MethodKey(AssetTagServiceUtil.class.getName(),
206                                            "getTags", _getTagsParameterTypes4);
207    
208                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
209                                            classNameId, name);
210    
211                            Object returnObj = null;
212    
213                            try {
214                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
215                            }
216                            catch (Exception e) {
217                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
218                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
219                                    }
220    
221                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
222                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
223                                    }
224    
225                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
226                            }
227    
228                            return (java.util.List<com.liferay.portlet.asset.model.AssetTag>)returnObj;
229                    }
230                    catch (com.liferay.portal.kernel.exception.SystemException se) {
231                            _log.error(se, se);
232    
233                            throw se;
234                    }
235            }
236    
237            public static java.util.List<com.liferay.portlet.asset.model.AssetTag> getTags(
238                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK)
239                    throws com.liferay.portal.kernel.exception.PortalException,
240                            com.liferay.portal.kernel.exception.SystemException {
241                    try {
242                            MethodKey methodKey = new MethodKey(AssetTagServiceUtil.class.getName(),
243                                            "getTags", _getTagsParameterTypes5);
244    
245                            MethodHandler methodHandler = new MethodHandler(methodKey,
246                                            className, classPK);
247    
248                            Object returnObj = null;
249    
250                            try {
251                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
252                            }
253                            catch (Exception e) {
254                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
255                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
256                                    }
257    
258                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
259                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
260                                    }
261    
262                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
263                            }
264    
265                            return (java.util.List<com.liferay.portlet.asset.model.AssetTag>)returnObj;
266                    }
267                    catch (com.liferay.portal.kernel.exception.SystemException se) {
268                            _log.error(se, se);
269    
270                            throw se;
271                    }
272            }
273    
274            public static void mergeTags(HttpPrincipal httpPrincipal, long fromTagId,
275                    long toTagId)
276                    throws com.liferay.portal.kernel.exception.PortalException,
277                            com.liferay.portal.kernel.exception.SystemException {
278                    try {
279                            MethodKey methodKey = new MethodKey(AssetTagServiceUtil.class.getName(),
280                                            "mergeTags", _mergeTagsParameterTypes6);
281    
282                            MethodHandler methodHandler = new MethodHandler(methodKey,
283                                            fromTagId, toTagId);
284    
285                            try {
286                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
287                            }
288                            catch (Exception e) {
289                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
290                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
291                                    }
292    
293                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
294                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
295                                    }
296    
297                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
298                            }
299                    }
300                    catch (com.liferay.portal.kernel.exception.SystemException se) {
301                            _log.error(se, se);
302    
303                            throw se;
304                    }
305            }
306    
307            public static com.liferay.portal.kernel.json.JSONArray search(
308                    HttpPrincipal httpPrincipal, long groupId, java.lang.String name,
309                    java.lang.String[] tagProperties, int start, int end)
310                    throws com.liferay.portal.kernel.exception.PortalException,
311                            com.liferay.portal.kernel.exception.SystemException {
312                    try {
313                            MethodKey methodKey = new MethodKey(AssetTagServiceUtil.class.getName(),
314                                            "search", _searchParameterTypes7);
315    
316                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
317                                            name, tagProperties, start, end);
318    
319                            Object returnObj = null;
320    
321                            try {
322                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
323                            }
324                            catch (Exception e) {
325                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
326                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
327                                    }
328    
329                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
330                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
331                                    }
332    
333                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
334                            }
335    
336                            return (com.liferay.portal.kernel.json.JSONArray)returnObj;
337                    }
338                    catch (com.liferay.portal.kernel.exception.SystemException se) {
339                            _log.error(se, se);
340    
341                            throw se;
342                    }
343            }
344    
345            public static com.liferay.portlet.asset.model.AssetTag updateTag(
346                    HttpPrincipal httpPrincipal, long tagId, java.lang.String name,
347                    java.lang.String[] tagProperties,
348                    com.liferay.portal.service.ServiceContext serviceContext)
349                    throws com.liferay.portal.kernel.exception.PortalException,
350                            com.liferay.portal.kernel.exception.SystemException {
351                    try {
352                            MethodKey methodKey = new MethodKey(AssetTagServiceUtil.class.getName(),
353                                            "updateTag", _updateTagParameterTypes8);
354    
355                            MethodHandler methodHandler = new MethodHandler(methodKey, tagId,
356                                            name, tagProperties, serviceContext);
357    
358                            Object returnObj = null;
359    
360                            try {
361                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
362                            }
363                            catch (Exception e) {
364                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
365                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
366                                    }
367    
368                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
369                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
370                                    }
371    
372                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
373                            }
374    
375                            return (com.liferay.portlet.asset.model.AssetTag)returnObj;
376                    }
377                    catch (com.liferay.portal.kernel.exception.SystemException se) {
378                            _log.error(se, se);
379    
380                            throw se;
381                    }
382            }
383    
384            private static Log _log = LogFactoryUtil.getLog(AssetTagServiceHttp.class);
385            private static final Class<?>[] _addTagParameterTypes0 = new Class[] {
386                            java.lang.String.class, java.lang.String[].class,
387                            com.liferay.portal.service.ServiceContext.class
388                    };
389            private static final Class<?>[] _deleteTagParameterTypes1 = new Class[] {
390                            long.class
391                    };
392            private static final Class<?>[] _getGroupTagsParameterTypes2 = new Class[] {
393                            long.class
394                    };
395            private static final Class<?>[] _getTagParameterTypes3 = new Class[] {
396                            long.class
397                    };
398            private static final Class<?>[] _getTagsParameterTypes4 = new Class[] {
399                            long.class, long.class, java.lang.String.class
400                    };
401            private static final Class<?>[] _getTagsParameterTypes5 = new Class[] {
402                            java.lang.String.class, long.class
403                    };
404            private static final Class<?>[] _mergeTagsParameterTypes6 = new Class[] {
405                            long.class, long.class
406                    };
407            private static final Class<?>[] _searchParameterTypes7 = new Class[] {
408                            long.class, java.lang.String.class, java.lang.String[].class,
409                            int.class, int.class
410                    };
411            private static final Class<?>[] _updateTagParameterTypes8 = new Class[] {
412                            long.class, java.lang.String.class, java.lang.String[].class,
413                            com.liferay.portal.service.ServiceContext.class
414                    };
415    }