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