1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   * 
13   */
14  
15  package com.liferay.portlet.tags.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.tags.service.TagsPropertyServiceUtil;
26  
27  /**
28   * <a href="TagsPropertyServiceHttp.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.tags.service.TagsPropertyServiceUtil} 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       TagsPropertyServiceSoap
60   * @see       com.liferay.portal.security.auth.HttpPrincipal
61   * @see       com.liferay.portlet.tags.service.TagsPropertyServiceUtil
62   * @generated
63   */
64  public class TagsPropertyServiceHttp {
65      public static com.liferay.portlet.tags.model.TagsProperty addProperty(
66          HttpPrincipal httpPrincipal, long entryId, java.lang.String key,
67          java.lang.String value)
68          throws com.liferay.portal.PortalException,
69              com.liferay.portal.SystemException {
70          try {
71              Object paramObj0 = new LongWrapper(entryId);
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(TagsPropertyServiceUtil.class.getName(),
86                      "addProperty",
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.PortalException) {
96                      throw (com.liferay.portal.PortalException)e;
97                  }
98  
99                  if (e instanceof com.liferay.portal.SystemException) {
100                     throw (com.liferay.portal.SystemException)e;
101                 }
102 
103                 throw new com.liferay.portal.SystemException(e);
104             }
105 
106             return (com.liferay.portlet.tags.model.TagsProperty)returnObj;
107         }
108         catch (com.liferay.portal.SystemException se) {
109             _log.error(se, se);
110 
111             throw se;
112         }
113     }
114 
115     public static com.liferay.portlet.tags.model.TagsProperty addProperty(
116         HttpPrincipal httpPrincipal, java.lang.String entryName,
117         java.lang.String key, java.lang.String value)
118         throws com.liferay.portal.PortalException,
119             com.liferay.portal.SystemException {
120         try {
121             Object paramObj0 = entryName;
122 
123             if (entryName == null) {
124                 paramObj0 = new NullWrapper("java.lang.String");
125             }
126 
127             Object paramObj1 = key;
128 
129             if (key == null) {
130                 paramObj1 = new NullWrapper("java.lang.String");
131             }
132 
133             Object paramObj2 = value;
134 
135             if (value == null) {
136                 paramObj2 = new NullWrapper("java.lang.String");
137             }
138 
139             MethodWrapper methodWrapper = new MethodWrapper(TagsPropertyServiceUtil.class.getName(),
140                     "addProperty",
141                     new Object[] { paramObj0, paramObj1, paramObj2 });
142 
143             Object returnObj = null;
144 
145             try {
146                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
147             }
148             catch (Exception e) {
149                 if (e instanceof com.liferay.portal.PortalException) {
150                     throw (com.liferay.portal.PortalException)e;
151                 }
152 
153                 if (e instanceof com.liferay.portal.SystemException) {
154                     throw (com.liferay.portal.SystemException)e;
155                 }
156 
157                 throw new com.liferay.portal.SystemException(e);
158             }
159 
160             return (com.liferay.portlet.tags.model.TagsProperty)returnObj;
161         }
162         catch (com.liferay.portal.SystemException se) {
163             _log.error(se, se);
164 
165             throw se;
166         }
167     }
168 
169     public static void deleteProperty(HttpPrincipal httpPrincipal,
170         long propertyId)
171         throws com.liferay.portal.PortalException,
172             com.liferay.portal.SystemException {
173         try {
174             Object paramObj0 = new LongWrapper(propertyId);
175 
176             MethodWrapper methodWrapper = new MethodWrapper(TagsPropertyServiceUtil.class.getName(),
177                     "deleteProperty", new Object[] { paramObj0 });
178 
179             try {
180                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
181             }
182             catch (Exception e) {
183                 if (e instanceof com.liferay.portal.PortalException) {
184                     throw (com.liferay.portal.PortalException)e;
185                 }
186 
187                 if (e instanceof com.liferay.portal.SystemException) {
188                     throw (com.liferay.portal.SystemException)e;
189                 }
190 
191                 throw new com.liferay.portal.SystemException(e);
192             }
193         }
194         catch (com.liferay.portal.SystemException se) {
195             _log.error(se, se);
196 
197             throw se;
198         }
199     }
200 
201     public static java.util.List<com.liferay.portlet.tags.model.TagsProperty> getProperties(
202         HttpPrincipal httpPrincipal, long entryId)
203         throws com.liferay.portal.SystemException {
204         try {
205             Object paramObj0 = new LongWrapper(entryId);
206 
207             MethodWrapper methodWrapper = new MethodWrapper(TagsPropertyServiceUtil.class.getName(),
208                     "getProperties", new Object[] { paramObj0 });
209 
210             Object returnObj = null;
211 
212             try {
213                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
214             }
215             catch (Exception e) {
216                 if (e instanceof com.liferay.portal.SystemException) {
217                     throw (com.liferay.portal.SystemException)e;
218                 }
219 
220                 throw new com.liferay.portal.SystemException(e);
221             }
222 
223             return (java.util.List<com.liferay.portlet.tags.model.TagsProperty>)returnObj;
224         }
225         catch (com.liferay.portal.SystemException se) {
226             _log.error(se, se);
227 
228             throw se;
229         }
230     }
231 
232     public static java.util.List<com.liferay.portlet.tags.model.TagsProperty> getPropertyValues(
233         HttpPrincipal httpPrincipal, long companyId, java.lang.String key)
234         throws com.liferay.portal.SystemException {
235         try {
236             Object paramObj0 = new LongWrapper(companyId);
237 
238             Object paramObj1 = key;
239 
240             if (key == null) {
241                 paramObj1 = new NullWrapper("java.lang.String");
242             }
243 
244             MethodWrapper methodWrapper = new MethodWrapper(TagsPropertyServiceUtil.class.getName(),
245                     "getPropertyValues", new Object[] { paramObj0, paramObj1 });
246 
247             Object returnObj = null;
248 
249             try {
250                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
251             }
252             catch (Exception e) {
253                 if (e instanceof com.liferay.portal.SystemException) {
254                     throw (com.liferay.portal.SystemException)e;
255                 }
256 
257                 throw new com.liferay.portal.SystemException(e);
258             }
259 
260             return (java.util.List<com.liferay.portlet.tags.model.TagsProperty>)returnObj;
261         }
262         catch (com.liferay.portal.SystemException se) {
263             _log.error(se, se);
264 
265             throw se;
266         }
267     }
268 
269     public static com.liferay.portlet.tags.model.TagsProperty updateProperty(
270         HttpPrincipal httpPrincipal, long propertyId, java.lang.String key,
271         java.lang.String value)
272         throws com.liferay.portal.PortalException,
273             com.liferay.portal.SystemException {
274         try {
275             Object paramObj0 = new LongWrapper(propertyId);
276 
277             Object paramObj1 = key;
278 
279             if (key == null) {
280                 paramObj1 = new NullWrapper("java.lang.String");
281             }
282 
283             Object paramObj2 = value;
284 
285             if (value == null) {
286                 paramObj2 = new NullWrapper("java.lang.String");
287             }
288 
289             MethodWrapper methodWrapper = new MethodWrapper(TagsPropertyServiceUtil.class.getName(),
290                     "updateProperty",
291                     new Object[] { paramObj0, paramObj1, paramObj2 });
292 
293             Object returnObj = null;
294 
295             try {
296                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
297             }
298             catch (Exception e) {
299                 if (e instanceof com.liferay.portal.PortalException) {
300                     throw (com.liferay.portal.PortalException)e;
301                 }
302 
303                 if (e instanceof com.liferay.portal.SystemException) {
304                     throw (com.liferay.portal.SystemException)e;
305                 }
306 
307                 throw new com.liferay.portal.SystemException(e);
308             }
309 
310             return (com.liferay.portlet.tags.model.TagsProperty)returnObj;
311         }
312         catch (com.liferay.portal.SystemException se) {
313             _log.error(se, se);
314 
315             throw se;
316         }
317     }
318 
319     private static Log _log = LogFactoryUtil.getLog(TagsPropertyServiceHttp.class);
320 }