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