001
014
015 package com.liferay.portlet.polls.model.impl;
016
017 import com.liferay.portal.kernel.exception.SystemException;
018 import com.liferay.portlet.polls.model.PollsChoice;
019 import com.liferay.portlet.polls.model.PollsQuestion;
020 import com.liferay.portlet.polls.service.PollsChoiceLocalServiceUtil;
021 import com.liferay.portlet.polls.service.PollsVoteLocalServiceUtil;
022
023 import java.util.Date;
024 import java.util.List;
025
026
029 public class PollsQuestionImpl
030 extends PollsQuestionModelImpl implements PollsQuestion {
031
032 public PollsQuestionImpl() {
033 }
034
035 public List<PollsChoice> getChoices() throws SystemException {
036 return PollsChoiceLocalServiceUtil.getChoices(getQuestionId());
037 }
038
039 public int getVotesCount() throws SystemException {
040 return PollsVoteLocalServiceUtil.getQuestionVotesCount(getQuestionId());
041 }
042
043 public boolean isExpired() {
044 Date expirationDate = getExpirationDate();
045
046 if ((expirationDate != null) && (expirationDate.before(new Date()))) {
047 return true;
048 }
049 else {
050 return false;
051 }
052 }
053
054 }