1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet.asset.service.http;
16  
17  import com.liferay.portal.kernel.log.Log;
18  import com.liferay.portal.kernel.log.LogFactoryUtil;
19  import com.liferay.portal.kernel.util.LongWrapper;
20  import com.liferay.portal.kernel.util.MethodWrapper;
21  import com.liferay.portal.kernel.util.NullWrapper;
22  import com.liferay.portal.security.auth.HttpPrincipal;
23  import com.liferay.portal.service.http.TunnelUtil;
24  
25  import com.liferay.portlet.asset.service.AssetTagPropertyServiceUtil;
26  
27  /**
28   * <a href="AssetTagPropertyServiceHttp.java.html"><b><i>View Source</i></b></a>
29   *
30   * <p>
31   * ServiceBuilder generated this class. Modifications in this class will be
32   * overwritten the next time is generated.
33   * </p>
34   *
35   * <p>
36   * This class provides a HTTP utility for the
37   * {@link com.liferay.portlet.asset.service.AssetTagPropertyServiceUtil} service utility. The
38   * static methods of this class calls the same methods of the service utility.
39   * However, the signatures are different because it requires an additional
40   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
41   * </p>
42   *
43   * <p>
44   * The benefits of using the HTTP utility is that it is fast and allows for
45   * tunneling without the cost of serializing to text. The drawback is that it
46   * only works with Java.
47   * </p>
48   *
49   * <p>
50   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
51   * configure security.
52   * </p>
53   *
54   * <p>
55   * The HTTP utility is only generated for remote services.
56   * </p>
57   *
58   * @author    Brian Wing Shun Chan
59   * @see       AssetTagPropertyServiceSoap
60   * @see       com.liferay.portal.security.auth.HttpPrincipal
61   * @see       com.liferay.portlet.asset.service.AssetTagPropertyServiceUtil
62   * @generated
63   */
64  public class AssetTagPropertyServiceHttp {
65      public static com.liferay.portlet.asset.model.AssetTagProperty addTagProperty(
66          HttpPrincipal httpPrincipal, long tagId, java.lang.String key,
67          java.lang.String value)
68          throws com.liferay.portal.kernel.exception.PortalException,
69              com.liferay.portal.kernel.exception.SystemException {
70          try {
71              Object paramObj0 = new LongWrapper(tagId);
72  
73              Object paramObj1 = key;
74  
75              if (key == null) {
76                  paramObj1 = new NullWrapper("java.lang.String");
77              }
78  
79              Object paramObj2 = value;
80  
81              if (value == null) {
82                  paramObj2 = new NullWrapper("java.lang.String");
83              }
84  
85              MethodWrapper methodWrapper = new MethodWrapper(AssetTagPropertyServiceUtil.class.getName(),
86                      "addTagProperty",
87                      new Object[] { paramObj0, paramObj1, paramObj2 });
88  
89              Object returnObj = null;
90  
91              try {
92                  returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
93              }
94              catch (Exception e) {
95                  if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
96                      throw (com.liferay.portal.kernel.exception.PortalException)e;
97                  }
98  
99                  if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
100                     throw (com.liferay.portal.kernel.exception.SystemException)e;
101                 }
102 
103                 throw new com.liferay.portal.kernel.exception.SystemException(e);
104             }
105 
106             return (com.liferay.portlet.asset.model.AssetTagProperty)returnObj;
107         }
108         catch (com.liferay.portal.kernel.exception.SystemException se) {
109             _log.error(se, se);
110 
111             throw se;
112         }
113     }
114 
115     public static void deleteTagProperty(HttpPrincipal httpPrincipal,
116         long tagPropertyId)
117         throws com.liferay.portal.kernel.exception.PortalException,
118             com.liferay.portal.kernel.exception.SystemException {
119         try {
120             Object paramObj0 = new LongWrapper(tagPropertyId);
121 
122             MethodWrapper methodWrapper = new MethodWrapper(AssetTagPropertyServiceUtil.class.getName(),
123                     "deleteTagProperty", new Object[] { paramObj0 });
124 
125             try {
126                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
127             }
128             catch (Exception e) {
129                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
130                     throw (com.liferay.portal.kernel.exception.PortalException)e;
131                 }
132 
133                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
134                     throw (com.liferay.portal.kernel.exception.SystemException)e;
135                 }
136 
137                 throw new com.liferay.portal.kernel.exception.SystemException(e);
138             }
139         }
140         catch (com.liferay.portal.kernel.exception.SystemException se) {
141             _log.error(se, se);
142 
143             throw se;
144         }
145     }
146 
147     public static java.util.List<com.liferay.portlet.asset.model.AssetTagProperty> getTagProperties(
148         HttpPrincipal httpPrincipal, long tagId)
149         throws com.liferay.portal.kernel.exception.SystemException {
150         try {
151             Object paramObj0 = new LongWrapper(tagId);
152 
153             MethodWrapper methodWrapper = new MethodWrapper(AssetTagPropertyServiceUtil.class.getName(),
154                     "getTagProperties", new Object[] { paramObj0 });
155 
156             Object returnObj = null;
157 
158             try {
159                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
160             }
161             catch (Exception e) {
162                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
163                     throw (com.liferay.portal.kernel.exception.SystemException)e;
164                 }
165 
166                 throw new com.liferay.portal.kernel.exception.SystemException(e);
167             }
168 
169             return (java.util.List<com.liferay.portlet.asset.model.AssetTagProperty>)returnObj;
170         }
171         catch (com.liferay.portal.kernel.exception.SystemException se) {
172             _log.error(se, se);
173 
174             throw se;
175         }
176     }
177 
178     public static java.util.List<com.liferay.portlet.asset.model.AssetTagProperty> getTagPropertyValues(
179         HttpPrincipal httpPrincipal, long companyId, java.lang.String key)
180         throws com.liferay.portal.kernel.exception.SystemException {
181         try {
182             Object paramObj0 = new LongWrapper(companyId);
183 
184             Object paramObj1 = key;
185 
186             if (key == null) {
187                 paramObj1 = new NullWrapper("java.lang.String");
188             }
189 
190             MethodWrapper methodWrapper = new MethodWrapper(AssetTagPropertyServiceUtil.class.getName(),
191                     "getTagPropertyValues",
192                     new Object[] { paramObj0, paramObj1 });
193 
194             Object returnObj = null;
195 
196             try {
197                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
198             }
199             catch (Exception e) {
200                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
201                     throw (com.liferay.portal.kernel.exception.SystemException)e;
202                 }
203 
204                 throw new com.liferay.portal.kernel.exception.SystemException(e);
205             }
206 
207             return (java.util.List<com.liferay.portlet.asset.model.AssetTagProperty>)returnObj;
208         }
209         catch (com.liferay.portal.kernel.exception.SystemException se) {
210             _log.error(se, se);
211 
212             throw se;
213         }
214     }
215 
216     public static com.liferay.portlet.asset.model.AssetTagProperty updateTagProperty(
217         HttpPrincipal httpPrincipal, long tagPropertyId, java.lang.String key,
218         java.lang.String value)
219         throws com.liferay.portal.kernel.exception.PortalException,
220             com.liferay.portal.kernel.exception.SystemException {
221         try {
222             Object paramObj0 = new LongWrapper(tagPropertyId);
223 
224             Object paramObj1 = key;
225 
226             if (key == null) {
227                 paramObj1 = new NullWrapper("java.lang.String");
228             }
229 
230             Object paramObj2 = value;
231 
232             if (value == null) {
233                 paramObj2 = new NullWrapper("java.lang.String");
234             }
235 
236             MethodWrapper methodWrapper = new MethodWrapper(AssetTagPropertyServiceUtil.class.getName(),
237                     "updateTagProperty",
238                     new Object[] { paramObj0, paramObj1, paramObj2 });
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 (com.liferay.portlet.asset.model.AssetTagProperty)returnObj;
258         }
259         catch (com.liferay.portal.kernel.exception.SystemException se) {
260             _log.error(se, se);
261 
262             throw se;
263         }
264     }
265 
266     private static Log _log = LogFactoryUtil.getLog(AssetTagPropertyServiceHttp.class);
267 }