1   /**
2    * Copyright (c) 2000-2009 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.PortalException,
79              com.liferay.portal.SystemException {
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.PortalException) {
106                     throw (com.liferay.portal.PortalException)e;
107                 }
108 
109                 if (e instanceof com.liferay.portal.SystemException) {
110                     throw (com.liferay.portal.SystemException)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 void deleteProperty(HttpPrincipal httpPrincipal,
126         long propertyId)
127         throws com.liferay.portal.PortalException,
128             com.liferay.portal.SystemException {
129         try {
130             Object paramObj0 = new LongWrapper(propertyId);
131 
132             MethodWrapper methodWrapper = new MethodWrapper(TagsPropertyServiceUtil.class.getName(),
133                     "deleteProperty", new Object[] { paramObj0 });
134 
135             try {
136                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
137             }
138             catch (Exception e) {
139                 if (e instanceof com.liferay.portal.PortalException) {
140                     throw (com.liferay.portal.PortalException)e;
141                 }
142 
143                 if (e instanceof com.liferay.portal.SystemException) {
144                     throw (com.liferay.portal.SystemException)e;
145                 }
146 
147                 throw new com.liferay.portal.SystemException(e);
148             }
149         }
150         catch (com.liferay.portal.SystemException se) {
151             _log.error(se, se);
152 
153             throw se;
154         }
155     }
156 
157     public static java.util.List<com.liferay.portlet.tags.model.TagsProperty> getProperties(
158         HttpPrincipal httpPrincipal, long entryId)
159         throws com.liferay.portal.SystemException {
160         try {
161             Object paramObj0 = new LongWrapper(entryId);
162 
163             MethodWrapper methodWrapper = new MethodWrapper(TagsPropertyServiceUtil.class.getName(),
164                     "getProperties", new Object[] { paramObj0 });
165 
166             Object returnObj = null;
167 
168             try {
169                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
170             }
171             catch (Exception e) {
172                 if (e instanceof com.liferay.portal.SystemException) {
173                     throw (com.liferay.portal.SystemException)e;
174                 }
175 
176                 throw new com.liferay.portal.SystemException(e);
177             }
178 
179             return (java.util.List<com.liferay.portlet.tags.model.TagsProperty>)returnObj;
180         }
181         catch (com.liferay.portal.SystemException se) {
182             _log.error(se, se);
183 
184             throw se;
185         }
186     }
187 
188     public static java.util.List<com.liferay.portlet.tags.model.TagsProperty> getPropertyValues(
189         HttpPrincipal httpPrincipal, long companyId, java.lang.String key)
190         throws com.liferay.portal.SystemException {
191         try {
192             Object paramObj0 = new LongWrapper(companyId);
193 
194             Object paramObj1 = key;
195 
196             if (key == null) {
197                 paramObj1 = new NullWrapper("java.lang.String");
198             }
199 
200             MethodWrapper methodWrapper = new MethodWrapper(TagsPropertyServiceUtil.class.getName(),
201                     "getPropertyValues", new Object[] { paramObj0, paramObj1 });
202 
203             Object returnObj = null;
204 
205             try {
206                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
207             }
208             catch (Exception e) {
209                 if (e instanceof com.liferay.portal.SystemException) {
210                     throw (com.liferay.portal.SystemException)e;
211                 }
212 
213                 throw new com.liferay.portal.SystemException(e);
214             }
215 
216             return (java.util.List<com.liferay.portlet.tags.model.TagsProperty>)returnObj;
217         }
218         catch (com.liferay.portal.SystemException se) {
219             _log.error(se, se);
220 
221             throw se;
222         }
223     }
224 
225     public static com.liferay.portlet.tags.model.TagsProperty updateProperty(
226         HttpPrincipal httpPrincipal, long propertyId, java.lang.String key,
227         java.lang.String value)
228         throws com.liferay.portal.PortalException,
229             com.liferay.portal.SystemException {
230         try {
231             Object paramObj0 = new LongWrapper(propertyId);
232 
233             Object paramObj1 = key;
234 
235             if (key == null) {
236                 paramObj1 = new NullWrapper("java.lang.String");
237             }
238 
239             Object paramObj2 = value;
240 
241             if (value == null) {
242                 paramObj2 = new NullWrapper("java.lang.String");
243             }
244 
245             MethodWrapper methodWrapper = new MethodWrapper(TagsPropertyServiceUtil.class.getName(),
246                     "updateProperty",
247                     new Object[] { paramObj0, paramObj1, paramObj2 });
248 
249             Object returnObj = null;
250 
251             try {
252                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
253             }
254             catch (Exception e) {
255                 if (e instanceof com.liferay.portal.PortalException) {
256                     throw (com.liferay.portal.PortalException)e;
257                 }
258 
259                 if (e instanceof com.liferay.portal.SystemException) {
260                     throw (com.liferay.portal.SystemException)e;
261                 }
262 
263                 throw new com.liferay.portal.SystemException(e);
264             }
265 
266             return (com.liferay.portlet.tags.model.TagsProperty)returnObj;
267         }
268         catch (com.liferay.portal.SystemException se) {
269             _log.error(se, se);
270 
271             throw se;
272         }
273     }
274 
275     private static Log _log = LogFactoryUtil.getLog(TagsPropertyServiceHttp.class);
276 }