1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet.polls.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.security.auth.HttpPrincipal;
22  import com.liferay.portal.service.http.TunnelUtil;
23  
24  import com.liferay.portlet.polls.service.PollsVoteServiceUtil;
25  
26  /**
27   * <a href="PollsVoteServiceHttp.java.html"><b><i>View Source</i></b></a>
28   *
29   * <p>
30   * ServiceBuilder generated this class. Modifications in this class will be
31   * overwritten the next time is generated.
32   * </p>
33   *
34   * <p>
35   * This class provides a HTTP utility for the
36   * {@link com.liferay.portlet.polls.service.PollsVoteServiceUtil} service utility. The
37   * static methods of this class calls the same methods of the service utility.
38   * However, the signatures are different because it requires an additional
39   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
40   * </p>
41   *
42   * <p>
43   * The benefits of using the HTTP utility is that it is fast and allows for
44   * tunneling without the cost of serializing to text. The drawback is that it
45   * only works with Java.
46   * </p>
47   *
48   * <p>
49   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
50   * configure security.
51   * </p>
52   *
53   * <p>
54   * The HTTP utility is only generated for remote services.
55   * </p>
56   *
57   * @author    Brian Wing Shun Chan
58   * @see       PollsVoteServiceSoap
59   * @see       com.liferay.portal.security.auth.HttpPrincipal
60   * @see       com.liferay.portlet.polls.service.PollsVoteServiceUtil
61   * @generated
62   */
63  public class PollsVoteServiceHttp {
64      public static com.liferay.portlet.polls.model.PollsVote addVote(
65          HttpPrincipal httpPrincipal, long questionId, long choiceId)
66          throws com.liferay.portal.kernel.exception.PortalException,
67              com.liferay.portal.kernel.exception.SystemException {
68          try {
69              Object paramObj0 = new LongWrapper(questionId);
70  
71              Object paramObj1 = new LongWrapper(choiceId);
72  
73              MethodWrapper methodWrapper = new MethodWrapper(PollsVoteServiceUtil.class.getName(),
74                      "addVote", new Object[] { paramObj0, paramObj1 });
75  
76              Object returnObj = null;
77  
78              try {
79                  returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
80              }
81              catch (Exception e) {
82                  if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
83                      throw (com.liferay.portal.kernel.exception.PortalException)e;
84                  }
85  
86                  if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
87                      throw (com.liferay.portal.kernel.exception.SystemException)e;
88                  }
89  
90                  throw new com.liferay.portal.kernel.exception.SystemException(e);
91              }
92  
93              return (com.liferay.portlet.polls.model.PollsVote)returnObj;
94          }
95          catch (com.liferay.portal.kernel.exception.SystemException se) {
96              _log.error(se, se);
97  
98              throw se;
99          }
100     }
101 
102     private static Log _log = LogFactoryUtil.getLog(PollsVoteServiceHttp.class);
103 }