001
014
015 package com.liferay.portlet.polls.service.http;
016
017 import com.liferay.portal.kernel.log.Log;
018 import com.liferay.portal.kernel.log.LogFactoryUtil;
019 import com.liferay.portal.kernel.util.LongWrapper;
020 import com.liferay.portal.kernel.util.MethodWrapper;
021 import com.liferay.portal.kernel.util.NullWrapper;
022 import com.liferay.portal.security.auth.HttpPrincipal;
023 import com.liferay.portal.service.http.TunnelUtil;
024
025 import com.liferay.portlet.polls.service.PollsVoteServiceUtil;
026
027
057 public class PollsVoteServiceHttp {
058 public static com.liferay.portlet.polls.model.PollsVote addVote(
059 HttpPrincipal httpPrincipal, long questionId, long choiceId,
060 com.liferay.portal.service.ServiceContext serviceContext)
061 throws com.liferay.portal.kernel.exception.PortalException,
062 com.liferay.portal.kernel.exception.SystemException {
063 try {
064 Object paramObj0 = new LongWrapper(questionId);
065
066 Object paramObj1 = new LongWrapper(choiceId);
067
068 Object paramObj2 = serviceContext;
069
070 if (serviceContext == null) {
071 paramObj2 = new NullWrapper(
072 "com.liferay.portal.service.ServiceContext");
073 }
074
075 MethodWrapper methodWrapper = new MethodWrapper(PollsVoteServiceUtil.class.getName(),
076 "addVote", new Object[] { paramObj0, paramObj1, paramObj2 });
077
078 Object returnObj = null;
079
080 try {
081 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
082 }
083 catch (Exception e) {
084 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
085 throw (com.liferay.portal.kernel.exception.PortalException)e;
086 }
087
088 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
089 throw (com.liferay.portal.kernel.exception.SystemException)e;
090 }
091
092 throw new com.liferay.portal.kernel.exception.SystemException(e);
093 }
094
095 return (com.liferay.portlet.polls.model.PollsVote)returnObj;
096 }
097 catch (com.liferay.portal.kernel.exception.SystemException se) {
098 _log.error(se, se);
099
100 throw se;
101 }
102 }
103
104 private static Log _log = LogFactoryUtil.getLog(PollsVoteServiceHttp.class);
105 }