r3201 - in branches/pollen-1.2.6-struts2/pollen-persistence/src/main: java/org/chorem/pollen/business/persistence xmi
Author: fdesbois Date: 2012-03-22 16:13:57 +0100 (Thu, 22 Mar 2012) New Revision: 3201 Url: http://chorem.org/repositories/revision/pollen/3201 Log: Add some methods in Poll model Modified: branches/pollen-1.2.6-struts2/pollen-persistence/src/main/java/org/chorem/pollen/business/persistence/PollImpl.java branches/pollen-1.2.6-struts2/pollen-persistence/src/main/xmi/pollen.zargo Modified: branches/pollen-1.2.6-struts2/pollen-persistence/src/main/java/org/chorem/pollen/business/persistence/PollImpl.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-persistence/src/main/java/org/chorem/pollen/business/persistence/PollImpl.java 2012-03-22 15:13:51 UTC (rev 3200) +++ branches/pollen-1.2.6-struts2/pollen-persistence/src/main/java/org/chorem/pollen/business/persistence/PollImpl.java 2012-03-22 15:13:57 UTC (rev 3201) @@ -25,6 +25,8 @@ import com.google.common.base.Preconditions; +import java.util.Date; + public class PollImpl extends PollAbstract { private static final long serialVersionUID = 1L; @@ -56,4 +58,35 @@ } return voteId; } + + @Override + public boolean isStarted(Date currentDate) { + return beginDate == null || beginDate.before(currentDate); + } + + @Override + public boolean isRunning(Date currentDate) { + return !isClosed() && isStarted(currentDate) && !isFinished(currentDate); + } + + @Override + public boolean isFinished(Date currentDate) { + return endDate != null && endDate.after(currentDate); + } + + @Override + public boolean isAddChoiceStarted(Date currentDate) { + return choiceAddAllowed && (beginChoiceDate == null || beginChoiceDate.before(currentDate)); + } + + @Override + public boolean isAddChoiceRunning(Date currentDate) { + return isAddChoiceStarted(currentDate) && !isAddChoiceFinished(currentDate); + } + + @Override + public boolean isAddChoiceFinished(Date currentDate) { + return !choiceAddAllowed || (endChoiceDate != null && endChoiceDate.after(currentDate)); + } + } //PollImpl Modified: branches/pollen-1.2.6-struts2/pollen-persistence/src/main/xmi/pollen.zargo =================================================================== (Binary files differ)
participants (1)
-
fdesbois@users.chorem.org