1   /**
2    * Copyright (c) 2000-2007 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 overwritten
40   * the next time is generated.
41   * </p>
42   *
43   * <p>
44   * This class provides a HTTP utility for the <code>com.liferay.portlet.tags.service.TagsPropertyServiceUtil</code>
45   * service utility. The static methods of this class calls the same methods of the
46   * service utility. However, the signatures are different because it requires an
47   * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code> parameter.
48   * </p>
49   *
50   * <p>
51   * The benefits of using the HTTP utility is that it is fast and allows for tunneling
52   * without the cost of serializing to text. The drawback is that it only works with
53   * Java.
54   * </p>
55   *
56   * <p>
57   * Set the property <code>tunnel.servlet.hosts.allowed</code> in portal.properties
58   * to configure security.
59   * </p>
60   *
61   * <p>
62   * The HTTP utility is only generated for remote services.
63   * </p>
64   *
65   * @author Brian Wing Shun Chan
66   *
67   * @see com.liferay.portal.security.auth.HttpPrincipal
68   * @see com.liferay.portlet.tags.service.TagsPropertyServiceUtil
69   * @see com.liferay.portlet.tags.service.http.TagsPropertyServiceSoap
70   *
71   */
72  public class TagsPropertyServiceHttp {
73      public static com.liferay.portlet.tags.model.TagsProperty addProperty(
74          HttpPrincipal httpPrincipal, long entryId, java.lang.String key,
75          java.lang.String value)
76          throws com.liferay.portal.SystemException, 
77              com.liferay.portal.PortalException {
78          try {
79              Object paramObj0 = new LongWrapper(entryId);
80              Object paramObj1 = key;
81  
82              if (key == null) {
83                  paramObj1 = new NullWrapper("java.lang.String");
84              }
85  
86              Object paramObj2 = value;
87  
88              if (value == null) {
89                  paramObj2 = new NullWrapper("java.lang.String");
90              }
91  
92              MethodWrapper methodWrapper = new MethodWrapper(TagsPropertyServiceUtil.class.getName(),
93                      "addProperty",
94                      new Object[] { paramObj0, paramObj1, paramObj2 });
95              Object returnObj = null;
96  
97              try {
98                  returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
99              }
100             catch (Exception e) {
101                 if (e instanceof com.liferay.portal.SystemException) {
102                     throw (com.liferay.portal.SystemException)e;
103                 }
104 
105                 if (e instanceof com.liferay.portal.PortalException) {
106                     throw (com.liferay.portal.PortalException)e;
107                 }
108 
109                 throw new com.liferay.portal.SystemException(e);
110             }
111 
112             return (com.liferay.portlet.tags.model.TagsProperty)returnObj;
113         }
114         catch (com.liferay.portal.SystemException se) {
115             _log.error(se, se);
116             throw se;
117         }
118     }
119 
120     public static com.liferay.portlet.tags.model.TagsProperty addProperty(
121         HttpPrincipal httpPrincipal, java.lang.String entryName,
122         java.lang.String key, java.lang.String value)
123         throws com.liferay.portal.SystemException, 
124             com.liferay.portal.PortalException {
125         try {
126             Object paramObj0 = entryName;
127 
128             if (entryName == null) {
129                 paramObj0 = new NullWrapper("java.lang.String");
130             }
131 
132             Object paramObj1 = key;
133 
134             if (key == null) {
135                 paramObj1 = new NullWrapper("java.lang.String");
136             }
137 
138             Object paramObj2 = value;
139 
140             if (value == null) {
141                 paramObj2 = new NullWrapper("java.lang.String");
142             }
143 
144             MethodWrapper methodWrapper = new MethodWrapper(TagsPropertyServiceUtil.class.getName(),
145                     "addProperty",
146                     new Object[] { paramObj0, paramObj1, paramObj2 });
147             Object returnObj = null;
148 
149             try {
150                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
151             }
152             catch (Exception e) {
153                 if (e instanceof com.liferay.portal.SystemException) {
154                     throw (com.liferay.portal.SystemException)e;
155                 }
156 
157                 if (e instanceof com.liferay.portal.PortalException) {
158                     throw (com.liferay.portal.PortalException)e;
159                 }
160 
161                 throw new com.liferay.portal.SystemException(e);
162             }
163 
164             return (com.liferay.portlet.tags.model.TagsProperty)returnObj;
165         }
166         catch (com.liferay.portal.SystemException se) {
167             _log.error(se, se);
168             throw se;
169         }
170     }
171 
172     public static void deleteProperty(HttpPrincipal httpPrincipal,
173         long propertyId)
174         throws com.liferay.portal.SystemException, 
175             com.liferay.portal.PortalException {
176         try {
177             Object paramObj0 = new LongWrapper(propertyId);
178             MethodWrapper methodWrapper = new MethodWrapper(TagsPropertyServiceUtil.class.getName(),
179                     "deleteProperty", new Object[] { paramObj0 });
180 
181             try {
182                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
183             }
184             catch (Exception e) {
185                 if (e instanceof com.liferay.portal.SystemException) {
186                     throw (com.liferay.portal.SystemException)e;
187                 }
188 
189                 if (e instanceof com.liferay.portal.PortalException) {
190                     throw (com.liferay.portal.PortalException)e;
191                 }
192 
193                 throw new com.liferay.portal.SystemException(e);
194             }
195         }
196         catch (com.liferay.portal.SystemException se) {
197             _log.error(se, se);
198             throw se;
199         }
200     }
201 
202     public static java.util.List getProperties(HttpPrincipal httpPrincipal,
203         long entryId) throws com.liferay.portal.SystemException {
204         try {
205             Object paramObj0 = new LongWrapper(entryId);
206             MethodWrapper methodWrapper = new MethodWrapper(TagsPropertyServiceUtil.class.getName(),
207                     "getProperties", new Object[] { paramObj0 });
208             Object returnObj = null;
209 
210             try {
211                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
212             }
213             catch (Exception e) {
214                 if (e instanceof com.liferay.portal.SystemException) {
215                     throw (com.liferay.portal.SystemException)e;
216                 }
217 
218                 throw new com.liferay.portal.SystemException(e);
219             }
220 
221             return (java.util.List)returnObj;
222         }
223         catch (com.liferay.portal.SystemException se) {
224             _log.error(se, se);
225             throw se;
226         }
227     }
228 
229     public static java.util.List getPropertyValues(
230         HttpPrincipal httpPrincipal, long companyId, java.lang.String key)
231         throws com.liferay.portal.SystemException {
232         try {
233             Object paramObj0 = new LongWrapper(companyId);
234             Object paramObj1 = key;
235 
236             if (key == null) {
237                 paramObj1 = new NullWrapper("java.lang.String");
238             }
239 
240             MethodWrapper methodWrapper = new MethodWrapper(TagsPropertyServiceUtil.class.getName(),
241                     "getPropertyValues", new Object[] { paramObj0, paramObj1 });
242             Object returnObj = null;
243 
244             try {
245                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
246             }
247             catch (Exception e) {
248                 if (e instanceof com.liferay.portal.SystemException) {
249                     throw (com.liferay.portal.SystemException)e;
250                 }
251 
252                 throw new com.liferay.portal.SystemException(e);
253             }
254 
255             return (java.util.List)returnObj;
256         }
257         catch (com.liferay.portal.SystemException se) {
258             _log.error(se, se);
259             throw se;
260         }
261     }
262 
263     public static com.liferay.portlet.tags.model.TagsProperty updateProperty(
264         HttpPrincipal httpPrincipal, long propertyId, java.lang.String key,
265         java.lang.String value)
266         throws com.liferay.portal.SystemException, 
267             com.liferay.portal.PortalException {
268         try {
269             Object paramObj0 = new LongWrapper(propertyId);
270             Object paramObj1 = key;
271 
272             if (key == null) {
273                 paramObj1 = new NullWrapper("java.lang.String");
274             }
275 
276             Object paramObj2 = value;
277 
278             if (value == null) {
279                 paramObj2 = new NullWrapper("java.lang.String");
280             }
281 
282             MethodWrapper methodWrapper = new MethodWrapper(TagsPropertyServiceUtil.class.getName(),
283                     "updateProperty",
284                     new Object[] { paramObj0, paramObj1, paramObj2 });
285             Object returnObj = null;
286 
287             try {
288                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
289             }
290             catch (Exception e) {
291                 if (e instanceof com.liferay.portal.SystemException) {
292                     throw (com.liferay.portal.SystemException)e;
293                 }
294 
295                 if (e instanceof com.liferay.portal.PortalException) {
296                     throw (com.liferay.portal.PortalException)e;
297                 }
298 
299                 throw new com.liferay.portal.SystemException(e);
300             }
301 
302             return (com.liferay.portlet.tags.model.TagsProperty)returnObj;
303         }
304         catch (com.liferay.portal.SystemException se) {
305             _log.error(se, se);
306             throw se;
307         }
308     }
309 
310     private static Log _log = LogFactoryUtil.getLog(TagsPropertyServiceHttp.class);
311 }