1   /**
2    * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portlet.tags.service.http;
24  
25  import com.liferay.portal.kernel.log.Log;
26  import com.liferay.portal.kernel.log.LogFactoryUtil;
27  import com.liferay.portal.kernel.util.LongWrapper;
28  import com.liferay.portal.kernel.util.MethodWrapper;
29  import com.liferay.portal.kernel.util.NullWrapper;
30  import com.liferay.portal.security.auth.HttpPrincipal;
31  import com.liferay.portal.service.http.TunnelUtil;
32  
33  import com.liferay.portlet.tags.service.TagsPropertyServiceUtil;
34  
35  /**
36   * <a href="TagsPropertyServiceHttp.java.html"><b><i>View Source</i></b></a>
37   *
38   * <p>
39   * ServiceBuilder generated this class. Modifications in this class will be
40   * overwritten the next time is generated.
41   * </p>
42   *
43   * <p>
44   * This class provides a HTTP utility for the
45   * <code>com.liferay.portlet.tags.service.TagsPropertyServiceUtil</code> service
46   * utility. The static methods of this class calls the same methods of the
47   * service utility. However, the signatures are different because it requires an
48   * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code>
49   * parameter.
50   * </p>
51   *
52   * <p>
53   * The benefits of using the HTTP utility is that it is fast and allows for
54   * tunneling without the cost of serializing to text. The drawback is that it
55   * only works with Java.
56   * </p>
57   *
58   * <p>
59   * Set the property <code>tunnel.servlet.hosts.allowed</code> in
60   * portal.properties to configure security.
61   * </p>
62   *
63   * <p>
64   * The HTTP utility is only generated for remote services.
65   * </p>
66   *
67   * @author Brian Wing Shun Chan
68   *
69   * @see com.liferay.portal.security.auth.HttpPrincipal
70   * @see com.liferay.portlet.tags.service.TagsPropertyServiceUtil
71   * @see com.liferay.portlet.tags.service.http.TagsPropertyServiceSoap
72   *
73   */
74  public class TagsPropertyServiceHttp {
75      public static com.liferay.portlet.tags.model.TagsProperty addProperty(
76          HttpPrincipal httpPrincipal, long entryId, java.lang.String key,
77          java.lang.String value)
78          throws com.liferay.portal.SystemException,
79              com.liferay.portal.PortalException {
80          try {
81              Object paramObj0 = new LongWrapper(entryId);
82  
83              Object paramObj1 = key;
84  
85              if (key == null) {
86                  paramObj1 = new NullWrapper("java.lang.String");
87              }
88  
89              Object paramObj2 = value;
90  
91              if (value == null) {
92                  paramObj2 = new NullWrapper("java.lang.String");
93              }
94  
95              MethodWrapper methodWrapper = new MethodWrapper(TagsPropertyServiceUtil.class.getName(),
96                      "addProperty",
97                      new Object[] { paramObj0, paramObj1, paramObj2 });
98  
99              Object returnObj = null;
100 
101             try {
102                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
103             }
104             catch (Exception e) {
105                 if (e instanceof com.liferay.portal.SystemException) {
106                     throw (com.liferay.portal.SystemException)e;
107                 }
108 
109                 if (e instanceof com.liferay.portal.PortalException) {
110                     throw (com.liferay.portal.PortalException)e;
111                 }
112 
113                 throw new com.liferay.portal.SystemException(e);
114             }
115 
116             return (com.liferay.portlet.tags.model.TagsProperty)returnObj;
117         }
118         catch (com.liferay.portal.SystemException se) {
119             _log.error(se, se);
120 
121             throw se;
122         }
123     }
124 
125     public static com.liferay.portlet.tags.model.TagsProperty addProperty(
126         HttpPrincipal httpPrincipal, java.lang.String entryName,
127         java.lang.String key, java.lang.String value)
128         throws com.liferay.portal.SystemException,
129             com.liferay.portal.PortalException {
130         try {
131             Object paramObj0 = entryName;
132 
133             if (entryName == null) {
134                 paramObj0 = new NullWrapper("java.lang.String");
135             }
136 
137             Object paramObj1 = key;
138 
139             if (key == null) {
140                 paramObj1 = new NullWrapper("java.lang.String");
141             }
142 
143             Object paramObj2 = value;
144 
145             if (value == null) {
146                 paramObj2 = new NullWrapper("java.lang.String");
147             }
148 
149             MethodWrapper methodWrapper = new MethodWrapper(TagsPropertyServiceUtil.class.getName(),
150                     "addProperty",
151                     new Object[] { paramObj0, paramObj1, paramObj2 });
152 
153             Object returnObj = null;
154 
155             try {
156                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
157             }
158             catch (Exception e) {
159                 if (e instanceof com.liferay.portal.SystemException) {
160                     throw (com.liferay.portal.SystemException)e;
161                 }
162 
163                 if (e instanceof com.liferay.portal.PortalException) {
164                     throw (com.liferay.portal.PortalException)e;
165                 }
166 
167                 throw new com.liferay.portal.SystemException(e);
168             }
169 
170             return (com.liferay.portlet.tags.model.TagsProperty)returnObj;
171         }
172         catch (com.liferay.portal.SystemException se) {
173             _log.error(se, se);
174 
175             throw se;
176         }
177     }
178 
179     public static void deleteProperty(HttpPrincipal httpPrincipal,
180         long propertyId)
181         throws com.liferay.portal.SystemException,
182             com.liferay.portal.PortalException {
183         try {
184             Object paramObj0 = new LongWrapper(propertyId);
185 
186             MethodWrapper methodWrapper = new MethodWrapper(TagsPropertyServiceUtil.class.getName(),
187                     "deleteProperty", new Object[] { paramObj0 });
188 
189             try {
190                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
191             }
192             catch (Exception e) {
193                 if (e instanceof com.liferay.portal.SystemException) {
194                     throw (com.liferay.portal.SystemException)e;
195                 }
196 
197                 if (e instanceof com.liferay.portal.PortalException) {
198                     throw (com.liferay.portal.PortalException)e;
199                 }
200 
201                 throw new com.liferay.portal.SystemException(e);
202             }
203         }
204         catch (com.liferay.portal.SystemException se) {
205             _log.error(se, se);
206 
207             throw se;
208         }
209     }
210 
211     public static java.util.List<com.liferay.portlet.tags.model.TagsProperty> getProperties(
212         HttpPrincipal httpPrincipal, long entryId)
213         throws com.liferay.portal.SystemException {
214         try {
215             Object paramObj0 = new LongWrapper(entryId);
216 
217             MethodWrapper methodWrapper = new MethodWrapper(TagsPropertyServiceUtil.class.getName(),
218                     "getProperties", new Object[] { paramObj0 });
219 
220             Object returnObj = null;
221 
222             try {
223                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
224             }
225             catch (Exception e) {
226                 if (e instanceof com.liferay.portal.SystemException) {
227                     throw (com.liferay.portal.SystemException)e;
228                 }
229 
230                 throw new com.liferay.portal.SystemException(e);
231             }
232 
233             return (java.util.List<com.liferay.portlet.tags.model.TagsProperty>)returnObj;
234         }
235         catch (com.liferay.portal.SystemException se) {
236             _log.error(se, se);
237 
238             throw se;
239         }
240     }
241 
242     public static java.util.List<com.liferay.portlet.tags.model.TagsProperty> getPropertyValues(
243         HttpPrincipal httpPrincipal, long companyId, java.lang.String key)
244         throws com.liferay.portal.SystemException {
245         try {
246             Object paramObj0 = new LongWrapper(companyId);
247 
248             Object paramObj1 = key;
249 
250             if (key == null) {
251                 paramObj1 = new NullWrapper("java.lang.String");
252             }
253 
254             MethodWrapper methodWrapper = new MethodWrapper(TagsPropertyServiceUtil.class.getName(),
255                     "getPropertyValues", new Object[] { paramObj0, paramObj1 });
256 
257             Object returnObj = null;
258 
259             try {
260                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
261             }
262             catch (Exception e) {
263                 if (e instanceof com.liferay.portal.SystemException) {
264                     throw (com.liferay.portal.SystemException)e;
265                 }
266 
267                 throw new com.liferay.portal.SystemException(e);
268             }
269 
270             return (java.util.List<com.liferay.portlet.tags.model.TagsProperty>)returnObj;
271         }
272         catch (com.liferay.portal.SystemException se) {
273             _log.error(se, se);
274 
275             throw se;
276         }
277     }
278 
279     public static com.liferay.portlet.tags.model.TagsProperty updateProperty(
280         HttpPrincipal httpPrincipal, long propertyId, java.lang.String key,
281         java.lang.String value)
282         throws com.liferay.portal.SystemException,
283             com.liferay.portal.PortalException {
284         try {
285             Object paramObj0 = new LongWrapper(propertyId);
286 
287             Object paramObj1 = key;
288 
289             if (key == null) {
290                 paramObj1 = new NullWrapper("java.lang.String");
291             }
292 
293             Object paramObj2 = value;
294 
295             if (value == null) {
296                 paramObj2 = new NullWrapper("java.lang.String");
297             }
298 
299             MethodWrapper methodWrapper = new MethodWrapper(TagsPropertyServiceUtil.class.getName(),
300                     "updateProperty",
301                     new Object[] { paramObj0, paramObj1, paramObj2 });
302 
303             Object returnObj = null;
304 
305             try {
306                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
307             }
308             catch (Exception e) {
309                 if (e instanceof com.liferay.portal.SystemException) {
310                     throw (com.liferay.portal.SystemException)e;
311                 }
312 
313                 if (e instanceof com.liferay.portal.PortalException) {
314                     throw (com.liferay.portal.PortalException)e;
315                 }
316 
317                 throw new com.liferay.portal.SystemException(e);
318             }
319 
320             return (com.liferay.portlet.tags.model.TagsProperty)returnObj;
321         }
322         catch (com.liferay.portal.SystemException se) {
323             _log.error(se, se);
324 
325             throw se;
326         }
327     }
328 
329     private static Log _log = LogFactoryUtil.getLog(TagsPropertyServiceHttp.class);
330 }