001
014
015 package com.liferay.portlet.polls.action;
016
017 import com.liferay.portal.kernel.util.ParamUtil;
018 import com.liferay.portal.service.ServiceContext;
019 import com.liferay.portal.service.ServiceContextFactory;
020 import com.liferay.portlet.polls.service.PollsVoteServiceUtil;
021 import com.liferay.portlet.polls.util.PollsUtil;
022
023 import javax.portlet.ActionRequest;
024 import javax.portlet.ActionResponse;
025 import javax.portlet.PortletConfig;
026
027
031 public class ViewQuestionAction extends EditQuestionAction {
032
033 @Override
034 protected void updateQuestion(
035 PortletConfig portletConfig, ActionRequest actionRequest,
036 ActionResponse actionResponse)
037 throws Exception {
038
039 long questionId = ParamUtil.getLong(actionRequest, "questionId");
040 long choiceId = ParamUtil.getLong(actionRequest, "choiceId");
041
042 ServiceContext serviceContext = ServiceContextFactory.getInstance(
043 actionRequest);
044
045 PollsVoteServiceUtil.addVote(questionId, choiceId, serviceContext);
046
047 PollsUtil.saveVote(actionRequest, actionResponse, questionId);
048 }
049
050 }