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.polls.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.security.auth.HttpPrincipal;
30  import com.liferay.portal.service.http.TunnelUtil;
31  
32  import com.liferay.portlet.polls.service.PollsVoteServiceUtil;
33  
34  /**
35   * <a href="PollsVoteServiceHttp.java.html"><b><i>View Source</i></b></a>
36   *
37   * <p>
38   * ServiceBuilder generated this class. Modifications in this class will be
39   * overwritten the next time is generated.
40   * </p>
41   *
42   * <p>
43   * This class provides a HTTP utility for the
44   * {@link com.liferay.portlet.polls.service.PollsVoteServiceUtil} service utility. The
45   * static methods of this class calls the same methods of the service utility.
46   * However, the signatures are different because it requires an additional
47   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
48   * </p>
49   *
50   * <p>
51   * The benefits of using the HTTP utility is that it is fast and allows for
52   * tunneling without the cost of serializing to text. The drawback is that it
53   * only works with Java.
54   * </p>
55   *
56   * <p>
57   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
58   * configure security.
59   * </p>
60   *
61   * <p>
62   * The HTTP utility is only generated for remote services.
63   * </p>
64   *
65   * @author    Brian Wing Shun Chan
66   * @see       PollsVoteServiceSoap
67   * @see       com.liferay.portal.security.auth.HttpPrincipal
68   * @see       com.liferay.portlet.polls.service.PollsVoteServiceUtil
69   * @generated
70   */
71  public class PollsVoteServiceHttp {
72      public static com.liferay.portlet.polls.model.PollsVote addVote(
73          HttpPrincipal httpPrincipal, long questionId, long choiceId)
74          throws com.liferay.portal.PortalException,
75              com.liferay.portal.SystemException {
76          try {
77              Object paramObj0 = new LongWrapper(questionId);
78  
79              Object paramObj1 = new LongWrapper(choiceId);
80  
81              MethodWrapper methodWrapper = new MethodWrapper(PollsVoteServiceUtil.class.getName(),
82                      "addVote", new Object[] { paramObj0, paramObj1 });
83  
84              Object returnObj = null;
85  
86              try {
87                  returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
88              }
89              catch (Exception e) {
90                  if (e instanceof com.liferay.portal.PortalException) {
91                      throw (com.liferay.portal.PortalException)e;
92                  }
93  
94                  if (e instanceof com.liferay.portal.SystemException) {
95                      throw (com.liferay.portal.SystemException)e;
96                  }
97  
98                  throw new com.liferay.portal.SystemException(e);
99              }
100 
101             return (com.liferay.portlet.polls.model.PollsVote)returnObj;
102         }
103         catch (com.liferay.portal.SystemException se) {
104             _log.error(se, se);
105 
106             throw se;
107         }
108     }
109 
110     private static Log _log = LogFactoryUtil.getLog(PollsVoteServiceHttp.class);
111 }