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 getProperties(HttpPrincipal httpPrincipal,
212         long entryId) throws com.liferay.portal.SystemException {
213         try {
214             Object paramObj0 = new LongWrapper(entryId);
215 
216             MethodWrapper methodWrapper = new MethodWrapper(TagsPropertyServiceUtil.class.getName(),
217                     "getProperties", new Object[] { paramObj0 });
218 
219             Object returnObj = null;
220 
221             try {
222                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
223             }
224             catch (Exception e) {
225                 if (e instanceof com.liferay.portal.SystemException) {
226                     throw (com.liferay.portal.SystemException)e;
227                 }
228 
229                 throw new com.liferay.portal.SystemException(e);
230             }
231 
232             return (java.util.List)returnObj;
233         }
234         catch (com.liferay.portal.SystemException se) {
235             _log.error(se, se);
236 
237             throw se;
238         }
239     }
240 
241     public static java.util.List getPropertyValues(
242         HttpPrincipal httpPrincipal, long companyId, java.lang.String key)
243         throws com.liferay.portal.SystemException {
244         try {
245             Object paramObj0 = new LongWrapper(companyId);
246 
247             Object paramObj1 = key;
248 
249             if (key == null) {
250                 paramObj1 = new NullWrapper("java.lang.String");
251             }
252 
253             MethodWrapper methodWrapper = new MethodWrapper(TagsPropertyServiceUtil.class.getName(),
254                     "getPropertyValues", new Object[] { paramObj0, paramObj1 });
255 
256             Object returnObj = null;
257 
258             try {
259                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
260             }
261             catch (Exception e) {
262                 if (e instanceof com.liferay.portal.SystemException) {
263                     throw (com.liferay.portal.SystemException)e;
264                 }
265 
266                 throw new com.liferay.portal.SystemException(e);
267             }
268 
269             return (java.util.List)returnObj;
270         }
271         catch (com.liferay.portal.SystemException se) {
272             _log.error(se, se);
273 
274             throw se;
275         }
276     }
277 
278     public static com.liferay.portlet.tags.model.TagsProperty updateProperty(
279         HttpPrincipal httpPrincipal, long propertyId, java.lang.String key,
280         java.lang.String value)
281         throws com.liferay.portal.SystemException, 
282             com.liferay.portal.PortalException {
283         try {
284             Object paramObj0 = new LongWrapper(propertyId);
285 
286             Object paramObj1 = key;
287 
288             if (key == null) {
289                 paramObj1 = new NullWrapper("java.lang.String");
290             }
291 
292             Object paramObj2 = value;
293 
294             if (value == null) {
295                 paramObj2 = new NullWrapper("java.lang.String");
296             }
297 
298             MethodWrapper methodWrapper = new MethodWrapper(TagsPropertyServiceUtil.class.getName(),
299                     "updateProperty",
300                     new Object[] { paramObj0, paramObj1, paramObj2 });
301 
302             Object returnObj = null;
303 
304             try {
305                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
306             }
307             catch (Exception e) {
308                 if (e instanceof com.liferay.portal.SystemException) {
309                     throw (com.liferay.portal.SystemException)e;
310                 }
311 
312                 if (e instanceof com.liferay.portal.PortalException) {
313                     throw (com.liferay.portal.PortalException)e;
314                 }
315 
316                 throw new com.liferay.portal.SystemException(e);
317             }
318 
319             return (com.liferay.portlet.tags.model.TagsProperty)returnObj;
320         }
321         catch (com.liferay.portal.SystemException se) {
322             _log.error(se, se);
323 
324             throw se;
325         }
326     }
327 
328     private static Log _log = LogFactoryUtil.getLog(TagsPropertyServiceHttp.class);
329 }