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.AssetTagPropertyServiceUtil;
026    
027    /**
028     * <p>
029     * This class provides a HTTP utility for the
030     * {@link com.liferay.portlet.asset.service.AssetTagPropertyServiceUtil} 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       AssetTagPropertyServiceSoap
053     * @see       com.liferay.portal.security.auth.HttpPrincipal
054     * @see       com.liferay.portlet.asset.service.AssetTagPropertyServiceUtil
055     * @generated
056     */
057    public class AssetTagPropertyServiceHttp {
058            public static com.liferay.portlet.asset.model.AssetTagProperty addTagProperty(
059                    HttpPrincipal httpPrincipal, long tagId, java.lang.String key,
060                    java.lang.String value)
061                    throws com.liferay.portal.kernel.exception.PortalException,
062                            com.liferay.portal.kernel.exception.SystemException {
063                    try {
064                            Object paramObj0 = new LongWrapper(tagId);
065    
066                            Object paramObj1 = key;
067    
068                            if (key == null) {
069                                    paramObj1 = new NullWrapper("java.lang.String");
070                            }
071    
072                            Object paramObj2 = value;
073    
074                            if (value == null) {
075                                    paramObj2 = new NullWrapper("java.lang.String");
076                            }
077    
078                            MethodWrapper methodWrapper = new MethodWrapper(AssetTagPropertyServiceUtil.class.getName(),
079                                            "addTagProperty",
080                                            new Object[] { paramObj0, paramObj1, paramObj2 });
081    
082                            Object returnObj = null;
083    
084                            try {
085                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
086                            }
087                            catch (Exception e) {
088                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
089                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
090                                    }
091    
092                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
093                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
094                                    }
095    
096                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
097                            }
098    
099                            return (com.liferay.portlet.asset.model.AssetTagProperty)returnObj;
100                    }
101                    catch (com.liferay.portal.kernel.exception.SystemException se) {
102                            _log.error(se, se);
103    
104                            throw se;
105                    }
106            }
107    
108            public static void deleteTagProperty(HttpPrincipal httpPrincipal,
109                    long tagPropertyId)
110                    throws com.liferay.portal.kernel.exception.PortalException,
111                            com.liferay.portal.kernel.exception.SystemException {
112                    try {
113                            Object paramObj0 = new LongWrapper(tagPropertyId);
114    
115                            MethodWrapper methodWrapper = new MethodWrapper(AssetTagPropertyServiceUtil.class.getName(),
116                                            "deleteTagProperty", new Object[] { paramObj0 });
117    
118                            try {
119                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
120                            }
121                            catch (Exception e) {
122                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
123                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
124                                    }
125    
126                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
127                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
128                                    }
129    
130                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
131                            }
132                    }
133                    catch (com.liferay.portal.kernel.exception.SystemException se) {
134                            _log.error(se, se);
135    
136                            throw se;
137                    }
138            }
139    
140            public static java.util.List<com.liferay.portlet.asset.model.AssetTagProperty> getTagProperties(
141                    HttpPrincipal httpPrincipal, long tagId)
142                    throws com.liferay.portal.kernel.exception.SystemException {
143                    try {
144                            Object paramObj0 = new LongWrapper(tagId);
145    
146                            MethodWrapper methodWrapper = new MethodWrapper(AssetTagPropertyServiceUtil.class.getName(),
147                                            "getTagProperties", new Object[] { paramObj0 });
148    
149                            Object returnObj = null;
150    
151                            try {
152                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
153                            }
154                            catch (Exception e) {
155                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
156                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
157                                    }
158    
159                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
160                            }
161    
162                            return (java.util.List<com.liferay.portlet.asset.model.AssetTagProperty>)returnObj;
163                    }
164                    catch (com.liferay.portal.kernel.exception.SystemException se) {
165                            _log.error(se, se);
166    
167                            throw se;
168                    }
169            }
170    
171            public static java.util.List<com.liferay.portlet.asset.model.AssetTagProperty> getTagPropertyValues(
172                    HttpPrincipal httpPrincipal, long companyId, java.lang.String key)
173                    throws com.liferay.portal.kernel.exception.SystemException {
174                    try {
175                            Object paramObj0 = new LongWrapper(companyId);
176    
177                            Object paramObj1 = key;
178    
179                            if (key == null) {
180                                    paramObj1 = new NullWrapper("java.lang.String");
181                            }
182    
183                            MethodWrapper methodWrapper = new MethodWrapper(AssetTagPropertyServiceUtil.class.getName(),
184                                            "getTagPropertyValues",
185                                            new Object[] { paramObj0, paramObj1 });
186    
187                            Object returnObj = null;
188    
189                            try {
190                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
191                            }
192                            catch (Exception e) {
193                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
194                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
195                                    }
196    
197                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
198                            }
199    
200                            return (java.util.List<com.liferay.portlet.asset.model.AssetTagProperty>)returnObj;
201                    }
202                    catch (com.liferay.portal.kernel.exception.SystemException se) {
203                            _log.error(se, se);
204    
205                            throw se;
206                    }
207            }
208    
209            public static com.liferay.portlet.asset.model.AssetTagProperty updateTagProperty(
210                    HttpPrincipal httpPrincipal, long tagPropertyId, java.lang.String key,
211                    java.lang.String value)
212                    throws com.liferay.portal.kernel.exception.PortalException,
213                            com.liferay.portal.kernel.exception.SystemException {
214                    try {
215                            Object paramObj0 = new LongWrapper(tagPropertyId);
216    
217                            Object paramObj1 = key;
218    
219                            if (key == null) {
220                                    paramObj1 = new NullWrapper("java.lang.String");
221                            }
222    
223                            Object paramObj2 = value;
224    
225                            if (value == null) {
226                                    paramObj2 = new NullWrapper("java.lang.String");
227                            }
228    
229                            MethodWrapper methodWrapper = new MethodWrapper(AssetTagPropertyServiceUtil.class.getName(),
230                                            "updateTagProperty",
231                                            new Object[] { paramObj0, paramObj1, paramObj2 });
232    
233                            Object returnObj = null;
234    
235                            try {
236                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
237                            }
238                            catch (Exception e) {
239                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
240                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
241                                    }
242    
243                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
244                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
245                                    }
246    
247                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
248                            }
249    
250                            return (com.liferay.portlet.asset.model.AssetTagProperty)returnObj;
251                    }
252                    catch (com.liferay.portal.kernel.exception.SystemException se) {
253                            _log.error(se, se);
254    
255                            throw se;
256                    }
257            }
258    
259            private static Log _log = LogFactoryUtil.getLog(AssetTagPropertyServiceHttp.class);
260    }