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.LongWrapper;
020    import com.liferay.portal.kernel.util.MethodWrapper;
021    import com.liferay.portal.kernel.util.NullWrapper;
022    import com.liferay.portal.security.auth.HttpPrincipal;
023    import com.liferay.portal.service.http.TunnelUtil;
024    
025    import com.liferay.portlet.asset.service.AssetVocabularyServiceUtil;
026    
027    /**
028     * <p>
029     * This class provides a HTTP utility for the
030     * {@link com.liferay.portlet.asset.service.AssetVocabularyServiceUtil} service utility. The
031     * static methods of this class calls the same methods of the service utility.
032     * However, the signatures are different because it requires an additional
033     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
034     * </p>
035     *
036     * <p>
037     * The benefits of using the HTTP utility is that it is fast and allows for
038     * tunneling without the cost of serializing to text. The drawback is that it
039     * only works with Java.
040     * </p>
041     *
042     * <p>
043     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
044     * configure security.
045     * </p>
046     *
047     * <p>
048     * The HTTP utility is only generated for remote services.
049     * </p>
050     *
051     * @author    Brian Wing Shun Chan
052     * @see       AssetVocabularyServiceSoap
053     * @see       com.liferay.portal.security.auth.HttpPrincipal
054     * @see       com.liferay.portlet.asset.service.AssetVocabularyServiceUtil
055     * @generated
056     */
057    public class AssetVocabularyServiceHttp {
058            public static com.liferay.portlet.asset.model.AssetVocabulary addVocabulary(
059                    HttpPrincipal httpPrincipal,
060                    java.util.Map<java.util.Locale, java.lang.String> titleMap,
061                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
062                    java.lang.String settings,
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 = titleMap;
068    
069                            if (titleMap == null) {
070                                    paramObj0 = new NullWrapper("java.util.Map");
071                            }
072    
073                            Object paramObj1 = descriptionMap;
074    
075                            if (descriptionMap == null) {
076                                    paramObj1 = new NullWrapper("java.util.Map");
077                            }
078    
079                            Object paramObj2 = settings;
080    
081                            if (settings == null) {
082                                    paramObj2 = new NullWrapper("java.lang.String");
083                            }
084    
085                            Object paramObj3 = serviceContext;
086    
087                            if (serviceContext == null) {
088                                    paramObj3 = new NullWrapper(
089                                                    "com.liferay.portal.service.ServiceContext");
090                            }
091    
092                            MethodWrapper methodWrapper = new MethodWrapper(AssetVocabularyServiceUtil.class.getName(),
093                                            "addVocabulary",
094                                            new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
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.AssetVocabulary)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 deleteVocabulary(HttpPrincipal httpPrincipal,
123                    long vocabularyId)
124                    throws com.liferay.portal.kernel.exception.PortalException,
125                            com.liferay.portal.kernel.exception.SystemException {
126                    try {
127                            Object paramObj0 = new LongWrapper(vocabularyId);
128    
129                            MethodWrapper methodWrapper = new MethodWrapper(AssetVocabularyServiceUtil.class.getName(),
130                                            "deleteVocabulary", 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.AssetVocabulary> getCompanyVocabularies(
155                    HttpPrincipal httpPrincipal, long companyId)
156                    throws com.liferay.portal.kernel.exception.PortalException,
157                            com.liferay.portal.kernel.exception.SystemException {
158                    try {
159                            Object paramObj0 = new LongWrapper(companyId);
160    
161                            MethodWrapper methodWrapper = new MethodWrapper(AssetVocabularyServiceUtil.class.getName(),
162                                            "getCompanyVocabularies", new Object[] { paramObj0 });
163    
164                            Object returnObj = null;
165    
166                            try {
167                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
168                            }
169                            catch (Exception e) {
170                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
171                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
172                                    }
173    
174                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
175                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
176                                    }
177    
178                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
179                            }
180    
181                            return (java.util.List<com.liferay.portlet.asset.model.AssetVocabulary>)returnObj;
182                    }
183                    catch (com.liferay.portal.kernel.exception.SystemException se) {
184                            _log.error(se, se);
185    
186                            throw se;
187                    }
188            }
189    
190            public static java.util.List<com.liferay.portlet.asset.model.AssetVocabulary> getGroupsVocabularies(
191                    HttpPrincipal httpPrincipal, long[] groupIds)
192                    throws com.liferay.portal.kernel.exception.PortalException,
193                            com.liferay.portal.kernel.exception.SystemException {
194                    try {
195                            Object paramObj0 = groupIds;
196    
197                            if (groupIds == null) {
198                                    paramObj0 = new NullWrapper("[J");
199                            }
200    
201                            MethodWrapper methodWrapper = new MethodWrapper(AssetVocabularyServiceUtil.class.getName(),
202                                            "getGroupsVocabularies", new Object[] { paramObj0 });
203    
204                            Object returnObj = null;
205    
206                            try {
207                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
208                            }
209                            catch (Exception e) {
210                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
211                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
212                                    }
213    
214                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
215                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
216                                    }
217    
218                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
219                            }
220    
221                            return (java.util.List<com.liferay.portlet.asset.model.AssetVocabulary>)returnObj;
222                    }
223                    catch (com.liferay.portal.kernel.exception.SystemException se) {
224                            _log.error(se, se);
225    
226                            throw se;
227                    }
228            }
229    
230            public static java.util.List<com.liferay.portlet.asset.model.AssetVocabulary> getGroupVocabularies(
231                    HttpPrincipal httpPrincipal, long groupId)
232                    throws com.liferay.portal.kernel.exception.PortalException,
233                            com.liferay.portal.kernel.exception.SystemException {
234                    try {
235                            Object paramObj0 = new LongWrapper(groupId);
236    
237                            MethodWrapper methodWrapper = new MethodWrapper(AssetVocabularyServiceUtil.class.getName(),
238                                            "getGroupVocabularies", new Object[] { paramObj0 });
239    
240                            Object returnObj = null;
241    
242                            try {
243                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
244                            }
245                            catch (Exception e) {
246                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
247                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
248                                    }
249    
250                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
251                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
252                                    }
253    
254                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
255                            }
256    
257                            return (java.util.List<com.liferay.portlet.asset.model.AssetVocabulary>)returnObj;
258                    }
259                    catch (com.liferay.portal.kernel.exception.SystemException se) {
260                            _log.error(se, se);
261    
262                            throw se;
263                    }
264            }
265    
266            public static com.liferay.portlet.asset.model.AssetVocabulary getVocabulary(
267                    HttpPrincipal httpPrincipal, long vocabularyId)
268                    throws com.liferay.portal.kernel.exception.PortalException,
269                            com.liferay.portal.kernel.exception.SystemException {
270                    try {
271                            Object paramObj0 = new LongWrapper(vocabularyId);
272    
273                            MethodWrapper methodWrapper = new MethodWrapper(AssetVocabularyServiceUtil.class.getName(),
274                                            "getVocabulary", new Object[] { paramObj0 });
275    
276                            Object returnObj = null;
277    
278                            try {
279                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
280                            }
281                            catch (Exception e) {
282                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
283                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
284                                    }
285    
286                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
287                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
288                                    }
289    
290                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
291                            }
292    
293                            return (com.liferay.portlet.asset.model.AssetVocabulary)returnObj;
294                    }
295                    catch (com.liferay.portal.kernel.exception.SystemException se) {
296                            _log.error(se, se);
297    
298                            throw se;
299                    }
300            }
301    
302            public static com.liferay.portlet.asset.model.AssetVocabulary updateVocabulary(
303                    HttpPrincipal httpPrincipal, long vocabularyId,
304                    java.util.Map<java.util.Locale, java.lang.String> titleMap,
305                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
306                    java.lang.String settings,
307                    com.liferay.portal.service.ServiceContext serviceContext)
308                    throws com.liferay.portal.kernel.exception.PortalException,
309                            com.liferay.portal.kernel.exception.SystemException {
310                    try {
311                            Object paramObj0 = new LongWrapper(vocabularyId);
312    
313                            Object paramObj1 = titleMap;
314    
315                            if (titleMap == null) {
316                                    paramObj1 = new NullWrapper("java.util.Map");
317                            }
318    
319                            Object paramObj2 = descriptionMap;
320    
321                            if (descriptionMap == null) {
322                                    paramObj2 = new NullWrapper("java.util.Map");
323                            }
324    
325                            Object paramObj3 = settings;
326    
327                            if (settings == null) {
328                                    paramObj3 = new NullWrapper("java.lang.String");
329                            }
330    
331                            Object paramObj4 = serviceContext;
332    
333                            if (serviceContext == null) {
334                                    paramObj4 = new NullWrapper(
335                                                    "com.liferay.portal.service.ServiceContext");
336                            }
337    
338                            MethodWrapper methodWrapper = new MethodWrapper(AssetVocabularyServiceUtil.class.getName(),
339                                            "updateVocabulary",
340                                            new Object[] {
341                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
342                                            });
343    
344                            Object returnObj = null;
345    
346                            try {
347                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
348                            }
349                            catch (Exception e) {
350                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
351                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
352                                    }
353    
354                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
355                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
356                                    }
357    
358                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
359                            }
360    
361                            return (com.liferay.portlet.asset.model.AssetVocabulary)returnObj;
362                    }
363                    catch (com.liferay.portal.kernel.exception.SystemException se) {
364                            _log.error(se, se);
365    
366                            throw se;
367                    }
368            }
369    
370            private static Log _log = LogFactoryUtil.getLog(AssetVocabularyServiceHttp.class);
371    }