r3879 - in trunk/pollen-persistence/src/main: java/org/chorem/pollen/persistence/entity xmi
Author: tchemit Date: 2014-04-26 21:20:22 +0200 (Sat, 26 Apr 2014) New Revision: 3879 Url: http://forge.chorem.org/projects/pollen/repository/revisions/3879 Log: refs #885 Removed: trunk/pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/PollImpl.java trunk/pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/PollenUserImpl.java Modified: trunk/pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/Polls.java trunk/pollen-persistence/src/main/xmi/pollen.properties Deleted: trunk/pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/PollImpl.java =================================================================== --- trunk/pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/PollImpl.java 2014-04-25 17:14:38 UTC (rev 3878) +++ trunk/pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/PollImpl.java 2014-04-26 19:20:22 UTC (rev 3879) @@ -1,107 +0,0 @@ -package org.chorem.pollen.persistence.entity; - -/* - * #%L - * Pollen :: Persistence - * $Id$ - * $HeadURL: http://svn.chorem.org/svn/pollen/trunk/pollen-persistence/src/main/java/org/... $ - * %% - * Copyright (C) 2009 - 2013 CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * #L% - */ - -import com.google.common.collect.Sets; - -import java.util.Date; -import java.util.Set; - -/** - * TODO - * - * @author tchemit <chemit@codelutin.com> - * @since 2.0 - */ -public class PollImpl extends PollAbstract { - - private static final long serialVersionUID = 1L; - - //FIXME Remove this - public boolean isFreePoll() { - return Polls.isPollFree(this); - } - - //FIXME Remove this - public boolean isRestrictedPoll() { - return Polls.isPollRestricted(this); - } - - //FIXME Remove this - public boolean isGroupPoll() { - return Polls.isPollGroup(this); - } - - //FIXME Remove this - public boolean isStarted(Date currentDate) { - return beginDate == null || beginDate.before(currentDate); - } - - //FIXME Remove this - public boolean isRunning(Date currentDate) { - return !isClosed() && - isStarted(currentDate) && - !isFinished(currentDate); - } - - //FIXME Remove this - public boolean isFinished(Date currentDate) { - return endDate != null && currentDate.after(endDate); - } - - //FIXME Remove this - public boolean isAddChoiceStarted(Date currentDate) { - return isChoiceAddAllowed() && - (beginChoiceDate == null || beginChoiceDate.before(currentDate)); - } - - //FIXME Remove this - public boolean isAddChoiceRunning(Date currentDate) { - return isChoiceAddAllowed() && - !isClosed() && - !isFinished(currentDate) && - isAddChoiceStarted(currentDate) && - !isAddChoiceFinished(currentDate); - } - - //FIXME Remove this - public boolean isAddChoiceFinished(Date currentDate) { - return !isChoiceAddAllowed() || - (endChoiceDate != null && endChoiceDate.before(currentDate)); - } - - //FIXME Remove this - public Set<VoterListMember> getAllVoters() { - Set<VoterListMember> result = Sets.newHashSet(); - if (!isVoterListEmpty()) { - for (VoterList list : getVoterList()) { - - if (!list.isVoterListMemberEmpty()) { - result.addAll(list.getVoterListMember()); - } - } - } - return result; - } -} Deleted: trunk/pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/PollenUserImpl.java =================================================================== --- trunk/pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/PollenUserImpl.java 2014-04-25 17:14:38 UTC (rev 3878) +++ trunk/pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/PollenUserImpl.java 2014-04-26 19:20:22 UTC (rev 3879) @@ -1,40 +0,0 @@ -package org.chorem.pollen.persistence.entity; - -/* - * #%L - * Pollen :: Persistence - * $Id$ - * $HeadURL: http://svn.chorem.org/svn/pollen/trunk/pollen-persistence/src/main/java/org/... $ - * %% - * Copyright (C) 2009 - 2013 CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * #L% - */ - -/** - * TODO - * - * @author tchemit <chemit@codelutin.com> - * @since 2.0 - */ -public class PollenUserImpl extends PollenUserAbstract { - - private static final long serialVersionUID = 1L; - - public boolean isEmailActivated() { - return emailActivationToken == null; - } - -} Modified: trunk/pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/Polls.java =================================================================== --- trunk/pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/Polls.java 2014-04-25 17:14:38 UTC (rev 3878) +++ trunk/pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/Polls.java 2014-04-26 19:20:22 UTC (rev 3879) @@ -54,6 +54,37 @@ return beginDate == null || beginDate.before(currentDate); } + public boolean isRunning(Poll poll, Date currentDate) { + return !poll.isClosed() && + isStarted(poll, currentDate) && + !isFinished(poll, currentDate); + } + + public boolean isFinished(Poll poll, Date currentDate) { + Date endDate = poll.getEndDate(); + return endDate != null && currentDate.after(endDate); + } + + public boolean isAddChoiceStarted(Poll poll, Date currentDate) { + Date beginChoiceDate = poll.getBeginChoiceDate(); + return poll.isChoiceAddAllowed() && + (beginChoiceDate == null || beginChoiceDate.before(currentDate)); + } + + public boolean isAddChoiceRunning(Poll poll, Date currentDate) { + return poll.isChoiceAddAllowed() && + !poll.isClosed() && + !isFinished(poll, currentDate) && + isAddChoiceStarted(poll, currentDate) && + !isAddChoiceFinished(poll, currentDate); + } + + public boolean isAddChoiceFinished(Poll poll, Date currentDate) { + Date endChoiceDate = poll.getEndChoiceDate(); + return !poll.isChoiceAddAllowed() || + (endChoiceDate != null && endChoiceDate.before(currentDate)); + } + public static Set<VoterListMember> getAllVoters(Poll poll) { Set<VoterListMember> result = Sets.newHashSet(); if (poll.isVoterListNotEmpty()) { Modified: trunk/pollen-persistence/src/main/xmi/pollen.properties =================================================================== --- trunk/pollen-persistence/src/main/xmi/pollen.properties 2014-04-25 17:14:38 UTC (rev 3878) +++ trunk/pollen-persistence/src/main/xmi/pollen.properties 2014-04-26 19:20:22 UTC (rev 3879) @@ -25,7 +25,7 @@ model.tagValue.constantPrefix=PROPERTY_ model.tagValue.useEnumerationName=true model.tagValue.indexForeignKeys=true -model.tagValue.String=string +model.tagValue.hibernateAttributeType.String=string org.chorem.pollen.persistence.entity.Poll.attribute.choice.stereotype=ordered org.chorem.pollen.persistence.entity.Poll.attribute.voterList.stereotype=ordered
participants (1)
-
tchemit@users.chorem.org