1   /**
2    * Copyright (c) 2000-2009 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   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portlet.tags.service.http;
21  
22  import com.liferay.portal.kernel.log.Log;
23  import com.liferay.portal.kernel.log.LogFactoryUtil;
24  import com.liferay.portal.kernel.util.LongWrapper;
25  import com.liferay.portal.kernel.util.MethodWrapper;
26  import com.liferay.portal.kernel.util.NullWrapper;
27  import com.liferay.portal.security.auth.HttpPrincipal;
28  import com.liferay.portal.service.http.TunnelUtil;
29  
30  import com.liferay.portlet.tags.service.TagsPropertyServiceUtil;
31  
32  /**
33   * <a href="TagsPropertyServiceHttp.java.html"><b><i>View Source</i></b></a>
34   *
35   * <p>
36   * ServiceBuilder generated this class. Modifications in this class will be
37   * overwritten the next time is generated.
38   * </p>
39   *
40   * <p>
41   * This class provides a HTTP utility for the
42   * <code>com.liferay.portlet.tags.service.TagsPropertyServiceUtil</code> service
43   * utility. The static methods of this class calls the same methods of the
44   * service utility. However, the signatures are different because it requires an
45   * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code>
46   * parameter.
47   * </p>
48   *
49   * <p>
50   * The benefits of using the HTTP utility is that it is fast and allows for
51   * tunneling without the cost of serializing to text. The drawback is that it
52   * only works with Java.
53   * </p>
54   *
55   * <p>
56   * Set the property <code>tunnel.servlet.hosts.allowed</code> in
57   * portal.properties to configure security.
58   * </p>
59   *
60   * <p>
61   * The HTTP utility is only generated for remote services.
62   * </p>
63   *
64   * @author Brian Wing Shun Chan
65   *
66   * @see com.liferay.portal.security.auth.HttpPrincipal
67   * @see com.liferay.portlet.tags.service.TagsPropertyServiceUtil
68   * @see com.liferay.portlet.tags.service.http.TagsPropertyServiceSoap
69   *
70   */
71  public class TagsPropertyServiceHttp {
72      public static com.liferay.portlet.tags.model.TagsProperty addProperty(
73          HttpPrincipal httpPrincipal, long entryId, java.lang.String key,
74          java.lang.String value)
75          throws com.liferay.portal.PortalException,
76              com.liferay.portal.SystemException {
77          try {
78              Object paramObj0 = new LongWrapper(entryId);
79  
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  
96              Object returnObj = null;
97  
98              try {
99                  returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
100             }
101             catch (Exception e) {
102                 if (e instanceof com.liferay.portal.PortalException) {
103                     throw (com.liferay.portal.PortalException)e;
104                 }
105 
106                 if (e instanceof com.liferay.portal.SystemException) {
107                     throw (com.liferay.portal.SystemException)e;
108                 }
109 
110                 throw new com.liferay.portal.SystemException(e);
111             }
112 
113             return (com.liferay.portlet.tags.model.TagsProperty)returnObj;
114         }
115         catch (com.liferay.portal.SystemException se) {
116             _log.error(se, se);
117 
118             throw se;
119         }
120     }
121 
122     public static com.liferay.portlet.tags.model.TagsProperty addProperty(
123         HttpPrincipal httpPrincipal, java.lang.String entryName,
124         java.lang.String key, java.lang.String value)
125         throws com.liferay.portal.PortalException,
126             com.liferay.portal.SystemException {
127         try {
128             Object paramObj0 = entryName;
129 
130             if (entryName == null) {
131                 paramObj0 = new NullWrapper("java.lang.String");
132             }
133 
134             Object paramObj1 = key;
135 
136             if (key == null) {
137                 paramObj1 = new NullWrapper("java.lang.String");
138             }
139 
140             Object paramObj2 = value;
141 
142             if (value == null) {
143                 paramObj2 = new NullWrapper("java.lang.String");
144             }
145 
146             MethodWrapper methodWrapper = new MethodWrapper(TagsPropertyServiceUtil.class.getName(),
147                     "addProperty",
148                     new Object[] { paramObj0, paramObj1, paramObj2 });
149 
150             Object returnObj = null;
151 
152             try {
153                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
154             }
155             catch (Exception e) {
156                 if (e instanceof com.liferay.portal.PortalException) {
157                     throw (com.liferay.portal.PortalException)e;
158                 }
159 
160                 if (e instanceof com.liferay.portal.SystemException) {
161                     throw (com.liferay.portal.SystemException)e;
162                 }
163 
164                 throw new com.liferay.portal.SystemException(e);
165             }
166 
167             return (com.liferay.portlet.tags.model.TagsProperty)returnObj;
168         }
169         catch (com.liferay.portal.SystemException se) {
170             _log.error(se, se);
171 
172             throw se;
173         }
174     }
175 
176     public static void deleteProperty(HttpPrincipal httpPrincipal,
177         long propertyId)
178         throws com.liferay.portal.PortalException,
179             com.liferay.portal.SystemException {
180         try {
181             Object paramObj0 = new LongWrapper(propertyId);
182 
183             MethodWrapper methodWrapper = new MethodWrapper(TagsPropertyServiceUtil.class.getName(),
184                     "deleteProperty", new Object[] { paramObj0 });
185 
186             try {
187                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
188             }
189             catch (Exception e) {
190                 if (e instanceof com.liferay.portal.PortalException) {
191                     throw (com.liferay.portal.PortalException)e;
192                 }
193 
194                 if (e instanceof com.liferay.portal.SystemException) {
195                     throw (com.liferay.portal.SystemException)e;
196                 }
197 
198                 throw new com.liferay.portal.SystemException(e);
199             }
200         }
201         catch (com.liferay.portal.SystemException se) {
202             _log.error(se, se);
203 
204             throw se;
205         }
206     }
207 
208     public static java.util.List<com.liferay.portlet.tags.model.TagsProperty> getProperties(
209         HttpPrincipal httpPrincipal, long entryId)
210         throws com.liferay.portal.SystemException {
211         try {
212             Object paramObj0 = new LongWrapper(entryId);
213 
214             MethodWrapper methodWrapper = new MethodWrapper(TagsPropertyServiceUtil.class.getName(),
215                     "getProperties", new Object[] { paramObj0 });
216 
217             Object returnObj = null;
218 
219             try {
220                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
221             }
222             catch (Exception e) {
223                 if (e instanceof com.liferay.portal.SystemException) {
224                     throw (com.liferay.portal.SystemException)e;
225                 }
226 
227                 throw new com.liferay.portal.SystemException(e);
228             }
229 
230             return (java.util.List<com.liferay.portlet.tags.model.TagsProperty>)returnObj;
231         }
232         catch (com.liferay.portal.SystemException se) {
233             _log.error(se, se);
234 
235             throw se;
236         }
237     }
238 
239     public static java.util.List<com.liferay.portlet.tags.model.TagsProperty> getPropertyValues(
240         HttpPrincipal httpPrincipal, long companyId, java.lang.String key)
241         throws com.liferay.portal.SystemException {
242         try {
243             Object paramObj0 = new LongWrapper(companyId);
244 
245             Object paramObj1 = key;
246 
247             if (key == null) {
248                 paramObj1 = new NullWrapper("java.lang.String");
249             }
250 
251             MethodWrapper methodWrapper = new MethodWrapper(TagsPropertyServiceUtil.class.getName(),
252                     "getPropertyValues", new Object[] { paramObj0, paramObj1 });
253 
254             Object returnObj = null;
255 
256             try {
257                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
258             }
259             catch (Exception e) {
260                 if (e instanceof com.liferay.portal.SystemException) {
261                     throw (com.liferay.portal.SystemException)e;
262                 }
263 
264                 throw new com.liferay.portal.SystemException(e);
265             }
266 
267             return (java.util.List<com.liferay.portlet.tags.model.TagsProperty>)returnObj;
268         }
269         catch (com.liferay.portal.SystemException se) {
270             _log.error(se, se);
271 
272             throw se;
273         }
274     }
275 
276     public static com.liferay.portlet.tags.model.TagsProperty updateProperty(
277         HttpPrincipal httpPrincipal, long propertyId, java.lang.String key,
278         java.lang.String value)
279         throws com.liferay.portal.PortalException,
280             com.liferay.portal.SystemException {
281         try {
282             Object paramObj0 = new LongWrapper(propertyId);
283 
284             Object paramObj1 = key;
285 
286             if (key == null) {
287                 paramObj1 = new NullWrapper("java.lang.String");
288             }
289 
290             Object paramObj2 = value;
291 
292             if (value == null) {
293                 paramObj2 = new NullWrapper("java.lang.String");
294             }
295 
296             MethodWrapper methodWrapper = new MethodWrapper(TagsPropertyServiceUtil.class.getName(),
297                     "updateProperty",
298                     new Object[] { paramObj0, paramObj1, paramObj2 });
299 
300             Object returnObj = null;
301 
302             try {
303                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
304             }
305             catch (Exception e) {
306                 if (e instanceof com.liferay.portal.PortalException) {
307                     throw (com.liferay.portal.PortalException)e;
308                 }
309 
310                 if (e instanceof com.liferay.portal.SystemException) {
311                     throw (com.liferay.portal.SystemException)e;
312                 }
313 
314                 throw new com.liferay.portal.SystemException(e);
315             }
316 
317             return (com.liferay.portlet.tags.model.TagsProperty)returnObj;
318         }
319         catch (com.liferay.portal.SystemException se) {
320             _log.error(se, se);
321 
322             throw se;
323         }
324     }
325 
326     private static Log _log = LogFactoryUtil.getLog(TagsPropertyServiceHttp.class);
327 }