1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   * 
13   */
14  
15  package com.liferay.portlet.tags.service.http;
16  
17  import com.liferay.portal.kernel.log.Log;
18  import com.liferay.portal.kernel.log.LogFactoryUtil;
19  import com.liferay.portal.kernel.util.LongWrapper;
20  import com.liferay.portal.kernel.util.MethodWrapper;
21  import com.liferay.portal.kernel.util.NullWrapper;
22  import com.liferay.portal.security.auth.HttpPrincipal;
23  import com.liferay.portal.service.http.TunnelUtil;
24  
25  import com.liferay.portlet.tags.service.TagsPropertyServiceUtil;
26  
27  /**
28   * <a href="TagsPropertyServiceHttp.java.html"><b><i>View Source</i></b></a>
29   *
30   * <p>
31   * ServiceBuilder generated this class. Modifications in this class will be
32   * overwritten the next time is generated.
33   * </p>
34   *
35   * <p>
36   * This class provides a HTTP utility for the
37   * {@link com.liferay.portlet.tags.service.TagsPropertyServiceUtil} service utility. The
38   * static methods of this class calls the same methods of the service utility.
39   * However, the signatures are different because it requires an additional
40   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
41   * </p>
42   *
43   * <p>
44   * The benefits of using the HTTP utility is that it is fast and allows for
45   * tunneling without the cost of serializing to text. The drawback is that it
46   * only works with Java.
47   * </p>
48   *
49   * <p>
50   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
51   * configure security.
52   * </p>
53   *
54   * <p>
55   * The HTTP utility is only generated for remote services.
56   * </p>
57   *
58   * @author    Brian Wing Shun Chan
59   * @see       TagsPropertyServiceSoap
60   * @see       com.liferay.portal.security.auth.HttpPrincipal
61   * @see       com.liferay.portlet.tags.service.TagsPropertyServiceUtil
62   * @generated
63   */
64  public class TagsPropertyServiceHttp {
65      public static com.liferay.portlet.tags.model.TagsProperty addProperty(
66          HttpPrincipal httpPrincipal, long entryId, java.lang.String key,
67          java.lang.String value)
68          throws com.liferay.portal.PortalException,
69              com.liferay.portal.SystemException {
70          try {
71              Object paramObj0 = new LongWrapper(entryId);
72  
73              Object paramObj1 = key;
74  
75              if (key == null) {
76                  paramObj1 = new NullWrapper("java.lang.String");
77              }
78  
79              Object paramObj2 = value;
80  
81              if (value == null) {
82                  paramObj2 = new NullWrapper("java.lang.String");
83              }
84  
85              MethodWrapper methodWrapper = new MethodWrapper(TagsPropertyServiceUtil.class.getName(),
86                      "addProperty",
87                      new Object[] { paramObj0, paramObj1, paramObj2 });
88  
89              Object returnObj = null;
90  
91              try {
92                  returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
93              }
94              catch (Exception e) {
95                  if (e instanceof com.liferay.portal.PortalException) {
96                      throw (com.liferay.portal.PortalException)e;
97                  }
98  
99                  if (e instanceof com.liferay.portal.SystemException) {
100                     throw (com.liferay.portal.SystemException)e;
101                 }
102 
103                 throw new com.liferay.portal.SystemException(e);
104             }
105 
106             return (com.liferay.portlet.tags.model.TagsProperty)returnObj;
107         }
108         catch (com.liferay.portal.SystemException se) {
109             _log.error(se, se);
110 
111             throw se;
112         }
113     }
114 
115     public static void deleteProperty(HttpPrincipal httpPrincipal,
116         long propertyId)
117         throws com.liferay.portal.PortalException,
118             com.liferay.portal.SystemException {
119         try {
120             Object paramObj0 = new LongWrapper(propertyId);
121 
122             MethodWrapper methodWrapper = new MethodWrapper(TagsPropertyServiceUtil.class.getName(),
123                     "deleteProperty", new Object[] { paramObj0 });
124 
125             try {
126                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
127             }
128             catch (Exception e) {
129                 if (e instanceof com.liferay.portal.PortalException) {
130                     throw (com.liferay.portal.PortalException)e;
131                 }
132 
133                 if (e instanceof com.liferay.portal.SystemException) {
134                     throw (com.liferay.portal.SystemException)e;
135                 }
136 
137                 throw new com.liferay.portal.SystemException(e);
138             }
139         }
140         catch (com.liferay.portal.SystemException se) {
141             _log.error(se, se);
142 
143             throw se;
144         }
145     }
146 
147     public static java.util.List<com.liferay.portlet.tags.model.TagsProperty> getProperties(
148         HttpPrincipal httpPrincipal, long entryId)
149         throws com.liferay.portal.SystemException {
150         try {
151             Object paramObj0 = new LongWrapper(entryId);
152 
153             MethodWrapper methodWrapper = new MethodWrapper(TagsPropertyServiceUtil.class.getName(),
154                     "getProperties", new Object[] { paramObj0 });
155 
156             Object returnObj = null;
157 
158             try {
159                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
160             }
161             catch (Exception e) {
162                 if (e instanceof com.liferay.portal.SystemException) {
163                     throw (com.liferay.portal.SystemException)e;
164                 }
165 
166                 throw new com.liferay.portal.SystemException(e);
167             }
168 
169             return (java.util.List<com.liferay.portlet.tags.model.TagsProperty>)returnObj;
170         }
171         catch (com.liferay.portal.SystemException se) {
172             _log.error(se, se);
173 
174             throw se;
175         }
176     }
177 
178     public static java.util.List<com.liferay.portlet.tags.model.TagsProperty> getPropertyValues(
179         HttpPrincipal httpPrincipal, long companyId, java.lang.String key)
180         throws com.liferay.portal.SystemException {
181         try {
182             Object paramObj0 = new LongWrapper(companyId);
183 
184             Object paramObj1 = key;
185 
186             if (key == null) {
187                 paramObj1 = new NullWrapper("java.lang.String");
188             }
189 
190             MethodWrapper methodWrapper = new MethodWrapper(TagsPropertyServiceUtil.class.getName(),
191                     "getPropertyValues", new Object[] { paramObj0, paramObj1 });
192 
193             Object returnObj = null;
194 
195             try {
196                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
197             }
198             catch (Exception e) {
199                 if (e instanceof com.liferay.portal.SystemException) {
200                     throw (com.liferay.portal.SystemException)e;
201                 }
202 
203                 throw new com.liferay.portal.SystemException(e);
204             }
205 
206             return (java.util.List<com.liferay.portlet.tags.model.TagsProperty>)returnObj;
207         }
208         catch (com.liferay.portal.SystemException se) {
209             _log.error(se, se);
210 
211             throw se;
212         }
213     }
214 
215     public static com.liferay.portlet.tags.model.TagsProperty updateProperty(
216         HttpPrincipal httpPrincipal, long propertyId, java.lang.String key,
217         java.lang.String value)
218         throws com.liferay.portal.PortalException,
219             com.liferay.portal.SystemException {
220         try {
221             Object paramObj0 = new LongWrapper(propertyId);
222 
223             Object paramObj1 = key;
224 
225             if (key == null) {
226                 paramObj1 = new NullWrapper("java.lang.String");
227             }
228 
229             Object paramObj2 = value;
230 
231             if (value == null) {
232                 paramObj2 = new NullWrapper("java.lang.String");
233             }
234 
235             MethodWrapper methodWrapper = new MethodWrapper(TagsPropertyServiceUtil.class.getName(),
236                     "updateProperty",
237                     new Object[] { paramObj0, paramObj1, paramObj2 });
238 
239             Object returnObj = null;
240 
241             try {
242                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
243             }
244             catch (Exception e) {
245                 if (e instanceof com.liferay.portal.PortalException) {
246                     throw (com.liferay.portal.PortalException)e;
247                 }
248 
249                 if (e instanceof com.liferay.portal.SystemException) {
250                     throw (com.liferay.portal.SystemException)e;
251                 }
252 
253                 throw new com.liferay.portal.SystemException(e);
254             }
255 
256             return (com.liferay.portlet.tags.model.TagsProperty)returnObj;
257         }
258         catch (com.liferay.portal.SystemException se) {
259             _log.error(se, se);
260 
261             throw se;
262         }
263     }
264 
265     private static Log _log = LogFactoryUtil.getLog(TagsPropertyServiceHttp.class);
266 }