Pollen-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- 3196 discussions
Author: tchemit
Date: 2009-08-25 00:03:54 +0200 (Tue, 25 Aug 2009)
New Revision: 2745
Modified:
trunk/pom.xml
Log:
remove platformName property
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-08-24 22:01:55 UTC (rev 2744)
+++ trunk/pom.xml 2009-08-24 22:03:54 UTC (rev 2745)
@@ -266,7 +266,6 @@
<!-- redmine configuration -->
<platform>chorem.org</platform>
- <platformName>Chorem</platformName>
<projectId>pollen</projectId>
<!-- customized versions -->
1
0
Author: tchemit
Date: 2009-08-25 00:01:55 +0200 (Tue, 25 Aug 2009)
New Revision: 2744
Modified:
trunk/pom.xml
Log:
use mavenpom 1.0.1
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-08-24 21:51:09 UTC (rev 2743)
+++ trunk/pom.xml 2009-08-24 22:01:55 UTC (rev 2744)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom</artifactId>
- <version>1.0.1-SNAPSHOT</version>
+ <version>1.0.1</version>
</parent>
<groupId>org.chorem</groupId>
1
0
Author: tchemit
Date: 2009-08-24 23:51:09 +0200 (Mon, 24 Aug 2009)
New Revision: 2743
Modified:
trunk/pom.xml
Log:
re-use mavenpom 1.0.1 which deals with nuiton or chorem
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-08-24 14:58:18 UTC (rev 2742)
+++ trunk/pom.xml 2009-08-24 21:51:09 UTC (rev 2743)
@@ -8,9 +8,9 @@
<!-- ************************************************************* -->
<parent>
- <groupId>org.chorem</groupId>
- <artifactId>chorempom</artifactId>
- <version>1.0.0</version>
+ <groupId>org.nuiton</groupId>
+ <artifactId>mavenpom</artifactId>
+ <version>1.0.1-SNAPSHOT</version>
</parent>
<groupId>org.chorem</groupId>
@@ -264,12 +264,15 @@
<properties>
+ <!-- redmine configuration -->
+ <platform>chorem.org</platform>
+ <platformName>Chorem</platformName>
<projectId>pollen</projectId>
<!-- customized versions -->
<javadoc.version>2.4</javadoc.version>
- <topia.version>2.2.0-rc-5-SNAPSHOT</topia.version>
- <eugene.version>1.0.0-rc-7</eugene.version>
+ <topia.version>2.2.0</topia.version>
+ <eugene.version>1.0.0</eugene.version>
<tapestry.version>5.1.0.5</tapestry.version>
<!-- license to use -->
@@ -286,59 +289,6 @@
<developerConnection>scm:svn:http://svn.chorem.org/svn/pollen/trunk</developerConnection>
<url>http://www.chorem.org/repositories/browse/pollen/trunk</url>
</scm>
-
- <!--issueManagement>
- <system>redmine</system>
- <url>http://www.chorem.org/projects/pollen/issues</url>
- </issueManagement>
-
- <ciManagement>
- <system>hudson</system>
- <url>http://hudson.chorem.org</url>
- </ciManagement-->
-
- <!--Any mailing lists for the project-->
- <!--mailingLists>
- <mailingList>
- <name>pollen-commits</name>
- <subscribe>http://list.chorem.org/mailman/listinfo/pollen-commits</subscribe>
- <unsubscribe>http://list.chorem.org/mailman/listinfo/pollen-commits</unsubscribe>
- <post>pollen-commits(a)$list.chorem.org</post>
- <archive>http://list.chorem.org/pipermail/pollen-commits/</archive>
- </mailingList>
-
- <mailingList>
- <name>pollen-devel</name>
- <subscribe>http://list.chorem.org/mailman/listinfo/pollen-devel</subscribe>
- <unsubscribe>http://list.chorem.org/mailman/listinfo/pollen-devel</unsubscribe>
- <post>pollen-devel(a)list.chorem.org</post>
- <archive>http://list.chorem.org/pipermail/pollen-devel/</archive>
- </mailingList>
-
- <mailingList>
- <name>pollen-users</name>
- <subscribe>http://list.chorem.org/mailman/listinfo/pollen-users</subscribe>
- <unsubscribe>http://list.chorem.org/mailman/listinfo/pollen-users</unsubscribe>
- <post>pollen-users(a)list.chorem.org</post>
- <archive>http://list.chorem.org/pipermail/pollen-users/</archive>
- </mailingList>
- </mailingLists-->
-
- <!--Distribution-->
- <!--distributionManagement>
- <repository>
- <id>nuiton</id>
- <url>scpexe://chorem.org/var/lib/maven/release</url>
- </repository>
- <snapshotRepository>
- <id>nuiton</id>
- <url>scpexe://chorem.org/var/lib/maven/snapshot</url>
- </snapshotRepository>
- <site>
- <id>nuiton</id>
- <url>scpexe://chorem.org/var/lib/redmine-chorem/project-site/pollen</url>
- </site>
- </distributionManagement-->
<repositories>
1
0
Author: tchemit
Date: 2009-08-24 16:58:18 +0200 (Mon, 24 Aug 2009)
New Revision: 2742
Modified:
trunk/pom.xml
Log:
use chorempom 1.0.0
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-08-24 14:08:45 UTC (rev 2741)
+++ trunk/pom.xml 2009-08-24 14:58:18 UTC (rev 2742)
@@ -8,9 +8,9 @@
<!-- ************************************************************* -->
<parent>
- <groupId>org.nuiton</groupId>
- <artifactId>mavenpom</artifactId>
- <version>1.0.0-rc-4</version>
+ <groupId>org.chorem</groupId>
+ <artifactId>chorempom</artifactId>
+ <version>1.0.0</version>
</parent>
<groupId>org.chorem</groupId>
@@ -287,7 +287,7 @@
<url>http://www.chorem.org/repositories/browse/pollen/trunk</url>
</scm>
- <issueManagement>
+ <!--issueManagement>
<system>redmine</system>
<url>http://www.chorem.org/projects/pollen/issues</url>
</issueManagement>
@@ -295,10 +295,10 @@
<ciManagement>
<system>hudson</system>
<url>http://hudson.chorem.org</url>
- </ciManagement>
+ </ciManagement-->
<!--Any mailing lists for the project-->
- <mailingLists>
+ <!--mailingLists>
<mailingList>
<name>pollen-commits</name>
<subscribe>http://list.chorem.org/mailman/listinfo/pollen-commits</subscribe>
@@ -322,10 +322,10 @@
<post>pollen-users(a)list.chorem.org</post>
<archive>http://list.chorem.org/pipermail/pollen-users/</archive>
</mailingList>
- </mailingLists>
+ </mailingLists-->
<!--Distribution-->
- <distributionManagement>
+ <!--distributionManagement>
<repository>
<id>nuiton</id>
<url>scpexe://chorem.org/var/lib/maven/release</url>
@@ -338,7 +338,7 @@
<id>nuiton</id>
<url>scpexe://chorem.org/var/lib/redmine-chorem/project-site/pollen</url>
</site>
- </distributionManagement>
+ </distributionManagement-->
<repositories>
1
0
r2741 - in trunk/pollen-ui/src/main: java/org/chorem/pollen/ui/pages/user resources/org/chorem/pollen/ui/pages/user webapp/user
by nrannou@users.chorem.org 24 Aug '09
by nrannou@users.chorem.org 24 Aug '09
24 Aug '09
Author: nrannou
Date: 2009-08-24 16:08:45 +0200 (Mon, 24 Aug 2009)
New Revision: 2741
Modified:
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserPollsParticipated.java
trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserPollsParticipated_en.properties
trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserPollsParticipated_fr.properties
trunk/pollen-ui/src/main/webapp/user/UserPollsParticipated.tml
Log:
deux tableaux : sondage invit?\195?\169s et sondages particip?\195?\169s
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserPollsParticipated.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserPollsParticipated.java 2009-08-24 12:23:20 UTC (rev 2740)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserPollsParticipated.java 2009-08-24 14:08:45 UTC (rev 2741)
@@ -22,8 +22,10 @@
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.annotations.SessionState;
import org.apache.tapestry5.ioc.annotations.Inject;
+import org.chorem.pollen.business.dto.PollAccountDTO;
import org.chorem.pollen.business.dto.PollDTO;
import org.chorem.pollen.business.dto.UserDTO;
+import org.chorem.pollen.business.dto.VotingListDTO;
import org.chorem.pollen.business.services.ServicePoll;
import org.chorem.pollen.ui.base.Polls;
@@ -46,24 +48,48 @@
private boolean userExists;
/**
- * Liste des sondages de l'utilisateur
+ * Liste des sondages auxquels l'utilisateur a participé
*/
+ @SuppressWarnings("unused")
@Property
- private List<PollDTO> polls;
+ private List<PollDTO> participatedPolls;
+ /**
+ * Liste des sondages auxquels l'utilisateur est invité
+ */
+ @SuppressWarnings("unused")
+ @Property
+ private List<PollDTO> invitedPolls;
+
/** Injection des services */
@Inject
private ServicePoll servicePoll;
/**
+ * Récupération de l'identifiant de vote du sondage.
+ *
+ * @return l'identifiant.
+ */
+ public String getVoteId(PollDTO poll) {
+ for (VotingListDTO list : poll.getVotingListDTOs()) {
+ for (PollAccountDTO account : list.getPollAccountDTOs()) {
+ if (account.getEmail().equals(user.getEmail())) {
+ return poll.getPollId() + ":" + account.getAccountId();
+ }
+ }
+ }
+ return poll.getPollId();
+ }
+
+ /**
* Méthode d'initialisation des sondages
*/
@Override
public void onActivate() {
super.onActivate();
if (userExists) {
- polls = servicePoll.findParticipatedPolls(user.getId());
- polls.addAll(servicePoll.findInvitedPolls(user.getId()));
+ participatedPolls = servicePoll.findParticipatedPolls(user.getId());
+ invitedPolls = servicePoll.findInvitedPolls(user.getId());
}
}
}
Modified: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserPollsParticipated_en.properties
===================================================================
--- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserPollsParticipated_en.properties 2009-08-24 12:23:20 UTC (rev 2740)
+++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserPollsParticipated_en.properties 2009-08-24 14:08:45 UTC (rev 2741)
@@ -1,4 +1,5 @@
title=Polls participated
-subtitle=Polls in which you are involved
+invitedPolls=Polls for which you are invited to vote
+participatedPolls=Polls in which you are involved
noUser=You must be logged to access to your polls.\n Please fill the form below.
-noPolls=You have not participated to any poll.
\ No newline at end of file
+noPolls=No poll.
\ No newline at end of file
Modified: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserPollsParticipated_fr.properties
===================================================================
--- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserPollsParticipated_fr.properties 2009-08-24 12:23:20 UTC (rev 2740)
+++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserPollsParticipated_fr.properties 2009-08-24 14:08:45 UTC (rev 2741)
@@ -1,4 +1,5 @@
title=Sondages participés
-subtitle=Liste des sondages pour lesquels vous avez voté ou êtes invité à voter
+invitedPolls=Liste des sondages pour lesquels vous êtes invité à voter
+participatedPolls=Liste des sondages pour lesquels vous avez voté
noUser=Vous devez être identifié pour pouvoir accéder à vos sondages.\n Veuillez remplir le formulaire ci-dessous.
-noPolls=Vous n'avez participé à aucun sondage.
\ No newline at end of file
+noPolls=Aucun sondage.
\ No newline at end of file
Modified: trunk/pollen-ui/src/main/webapp/user/UserPollsParticipated.tml
===================================================================
--- trunk/pollen-ui/src/main/webapp/user/UserPollsParticipated.tml 2009-08-24 12:23:20 UTC (rev 2740)
+++ trunk/pollen-ui/src/main/webapp/user/UserPollsParticipated.tml 2009-08-24 14:08:45 UTC (rev 2741)
@@ -4,10 +4,28 @@
<t:feedback t:id="feedback"/>
<h1 class="titleVote">${message:title}</h1>
- <h4>${message:subtitle}</h4>
<t:if test="userExists">
+
+ <h4>${message:invitedPolls}</h4>
+ <t:grid t:id="invitedPollsGrid" t:source="invitedPolls" t:row="poll" model="pollsModel" t:inPlace="true"
+ t:rowsPerPage="10" t:pagerPosition="bottom" t:rowClass="prop:evenodd.next">
+ <p:functionsCell>
+ <t:PageLink t:page="poll/VoteForPoll" t:context="getVoteId(poll)">
+ <img src="${asset:context:img/vote.png}" title="${message:vote-help}" alt="${message:vote}" />
+ </t:PageLink>
+ <t:if test="poll.publicResults">
+ <t:PageLink t:page="poll/results" t:context="poll.pollId">
+ <img src="${asset:context:img/count.png}" title="${message:count-help}" alt="${message:count}" />
+ </t:PageLink>
+ </t:if>
+ </p:functionsCell>
+ <p:empty>
+ ${message:noPolls}
+ </p:empty>
+ </t:grid>
- <t:grid t:id="pollsGrid" t:source="polls" t:row="poll" model="pollsModel" t:inPlace="true"
+ <h4>${message:participatedPolls}</h4>
+ <t:grid t:id="participatedPollsGrid" t:source="participatedPolls" t:row="poll" model="pollsModel" t:inPlace="true"
t:rowsPerPage="10" t:pagerPosition="bottom" t:rowClass="prop:evenodd.next">
<p:functionsCell>
<t:PageLink t:page="poll/VoteForPoll" t:context="poll.pollId">
1
0
r2740 - in trunk/pollen-ui/src/main: resources/org/chorem/pollen/ui/pages/poll webapp/poll
by nrannou@users.chorem.org 24 Aug '09
by nrannou@users.chorem.org 24 Aug '09
24 Aug '09
Author: nrannou
Date: 2009-08-24 14:23:20 +0200 (Mon, 24 Aug 2009)
New Revision: 2740
Modified:
trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollCreation_en.properties
trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollCreation_fr.properties
trunk/pollen-ui/src/main/webapp/poll/PollCreation.tml
Log:
message d'aide cr?\195?\169ation de groupe ?\195?\160 partir d'une liste de favoris
Modified: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollCreation_en.properties
===================================================================
--- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollCreation_en.properties 2009-08-21 13:46:11 UTC (rev 2739)
+++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollCreation_en.properties 2009-08-24 12:23:20 UTC (rev 2740)
@@ -70,6 +70,7 @@
personWeight-label=Weight
personWeight-min-message=The value must be at least 0.
listSelect-label=Select a list of voting persons
+listSelect-help=Persons will be added to the selected group. To select another group click on the edit icon
group-label=Group
groupName-label=Name
groupWeight-label=Weight
Modified: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollCreation_fr.properties
===================================================================
--- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollCreation_fr.properties 2009-08-21 13:46:11 UTC (rev 2739)
+++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollCreation_fr.properties 2009-08-24 12:23:20 UTC (rev 2740)
@@ -70,6 +70,7 @@
personWeight-label=Poids
personWeight-min-message=Le poids doit-être supérieur à 0.
listSelect-label=Sélectionnez une liste de votants
+listSelect-help=Les votants seront ajoutés au groupe selectionné. Pour sélectionner un autre groupe cliquez sur l'icône de modification
group-label=Groupe
groupName-label=Nom
groupWeight-label=Poids
Modified: trunk/pollen-ui/src/main/webapp/poll/PollCreation.tml
===================================================================
--- trunk/pollen-ui/src/main/webapp/poll/PollCreation.tml 2009-08-21 13:46:11 UTC (rev 2739)
+++ trunk/pollen-ui/src/main/webapp/poll/PollCreation.tml 2009-08-24 12:23:20 UTC (rev 2740)
@@ -165,6 +165,9 @@
<div>
<t:label for="listSelect" />:
<t:select t:id="listSelect" t:model="personLists" t:encoder="personLists" t:value="personList"></t:select>
+ <span t:type="ck/Tooltip" title="${message:help}" value="${message:listSelect-help}" effect="appear">
+ <img src="${asset:context:img/help.png}" alt="${message:help}"/>
+ </span>
</div>
</t:if>
<t:errors/>
1
0
r2739 - trunk/pollen-votecounting/src/test/java/org/chorem/pollen/votecounting/business/services
by nrannou@users.chorem.org 21 Aug '09
by nrannou@users.chorem.org 21 Aug '09
21 Aug '09
Author: nrannou
Date: 2009-08-21 15:46:11 +0200 (Fri, 21 Aug 2009)
New Revision: 2739
Modified:
trunk/pollen-votecounting/src/test/java/org/chorem/pollen/votecounting/business/services/PollDTOCreator.java
trunk/pollen-votecounting/src/test/java/org/chorem/pollen/votecounting/business/services/PollDTOCreatorVoteCounting.java
Log:
modification des tests
Modified: trunk/pollen-votecounting/src/test/java/org/chorem/pollen/votecounting/business/services/PollDTOCreator.java
===================================================================
--- trunk/pollen-votecounting/src/test/java/org/chorem/pollen/votecounting/business/services/PollDTOCreator.java 2009-08-20 15:12:21 UTC (rev 2738)
+++ trunk/pollen-votecounting/src/test/java/org/chorem/pollen/votecounting/business/services/PollDTOCreator.java 2009-08-21 13:46:11 UTC (rev 2739)
@@ -24,5 +24,18 @@
* @version $Id$
*/
public interface PollDTOCreator {
+
+ /**
+ * Création d'un sondage aléatoire.
+ *
+ * @return le sondage
+ */
public PollDTO createPoll();
+
+ /**
+ * Création d'un sondage de test.
+ *
+ * @return le sondage
+ */
+ public PollDTO createTestPoll();
}
\ No newline at end of file
Modified: trunk/pollen-votecounting/src/test/java/org/chorem/pollen/votecounting/business/services/PollDTOCreatorVoteCounting.java
===================================================================
--- trunk/pollen-votecounting/src/test/java/org/chorem/pollen/votecounting/business/services/PollDTOCreatorVoteCounting.java 2009-08-20 15:12:21 UTC (rev 2738)
+++ trunk/pollen-votecounting/src/test/java/org/chorem/pollen/votecounting/business/services/PollDTOCreatorVoteCounting.java 2009-08-21 13:46:11 UTC (rev 2739)
@@ -61,7 +61,7 @@
+ "typeVoteCounting=" + this.typeCount);
}
- PollDTO poll = new PollDTO("poll1");
+ PollDTO poll = new PollDTO("RandomPoll");
poll.setMaxChoiceNb(this.maxChoiceNb);
poll.setPollType(PollType.FREE);
poll.setVoteCounting(this.typeCount);
@@ -72,7 +72,7 @@
private List<PollChoiceDTO> createChoices() {
if (log.isDebugEnabled()) {
- log.debug("Création des choix : " + this.maxChoice);
+ log.debug("Création des choix : ");
}
List<PollChoiceDTO> choices = new ArrayList<PollChoiceDTO>();
for (int i = 1; i <= this.maxChoice; i++) {
@@ -180,4 +180,64 @@
return 1;
}
}
+
+ @Override
+ public PollDTO createTestPoll() {
+ if (log.isDebugEnabled()) {
+ log.debug("Création du sondage : typeVoteCounting=" + typeCount);
+ }
+
+ PollDTO poll = new PollDTO("TestPoll");
+ poll.setMaxChoiceNb(3);
+ poll.setPollType(PollType.FREE);
+ poll.setVoteCounting(typeCount);
+ poll.setChoices(createTestChoices());
+ poll.setVotingGroups(createTestGroups());
+ return poll;
+ }
+
+ private List<PollChoiceDTO> createTestChoices() {
+ int nbChoices = 3;
+ if (log.isDebugEnabled()) {
+ log.debug("Création des choix : " + nbChoices);
+ }
+ List<PollChoiceDTO> choices = new ArrayList<PollChoiceDTO>();
+ for (int i = 1; i <= nbChoices; i++) {
+ choices.add(new PollChoiceDTO(String.valueOf(i)));
+ if (log.isDebugEnabled()) {
+ log.debug("Choice : id=" + i);
+ }
+ }
+ return choices;
+ }
+
+ private List<VotingGroupDTO> createTestGroups() {
+ List<VotingGroupDTO> groups = new ArrayList<VotingGroupDTO>();
+ if (log.isDebugEnabled()) {
+ log.debug("Création des groupes : ");
+ }
+
+ //// groupe 1 : poids 1
+ VotingGroupDTO group = new VotingGroupDTO("group1", 1.0);
+ List<VotingPersonDTO> persons = new ArrayList<VotingPersonDTO>();
+
+ // person 1 : poids 1
+ VotingPersonDTO person1 = new VotingPersonDTO("person1", 1.0);
+ List<VoteToChoiceDTO> choices1 = new ArrayList<VoteToChoiceDTO>();
+ choices1.add(new VoteToChoiceDTO("1", 1.0));
+ person1.setChoices(choices1);
+ persons.add(person1);
+
+ // person 2 : poids 2
+ VotingPersonDTO person2 = new VotingPersonDTO("person2", 2.0);
+ List<VoteToChoiceDTO> choices2 = new ArrayList<VoteToChoiceDTO>();
+ choices2.add(new VoteToChoiceDTO("2", 1.0));
+ person2.setChoices(choices2);
+ persons.add(person2);
+
+ group.setVotingPersons(persons);
+ groups.add(group);
+
+ return groups;
+ }
}
\ No newline at end of file
1
0
r2738 - in trunk: pollen-business/doc pollen-votecounting/doc src/site/resources/schemas src/site/resources/schemas/business src/site/resources/schemas/votecounting src/site/rst/developper
by nrannou@users.chorem.org 20 Aug '09
by nrannou@users.chorem.org 20 Aug '09
20 Aug '09
Author: nrannou
Date: 2009-08-20 17:12:21 +0200 (Thu, 20 Aug 2009)
New Revision: 2738
Modified:
trunk/pollen-business/doc/PollenBusiness.zargo
trunk/pollen-business/doc/ServicePoll.zargo
trunk/pollen-business/doc/ServiceResults.zargo
trunk/pollen-business/doc/ServiceUser.zargo
trunk/pollen-votecounting/doc/exportXML.zargo
trunk/pollen-votecounting/doc/votecountingapi.zargo
trunk/src/site/resources/schemas/DC_Pollen.png
trunk/src/site/resources/schemas/DC_PreventRules.png
trunk/src/site/resources/schemas/business/DC_BusinessDTOs.png
trunk/src/site/resources/schemas/business/DC_ServicePoll.png
trunk/src/site/resources/schemas/business/DC_ServiceResults.png
trunk/src/site/resources/schemas/business/DC_ServiceUser.png
trunk/src/site/resources/schemas/votecounting/DC_ServiceExport.png
trunk/src/site/resources/schemas/votecounting/DC_ServiceExportImpl.png
trunk/src/site/resources/schemas/votecounting/DC_ServiceExportXML.png
trunk/src/site/resources/schemas/votecounting/DC_ServiceVoteCounting.png
trunk/src/site/resources/schemas/votecounting/DC_ServiceVoteCountingImpl.png
trunk/src/site/resources/schemas/votecounting/DC_VoteCountingDTOs.png
trunk/src/site/rst/developper/analyse.rst
Log:
mise ?\195?\160 jour de la doc
Modified: trunk/pollen-business/doc/PollenBusiness.zargo
===================================================================
(Binary files differ)
Modified: trunk/pollen-business/doc/ServicePoll.zargo
===================================================================
(Binary files differ)
Modified: trunk/pollen-business/doc/ServiceResults.zargo
===================================================================
(Binary files differ)
Modified: trunk/pollen-business/doc/ServiceUser.zargo
===================================================================
(Binary files differ)
Modified: trunk/pollen-votecounting/doc/exportXML.zargo
===================================================================
(Binary files differ)
Modified: trunk/pollen-votecounting/doc/votecountingapi.zargo
===================================================================
(Binary files differ)
Modified: trunk/src/site/resources/schemas/DC_Pollen.png
===================================================================
(Binary files differ)
Modified: trunk/src/site/resources/schemas/DC_PreventRules.png
===================================================================
(Binary files differ)
Modified: trunk/src/site/resources/schemas/business/DC_BusinessDTOs.png
===================================================================
(Binary files differ)
Modified: trunk/src/site/resources/schemas/business/DC_ServicePoll.png
===================================================================
(Binary files differ)
Modified: trunk/src/site/resources/schemas/business/DC_ServiceResults.png
===================================================================
(Binary files differ)
Modified: trunk/src/site/resources/schemas/business/DC_ServiceUser.png
===================================================================
(Binary files differ)
Modified: trunk/src/site/resources/schemas/votecounting/DC_ServiceExport.png
===================================================================
(Binary files differ)
Modified: trunk/src/site/resources/schemas/votecounting/DC_ServiceExportImpl.png
===================================================================
(Binary files differ)
Modified: trunk/src/site/resources/schemas/votecounting/DC_ServiceExportXML.png
===================================================================
(Binary files differ)
Modified: trunk/src/site/resources/schemas/votecounting/DC_ServiceVoteCounting.png
===================================================================
(Binary files differ)
Modified: trunk/src/site/resources/schemas/votecounting/DC_ServiceVoteCountingImpl.png
===================================================================
(Binary files differ)
Modified: trunk/src/site/resources/schemas/votecounting/DC_VoteCountingDTOs.png
===================================================================
(Binary files differ)
Modified: trunk/src/site/rst/developper/analyse.rst
===================================================================
--- trunk/src/site/rst/developper/analyse.rst 2009-08-20 13:00:52 UTC (rev 2737)
+++ trunk/src/site/rst/developper/analyse.rst 2009-08-20 15:12:21 UTC (rev 2738)
@@ -316,7 +316,9 @@
- method, Action à déclencher.
- scope, Contexte dans lequel l'action peut se déclencher.
- sensibility, Valeur provoquant le déclenchement de l'action.
-- repeated, Indique si l'action peut se déclencher de manière répétitive.
+- active, Indique si la règle est actuellement active
+- oneTime, Indique si l'action doit se déclencher une seule fois (la règle est désactivée après sa première exécution).
+- repeated, Indique si l'action peut se déclencher de manière répétitive (une action de sensibilité 2 est déclenché pour les valeurs 2, 4, 6, 8...).
.. image:: ../schemas/DC_PreventRules.png
:alt: Cycle de vie d'un sondage
1
0
20 Aug '09
Author: nrannou
Date: 2009-08-20 15:00:52 +0200 (Thu, 20 Aug 2009)
New Revision: 2737
Added:
trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServiceUserImplTest.java
Modified:
trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceAuth.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceAuthImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceChoiceImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceCommentImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceListImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollAccountImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePreventRuleImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceUser.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceUserImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceVoteImpl.java
trunk/pollen-business/src/test/java/org/chorem/pollen/business/business/PreventRuleManagerTest.java
trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServiceAuthImplTest.java
trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServicePollImplTest.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Border.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/LoginComponent.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/Account.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/Register.java
trunk/pollen-votecounting/src/main/java/org/chorem/pollen/votecounting/services/ServiceVoteCountingImpl.java
Log:
modification tests et logs
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceAuth.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceAuth.java 2009-08-19 15:48:01 UTC (rev 2736)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceAuth.java 2009-08-20 13:00:52 UTC (rev 2737)
@@ -27,11 +27,21 @@
public interface ServiceAuth {
/**
- * Identification d'un utilisateur
+ * Identification d'un utilisateur. Vérification du couple login, password.
*
- * @param login loin de l'utilisateur qui s'authentifie
+ * @param login le login de l'utilisateur à identifié
* @param password le password entré par l'utilisateur
- * @return l'utilisateur dont le login est login
+ * @return vrai si l'utilisateur est identifié, false sinon
*/
- public UserDTO isLoginRight(String login, String password);
+ public boolean isLoginRight(String login, String password);
+
+ /**
+ * Identification d'un utilisateur. Récupération des informations de cet
+ * utilisateur.
+ *
+ * @param login le login de l'utilisateur à identifié
+ * @param password le password entré par l'utilisateur
+ * @return l'utilisateur identifié par le login
+ */
+ public UserDTO getUser(String login, String password);
}
\ No newline at end of file
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceAuthImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceAuthImpl.java 2009-08-19 15:48:01 UTC (rev 2736)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceAuthImpl.java 2009-08-20 13:00:52 UTC (rev 2737)
@@ -46,8 +46,38 @@
}
@Override
- public UserDTO isLoginRight(String login, String password) {
+ public boolean isLoginRight(String login, String password) {
TopiaContext transaction = null;
+ boolean result = false;
+ try {
+ transaction = rootContext.beginTransaction();
+
+ userDAO = PollenModelDAOHelper.getUserAccountDAO(transaction);
+
+ UserAccount userEntity = userDAO.findByLogin(login);
+ if (userEntity != null && password.equals(userEntity.getPassword())) {
+ result = true;
+ }
+
+ transaction.commitTransaction();
+ transaction.closeContext();
+
+ if (log.isDebugEnabled()) {
+ log.debug("Entity found: "
+ + ((userEntity == null) ? "null" : userEntity
+ .getLogin()));
+ }
+
+ return result;
+ } catch (TopiaException e) {
+ ContextUtil.doCatch(e, transaction);
+ return false;
+ }
+ }
+
+ @Override
+ public UserDTO getUser(String login, String password) {
+ TopiaContext transaction = null;
UserDTO result = null;
try {
transaction = rootContext.beginTransaction();
@@ -57,15 +87,13 @@
UserAccount userEntity = userDAO.findByLogin(login);
if (userEntity != null && password.equals(userEntity.getPassword())) {
result = converter.createUserDTO(userEntity);
- } else {
- result = null;
}
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity found: "
+ if (log.isDebugEnabled()) {
+ log.debug("Entity found: "
+ ((result == null) ? "null" : result.getLogin()));
}
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceChoiceImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceChoiceImpl.java 2009-08-19 15:48:01 UTC (rev 2736)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceChoiceImpl.java 2009-08-20 13:00:52 UTC (rev 2737)
@@ -67,8 +67,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity created: " + topiaId);
+ if (log.isDebugEnabled()) {
+ log.debug("Entity created: " + topiaId);
}
return topiaId;
@@ -126,8 +126,8 @@
}
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity updated: " + choiceDTO.getId());
+ if (log.isDebugEnabled()) {
+ log.debug("Entity updated: " + choiceDTO.getId());
}
return resu;
@@ -151,8 +151,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity deleted: " + choiceId);
+ if (log.isDebugEnabled()) {
+ log.debug("Entity deleted: " + choiceId);
}
return true;
@@ -181,8 +181,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity found: "
+ if (log.isDebugEnabled()) {
+ log.debug("Entity found: "
+ ((result == null) ? "null" : result.getId()));
}
@@ -215,8 +215,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entities found: "
+ if (log.isDebugEnabled()) {
+ log.debug("Entities found: "
+ ((results == null) ? "null" : results.size()));
}
@@ -252,8 +252,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entities found: "
+ if (log.isDebugEnabled()) {
+ log.debug("Entities found: "
+ ((results == null) ? "null" : results.size()));
}
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceCommentImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceCommentImpl.java 2009-08-19 15:48:01 UTC (rev 2736)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceCommentImpl.java 2009-08-20 13:00:52 UTC (rev 2737)
@@ -70,8 +70,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity created: " + topiaId);
+ if (log.isDebugEnabled()) {
+ log.debug("Entity created: " + topiaId);
}
return topiaId;
@@ -125,8 +125,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity updated: " + comment.getId());
+ if (log.isDebugEnabled()) {
+ log.debug("Entity updated: " + comment.getId());
}
return true;
@@ -150,8 +150,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity deleted: " + commentId);
+ if (log.isDebugEnabled()) {
+ log.debug("Entity deleted: " + commentId);
}
return true;
@@ -180,8 +180,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity found: "
+ if (log.isDebugEnabled()) {
+ log.debug("Entity found: "
+ ((result == null) ? "null" : result.getId()));
}
@@ -217,8 +217,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entities found: "
+ if (log.isDebugEnabled()) {
+ log.debug("Entities found: "
+ ((results == null) ? "null" : results.size()));
}
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceListImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceListImpl.java 2009-08-19 15:48:01 UTC (rev 2736)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceListImpl.java 2009-08-20 13:00:52 UTC (rev 2737)
@@ -91,8 +91,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity created: " + topiaId);
+ if (log.isDebugEnabled()) {
+ log.debug("Entity created: " + topiaId);
}
return topiaId;
@@ -161,8 +161,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity updated: " + votingList.getId());
+ if (log.isDebugEnabled()) {
+ log.debug("Entity updated: " + votingList.getId());
}
return true;
@@ -186,8 +186,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity deleted: " + votingListId);
+ if (log.isDebugEnabled()) {
+ log.debug("Entity deleted: " + votingListId);
}
return true;
@@ -218,8 +218,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity found: "
+ if (log.isDebugEnabled()) {
+ log.debug("Entity found: "
+ ((result == null) ? "null" : result.getId()));
}
@@ -249,8 +249,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entities found: "
+ if (log.isDebugEnabled()) {
+ log.debug("Entities found: "
+ ((results == null) ? "null" : results.size()));
}
@@ -288,8 +288,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entities found: "
+ if (log.isDebugEnabled()) {
+ log.debug("Entities found: "
+ ((results == null) ? "null" : results.size()));
}
@@ -326,8 +326,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity created: " + topiaId);
+ if (log.isDebugEnabled()) {
+ log.debug("Entity created: " + topiaId);
}
return topiaId;
@@ -406,8 +406,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity updated: " + personList.getId());
+ if (log.isDebugEnabled()) {
+ log.debug("Entity updated: " + personList.getId());
}
return true;
@@ -431,8 +431,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity deleted: " + personListId);
+ if (log.isDebugEnabled()) {
+ log.debug("Entity deleted: " + personListId);
}
return true;
@@ -465,8 +465,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info(personListEntities.size()
+ if (log.isDebugEnabled()) {
+ log.debug(personListEntities.size()
+ " entities deleted for user: " + userId);
}
@@ -498,8 +498,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity found: "
+ if (log.isDebugEnabled()) {
+ log.debug("Entity found: "
+ ((result == null) ? "null" : result.getId()));
}
@@ -529,8 +529,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entities found: "
+ if (log.isDebugEnabled()) {
+ log.debug("Entities found: "
+ ((results == null) ? "null" : results.size()));
}
@@ -563,8 +563,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entities found: "
+ if (log.isDebugEnabled()) {
+ log.debug("Entities found: "
+ ((results == null) ? "null" : results.size()));
}
@@ -602,8 +602,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entities found: "
+ if (log.isDebugEnabled()) {
+ log.debug("Entities found: "
+ ((results == null) ? "null" : results.size()));
}
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollAccountImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollAccountImpl.java 2009-08-19 15:48:01 UTC (rev 2736)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollAccountImpl.java 2009-08-20 13:00:52 UTC (rev 2737)
@@ -76,8 +76,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity created: " + topiaId);
+ if (log.isDebugEnabled()) {
+ log.debug("Entity created: " + topiaId);
}
return topiaId;
} catch (TopiaException e) {
@@ -112,8 +112,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity created: " + topiaId);
+ if (log.isDebugEnabled()) {
+ log.debug("Entity created: " + topiaId);
}
return pollAccountEntity;
@@ -170,8 +170,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity deleted: " + pollAccountId);
+ if (log.isDebugEnabled()) {
+ log.debug("Entity deleted: " + pollAccountId);
}
return true;
@@ -205,8 +205,8 @@
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity updated: " + pollAccountDTO.getId());
+ if (log.isDebugEnabled()) {
+ log.debug("Entity updated: " + pollAccountDTO.getId());
}
return resu;
@@ -237,8 +237,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity found: "
+ if (log.isDebugEnabled()) {
+ log.debug("Entity found: "
+ ((result == null) ? "null" : result.getId()));
}
@@ -270,8 +270,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity found: "
+ if (log.isDebugEnabled()) {
+ log.debug("Entity found: "
+ ((result == null) ? "null" : result.getId()));
}
@@ -303,8 +303,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entities found: "
+ if (log.isDebugEnabled()) {
+ log.debug("Entities found: "
+ ((results == null) ? "null" : results.size()));
}
@@ -343,8 +343,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entities found: "
+ if (log.isDebugEnabled()) {
+ log.debug("Entities found: "
+ ((results == null) ? "null" : results.size()));
}
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollImpl.java 2009-08-19 15:48:01 UTC (rev 2736)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollImpl.java 2009-08-20 13:00:52 UTC (rev 2737)
@@ -70,11 +70,6 @@
Poll pollEntity = pollDAO.create();
- if (log.isDebugEnabled()) {
- log.debug("service " + pollDTO.getVoteCounting() + " "
- + pollDTO.getPollType());
- }
-
// Identifiant du sondage
String id = UUID.randomUUID().toString();
pollDTO.setPollId(id.replaceAll("-", ""));
@@ -84,18 +79,16 @@
// Création du pollAccount associé au sondage
ServicePollAccount spa = new ServicePollAccountImpl();
- if (log.isDebugEnabled()) {
- log.debug("userId : " + pollDTO.getUserId());
- }
PollAccount pollAccountEntity = spa.createPollAccount(pollDTO
.getCreatorId(), pollDTO.getCreatorEmail(), pollDTO
.getUserId());
+ pollEntity.setCreator(pollAccountEntity);
+
if (log.isDebugEnabled()) {
- log
- .debug("pollAccountEntity created: "
- + pollAccountEntity != null);
+ log.debug("userId: " + pollDTO.getUserId()
+ + ", pollAccountEntity created: "
+ + (pollAccountEntity != null));
}
- pollEntity.setCreator(pollAccountEntity);
topiaId = pollEntity.getTopiaId();
@@ -125,8 +118,8 @@
if (log.isDebugEnabled()) {
log.debug("creator after creation: " + pollEntity.getCreator());
}
- if (log.isInfoEnabled()) {
- log.info("Entity created: " + topiaId);
+ if (log.isDebugEnabled()) {
+ log.debug("Entity created: " + topiaId);
}
return topiaId;
@@ -157,8 +150,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity updated: " + pollDTO.getId());
+ if (log.isDebugEnabled()) {
+ log.debug("Entity updated: " + pollDTO.getId());
}
return true;
@@ -182,8 +175,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity deleted: " + pollId);
+ if (log.isDebugEnabled()) {
+ log.debug("Entity deleted: " + pollId);
}
return true;
@@ -212,8 +205,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity found: "
+ if (log.isDebugEnabled()) {
+ log.debug("Entity found: "
+ ((result == null) ? "null" : result.getId()));
}
@@ -243,8 +236,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity found: "
+ if (log.isDebugEnabled()) {
+ log.debug("Entity found: "
+ ((result == null) ? "null" : result.getId()));
}
@@ -273,8 +266,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entities found: "
+ if (log.isDebugEnabled()) {
+ log.debug("Entities found: "
+ ((results == null) ? "null" : results.size()));
}
@@ -307,8 +300,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entities found: "
+ if (log.isDebugEnabled()) {
+ log.debug("Entities found: "
+ ((results == null) ? "null" : results.size()));
}
@@ -344,8 +337,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entities found: "
+ if (log.isDebugEnabled()) {
+ log.debug("Entities found: "
+ ((results == null) ? "null" : results.size()));
}
@@ -393,8 +386,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entities found: "
+ if (log.isDebugEnabled()) {
+ log.debug("Entities found: "
+ ((results == null) ? "null" : results.size()));
}
@@ -434,8 +427,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entities found: "
+ if (log.isDebugEnabled()) {
+ log.debug("Entities found: "
+ ((results == null) ? "null" : results.size()));
}
@@ -471,8 +464,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entities found: "
+ if (log.isDebugEnabled()) {
+ log.debug("Entities found: "
+ ((results == null) ? "null" : results.size()));
}
@@ -504,8 +497,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity updated: " + pollId);
+ if (log.isDebugEnabled()) {
+ log.debug("Entity updated: " + pollId);
}
return true;
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePreventRuleImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePreventRuleImpl.java 2009-08-19 15:48:01 UTC (rev 2736)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePreventRuleImpl.java 2009-08-20 13:00:52 UTC (rev 2737)
@@ -68,8 +68,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity created: " + topiaId);
+ if (log.isDebugEnabled()) {
+ log.debug("Entity created: " + topiaId);
}
return topiaId;
@@ -132,8 +132,8 @@
}
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity updated: " + preventRuleDTO.getId());
+ if (log.isDebugEnabled()) {
+ log.debug("Entity updated: " + preventRuleDTO.getId());
}
return resu;
@@ -159,8 +159,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity deleted: " + preventRuleId);
+ if (log.isDebugEnabled()) {
+ log.debug("Entity deleted: " + preventRuleId);
}
return true;
@@ -191,8 +191,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity found: "
+ if (log.isDebugEnabled()) {
+ log.debug("Entity found: "
+ ((result == null) ? "null" : result.getId()));
}
@@ -231,8 +231,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entities found: "
+ if (log.isDebugEnabled()) {
+ log.debug("Entities found: "
+ ((results == null) ? "null" : results.size()));
}
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceUser.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceUser.java 2009-08-19 15:48:01 UTC (rev 2736)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceUser.java 2009-08-20 13:00:52 UTC (rev 2737)
@@ -79,15 +79,6 @@
public List<UserDTO> selectUsers(Map<String, Object> properties);
/**
- * Ajout d'un compte à un utilisateur
- *
- * @param login identifiant de l'utilisateur
- * @param pollAccountId identifiant du compte à ajouter
- * @return true si le compte a été ajouté
- */
- public boolean addPollAccountToUser(String login, String pollAccountId);
-
- /**
* Mise à jour du mot de passe d'un utilisateur
*
* @param user l'utilisateur
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceUserImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceUserImpl.java 2009-08-19 15:48:01 UTC (rev 2736)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceUserImpl.java 2009-08-20 13:00:52 UTC (rev 2737)
@@ -23,8 +23,6 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.pollen.business.converters.DataUserConverter;
import org.chorem.pollen.business.dto.UserDTO;
-import org.chorem.pollen.business.persistence.PollAccount;
-import org.chorem.pollen.business.persistence.PollAccountDAO;
import org.chorem.pollen.business.persistence.PollenModelDAOHelper;
import org.chorem.pollen.business.persistence.UserAccount;
import org.chorem.pollen.business.persistence.UserAccountDAO;
@@ -59,7 +57,8 @@
userDAO = PollenModelDAOHelper.getUserAccountDAO(transaction);
if (userDAO.findByLogin(user.getLogin()) != null
- || userDAO.findByEmail(user.getEmail()) != null) {
+ || (!"".equals(user.getEmail()) && userDAO.findByEmail(user
+ .getEmail()) != null)) {
return null;
}
@@ -70,8 +69,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity created: " + topiaId);
+ if (log.isDebugEnabled()) {
+ log.debug("Entity created: " + topiaId);
}
return topiaId;
@@ -95,8 +94,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity deleted: " + userEntity.getTopiaId());
+ if (log.isDebugEnabled()) {
+ log.debug("Entity deleted: " + userEntity.getTopiaId());
}
return true;
@@ -119,8 +118,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity deleted: " + userEntity.getTopiaId());
+ if (log.isDebugEnabled()) {
+ log.debug("Entity deleted: " + userEntity.getTopiaId());
}
return true;
@@ -149,8 +148,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity found: "
+ if (log.isDebugEnabled()) {
+ log.debug("Entity found: "
+ ((result == null) ? "null" : result.getId()));
}
@@ -186,8 +185,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entities found: "
+ if (log.isDebugEnabled()) {
+ log.debug("Entities found: "
+ ((results == null) ? "null" : results.size()));
}
@@ -215,8 +214,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity updated: " + user.getId());
+ if (log.isDebugEnabled()) {
+ log.debug("Entity updated: " + user.getId());
}
return true;
@@ -228,35 +227,6 @@
}
@Override
- public boolean addPollAccountToUser(String login, String pollAccountId) {
- TopiaContext transaction = null;
- try {
- transaction = rootContext.beginTransaction();
-
- userDAO = PollenModelDAOHelper.getUserAccountDAO(transaction);
-
- UserAccount userEntity = userDAO.findByLogin(login);
- PollAccountDAO pollAccountDAO = PollenModelDAOHelper
- .getPollAccountDAO(transaction);
- PollAccount pollAccountEntity = pollAccountDAO
- .findByTopiaId(pollAccountId);
- userEntity.addPollAccount(pollAccountEntity);
- userEntity.update();
- transaction.commitTransaction();
- transaction.closeContext();
-
- if (log.isInfoEnabled()) {
- log.info("Entity updated: " + userEntity.getTopiaId());
- }
-
- return true;
- } catch (TopiaException e) {
- ContextUtil.doCatch(e, transaction);
- return false;
- }
- }
-
- @Override
public boolean updatePasswordUser(UserDTO user, String newPassword) {
TopiaContext transaction = null;
try {
@@ -271,8 +241,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity updated: " + user.getId());
+ if (log.isDebugEnabled()) {
+ log.debug("Entity updated: " + user.getId());
}
return true;
@@ -295,6 +265,11 @@
}
transaction.closeContext();
+
+ if (log.isDebugEnabled()) {
+ log.debug("Entity exists for the login " + login + ": "
+ + userExists);
+ }
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return true;
@@ -315,6 +290,11 @@
}
transaction.closeContext();
+
+ if (log.isDebugEnabled()) {
+ log.debug("Entity exists for the email " + email + ": "
+ + userExists);
+ }
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return true;
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceVoteImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceVoteImpl.java 2009-08-19 15:48:01 UTC (rev 2736)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceVoteImpl.java 2009-08-20 13:00:52 UTC (rev 2737)
@@ -92,8 +92,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity created: " + topiaId);
+ if (log.isDebugEnabled()) {
+ log.debug("Entity created: " + topiaId);
}
return topiaId;
@@ -118,8 +118,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity updated: " + voteDTO.getId());
+ if (log.isDebugEnabled()) {
+ log.debug("Entity updated: " + voteDTO.getId());
}
return true;
@@ -142,8 +142,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entity deleted: " + voteId);
+ if (log.isDebugEnabled()) {
+ log.debug("Entity deleted: " + voteId);
}
return true;
@@ -179,8 +179,8 @@
transaction.commitTransaction();
transaction.closeContext();
- if (log.isInfoEnabled()) {
- log.info("Entities found: "
+ if (log.isDebugEnabled()) {
+ log.debug("Entities found: "
+ ((results == null) ? "null" : results.size()));
}
Modified: trunk/pollen-business/src/test/java/org/chorem/pollen/business/business/PreventRuleManagerTest.java
===================================================================
--- trunk/pollen-business/src/test/java/org/chorem/pollen/business/business/PreventRuleManagerTest.java 2009-08-19 15:48:01 UTC (rev 2736)
+++ trunk/pollen-business/src/test/java/org/chorem/pollen/business/business/PreventRuleManagerTest.java 2009-08-20 13:00:52 UTC (rev 2737)
@@ -61,7 +61,7 @@
@Test
public void testPrintAction() {
PreventRuleDTO preventRule = new PreventRuleDTO("test", 2, false,
- PreventRuleManager.PRINT_ACTION);
+ PreventRuleManager.NULL_ACTION);
manager = new PreventRuleManager(preventRule);
assertTrue(manager.execute());
@@ -82,7 +82,7 @@
@Test
public void testPrintActionRepeat() {
PreventRuleDTO preventRule = new PreventRuleDTO("test", 2, true,
- PreventRuleManager.PRINT_ACTION);
+ PreventRuleManager.NULL_ACTION);
manager = new PreventRuleManager(preventRule);
assertTrue(manager.execute());
@@ -100,7 +100,7 @@
@Test
public void testPrintActionOneTime() {
PreventRuleDTO preventRule = new PreventRuleDTO("test", 2, false,
- PreventRuleManager.PRINT_ACTION);
+ PreventRuleManager.NULL_ACTION);
preventRule.setOneTime(true);
manager = new PreventRuleManager(preventRule);
Modified: trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServiceAuthImplTest.java
===================================================================
--- trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServiceAuthImplTest.java 2009-08-19 15:48:01 UTC (rev 2736)
+++ trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServiceAuthImplTest.java 2009-08-20 13:00:52 UTC (rev 2737)
@@ -17,12 +17,11 @@
package org.chorem.pollen.business.services;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
import org.chorem.pollen.business.dto.UserDTO;
-import org.chorem.pollen.business.services.ServiceAuthImpl;
-import org.chorem.pollen.business.services.ServiceUser;
-import org.chorem.pollen.business.services.ServiceUserImpl;
import org.chorem.pollen.business.utils.ContextUtil;
import org.junit.After;
import org.junit.AfterClass;
@@ -63,16 +62,34 @@
*/
@Test
public void testIsLoginRight() {
- String login = "testLogin";
- String password = "testPassword";
- UserDTO result1 = instance.isLoginRight(login, password);
+ String login = "login_isLoginRight";
+ String password = "password_isLoginRight";
+ boolean result1 = instance.isLoginRight(login, password);
+ assertFalse(result1);
+
+ UserDTO dto = new UserDTO();
+ dto.setLogin(login);
+ ServiceUser smu = new ServiceUserImpl();
+ smu.createUser(dto, password);
+ boolean result2 = instance.isLoginRight(login, password);
+ assertTrue(result2);
+ }
+
+ /**
+ * Test of getUser method, of class ServiceAuthImpl.
+ */
+ @Test
+ public void testGetUser() {
+ String login = "login_getUser";
+ String password = "password_getUser";
+ UserDTO result1 = instance.getUser(login, password);
assertNull(result1);
UserDTO dto = new UserDTO();
dto.setLogin(login);
ServiceUser smu = new ServiceUserImpl();
smu.createUser(dto, password);
- UserDTO result2 = instance.isLoginRight(login, password);
+ UserDTO result2 = instance.getUser(login, password);
assertEquals(login, result2.getLogin());
}
}
\ No newline at end of file
Modified: trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServicePollImplTest.java
===================================================================
--- trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServicePollImplTest.java 2009-08-19 15:48:01 UTC (rev 2736)
+++ trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServicePollImplTest.java 2009-08-20 13:00:52 UTC (rev 2737)
@@ -21,13 +21,13 @@
import java.util.Date;
import java.util.List;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.chorem.pollen.business.dto.PollAccountDTO;
import org.chorem.pollen.business.dto.PollDTO;
import org.chorem.pollen.business.dto.UserDTO;
-import org.chorem.pollen.business.services.ServicePollImpl;
-import org.chorem.pollen.business.services.ServiceUser;
-import org.chorem.pollen.business.services.ServiceUserImpl;
+import org.chorem.pollen.business.dto.VoteDTO;
import org.chorem.pollen.business.utils.ContextUtil;
import org.chorem.pollen.common.ChoiceType;
import org.chorem.pollen.common.PollType;
@@ -185,7 +185,8 @@
// création de l'utilisateur
UserDTO user = new UserDTO();
- user.setLogin("login");
+ user.setLogin("login_findPollsByUser");
+ user.setEmail("email_findPollsByUser");
ServiceUser su = new ServiceUserImpl();
String userId = su.createUser(user, "password");
@@ -201,6 +202,40 @@
}
/**
+ * Test of findParticipatedPolls method, of class ServicePollImpl.
+ */
+ @Test
+ public void testFindParticipatedPolls() {
+
+ // création de l'utilisateur
+ UserDTO user = new UserDTO();
+ user.setLogin("login_findParticipatedPolls");
+ user.setEmail("email_findParticipatedPolls");
+ ServiceUser su = new ServiceUserImpl();
+ String userId = su.createUser(user, "password");
+
+ // création du compte associé à l'utilisateur
+ PollAccountDTO account = new PollAccountDTO();
+ account.setUserId(userId);
+ ServicePollAccount spa = new ServicePollAccountImpl();
+ String accountId = spa.createPollAccount(account);
+
+ // création du sondage
+ PollDTO poll = new PollDTO();
+ poll.setTitle("Test_findParticipatedPolls");
+ String pollId = instance.createPoll(poll);
+
+ // création du vote
+ VoteDTO vote = new VoteDTO(accountId, pollId, null);
+ ServiceVote sv = new ServiceVoteImpl();
+ sv.createVote(vote, account);
+
+ // recherche des sondages de l'utilisateur
+ List<PollDTO> result = instance.findParticipatedPolls(userId);
+ assertEquals(result.size(), 1);
+ }
+
+ /**
* Test of findRunningPolls method, of class ServicePollImpl.
*/
@Test
Added: trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServiceUserImplTest.java
===================================================================
--- trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServiceUserImplTest.java (rev 0)
+++ trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServiceUserImplTest.java 2009-08-20 13:00:52 UTC (rev 2737)
@@ -0,0 +1,181 @@
+/* *##% Pollen
+ * Copyright (C) 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/
+
+package org.chorem.pollen.business.services;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.chorem.pollen.business.dto.UserDTO;
+import org.chorem.pollen.business.utils.ContextUtil;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Tests du service de gestion des utilisateurs.
+ *
+ * @author rannou
+ * @version $Id$
+ */
+public class ServiceUserImplTest {
+ private ServiceUserImpl instance;
+
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+ ContextUtil.getInstance().buildContext();
+ }
+
+ @AfterClass
+ public static void tearDownClass() throws Exception {
+ ContextUtil.getInstance().getContext().clear(false);
+ }
+
+ @Before
+ public void setUp() {
+ instance = new ServiceUserImpl();
+ }
+
+ @After
+ public void tearDown() {
+ }
+
+ /**
+ * Test of createUser method, of class ServiceUserImpl.
+ */
+ @Test
+ public void testCreateUser() {
+ UserDTO user = new UserDTO();
+ user.setLogin("login_CreateUser");
+ String result = instance.createUser(user, "password");
+ assertTrue(result.length() > 0);
+ }
+
+ /**
+ * Test of updateUser method, of class ServiceUserImpl.
+ */
+ @Test
+ public void testUpdateUser() {
+ UserDTO user = new UserDTO();
+ user.setLogin("login_UpdateUser");
+ String userId = instance.createUser(user, "password");
+ user.setId(userId);
+ user.setFirstName("firstName_UpdateUser");
+ boolean result = instance.updateUser(user);
+ assertTrue(result);
+ }
+
+ /**
+ * Test of deleteUser method, of class ServiceUserImpl.
+ */
+ @Test
+ public void testDeleteUser() {
+
+ // delete with dto
+ UserDTO user = new UserDTO();
+ user.setLogin("login_DeleteUser");
+ user.setId(instance.createUser(user, "password"));
+ boolean result = instance.deleteUser(user);
+ assertTrue(result);
+
+ // delete with login
+ UserDTO user2 = new UserDTO();
+ user2.setLogin("login_DeleteUser");
+ String userId2 = instance.createUser(user2, "password");
+ boolean result2 = instance.deleteUser("login_DeleteUser");
+ assertTrue(result2);
+ }
+
+ /**
+ * Test of findUserById method, of class ServiceUserImpl.
+ */
+ @Test
+ public void testFindUserById() {
+ UserDTO user = new UserDTO();
+ user.setLogin("login_FindUserById");
+ String userId = instance.createUser(user, "password");
+ UserDTO result = instance.findUserById(userId);
+ String resultId = result.getId();
+ assertEquals(userId, resultId);
+ }
+
+ /**
+ * Test of selectUsers method, of class ServiceUserImpl.
+ */
+ @Test
+ public void testSelectUsers() {
+ UserDTO user = new UserDTO();
+ user.setLogin("login_SelectUsers");
+ String userId = instance.createUser(user, "password");
+ List<UserDTO> result = instance.selectUsers(null);
+ assertTrue(result.size() > 1);
+ }
+
+ /**
+ * Test of updatePasswordUser method, of class ServiceUserImpl.
+ */
+ @Test
+ public void testUpdatePasswordUser() {
+ UserDTO user = new UserDTO();
+ user.setLogin("login_UpdatePasswordUser");
+ user.setId(instance.createUser(user, "password"));
+ instance.updatePasswordUser(user, "newPassword");
+
+ ServiceAuth sa = new ServiceAuthImpl();
+ UserDTO result = sa.getUser(user.getLogin(), "newPassword");
+ assertNotNull(result);
+ }
+
+ /**
+ * Test of isUserLoginExisting method, of class ServiceUserImpl.
+ */
+ @Test
+ public void testIsUserLoginExisting() {
+ UserDTO user = new UserDTO();
+ user.setLogin("login_IsUserLoginExisting");
+ user.setEmail("email_IsUserLoginExisting");
+ String userId = instance.createUser(user, "password");
+
+ boolean result = instance
+ .isUserLoginExisting("login_IsUserLoginExisting");
+ boolean result2 = instance.isUserLoginExisting("login_False");
+ assertTrue(result);
+ assertFalse(result2);
+ }
+
+ /**
+ * Test of isUserEmailExisting method, of class ServiceUserImpl.
+ */
+ @Test
+ public void testIsUserEmailExisting() {
+ UserDTO user = new UserDTO();
+ user.setLogin("login_IsUserEmailExisting");
+ user.setEmail("email_IsUserEmailExisting");
+ String userId = instance.createUser(user, "password");
+
+ boolean result = instance
+ .isUserEmailExisting("email_IsUserEmailExisting");
+ boolean result2 = instance.isUserEmailExisting("email_False");
+ assertTrue(result);
+ assertFalse(result2);
+ }
+}
\ No newline at end of file
Property changes on: trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServiceUserImplTest.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Rev Revision"
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Border.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Border.java 2009-08-19 15:48:01 UTC (rev 2736)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Border.java 2009-08-20 13:00:52 UTC (rev 2737)
@@ -164,7 +164,7 @@
* @return la zone à mettre à jour
*/
Object onSuccessFromLoginForm() {
- UserDTO userDTO = serviceAuth.isLoginRight(login, MD5.encode(password));
+ UserDTO userDTO = serviceAuth.getUser(login, MD5.encode(password));
if (userDTO != null) {
user = userDTO;
feedback.addInfo(messages.get("loginOk"));
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/LoginComponent.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/LoginComponent.java 2009-08-19 15:48:01 UTC (rev 2736)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/LoginComponent.java 2009-08-20 13:00:52 UTC (rev 2737)
@@ -77,7 +77,7 @@
Object onSuccessFromLoginCompForm() {
// Récupération de l'utilisateur identifié
- UserDTO userDTO = serviceAuth.isLoginRight(loginComp, MD5
+ UserDTO userDTO = serviceAuth.getUser(loginComp, MD5
.encode(passwordComp));
if (userDTO != null) {
user = userDTO;
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/Account.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/Account.java 2009-08-19 15:48:01 UTC (rev 2736)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/Account.java 2009-08-20 13:00:52 UTC (rev 2737)
@@ -131,7 +131,7 @@
modify = true;
// L'utilisateur a renseigné le mauvais mot de passe
- if (serviceAuth.isLoginRight(newUser.getLogin(), MD5.encode(password)) == null) {
+ if (!serviceAuth.isLoginRight(newUser.getLogin(), MD5.encode(password))) {
myAccountForm.recordError(passwordField, messages
.get("badPassword"));
}
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/Register.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/Register.java 2009-08-19 15:48:01 UTC (rev 2736)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/Register.java 2009-08-20 13:00:52 UTC (rev 2737)
@@ -146,7 +146,7 @@
if (!registerForm.getHasErrors()) {
if (serviceUser.createUser(newUser, MD5.encode(password1)) != null) {
sendMailNotification();
- user = serviceAuth.isLoginRight(newUser.getLogin(), MD5
+ user = serviceAuth.getUser(newUser.getLogin(), MD5
.encode(password1));
return "Index";
}
Modified: trunk/pollen-votecounting/src/main/java/org/chorem/pollen/votecounting/services/ServiceVoteCountingImpl.java
===================================================================
--- trunk/pollen-votecounting/src/main/java/org/chorem/pollen/votecounting/services/ServiceVoteCountingImpl.java 2009-08-19 15:48:01 UTC (rev 2736)
+++ trunk/pollen-votecounting/src/main/java/org/chorem/pollen/votecounting/services/ServiceVoteCountingImpl.java 2009-08-20 13:00:52 UTC (rev 2737)
@@ -100,6 +100,11 @@
* @return resultat
*/
private VoteCountingResultDTO execute(PollDTO poll) {
+ if (log.isInfoEnabled()) {
+ log.info("Dépouillement (byGroup=" + isByGroup + ") du sondage "
+ + poll.getPollId());
+ }
+
// Création et remplissage du contexte
this.createContext(poll.getVoteCounting());
this.fillContext(poll);
@@ -120,8 +125,8 @@
resChoice.setValue(choice.getValue());
resChoice.setPercentage(Utils.calculatePercentage(choice, choices));
resChoice.setResult(this.isChoiceResult(choice));
- if (log.isInfoEnabled()) {
- log.info(choice + " _ result ? " + resChoice.isResult());
+ if (log.isDebugEnabled()) {
+ log.debug(choice + " _ result ? " + resChoice.isResult());
}
resChoices.add(resChoice);
}
@@ -165,8 +170,8 @@
* @param poll : Sondage
*/
private void fillContext(PollDTO poll) {
- if (log.isInfoEnabled()) {
- log.info("Ajout poll : " + poll.getPollId());
+ if (log.isDebugEnabled()) {
+ log.debug("Ajout poll : " + poll.getPollId());
}
for (Object o : poll.getChoices()) {
PollChoiceDTO choice = (PollChoiceDTO) o;
@@ -184,8 +189,8 @@
* @param group : groupe lié au sondage
*/
private void routeGroup(VotingGroupDTO group) {
- if (log.isInfoEnabled()) {
- log.info("Ajout group : " + group.getIdGroup() + " _ weight="
+ if (log.isDebugEnabled()) {
+ log.debug("Ajout group : " + group.getIdGroup() + " _ weight="
+ group.getWeight());
}
this.context.addGroup(group.getIdGroup(), group.getWeight());
@@ -202,8 +207,8 @@
* @param person : personne ayant voté
*/
private void routePerson(VotingPersonDTO person) {
- if (log.isInfoEnabled()) {
- log.info("Ajout person : " + person.getVotingId() + " _ weight="
+ if (log.isDebugEnabled()) {
+ log.debug("Ajout person : " + person.getVotingId() + " _ weight="
+ person.getWeight());
}
for (Object o : person.getChoices()) {
@@ -221,8 +226,8 @@
*/
private void addVoteToContext(VoteToChoiceDTO vote, double weight,
String votingID) {
- if (log.isInfoEnabled()) {
- log.info("Ajout vote : " + vote.getValue() + " _ choice="
+ if (log.isDebugEnabled()) {
+ log.debug("Ajout vote : " + vote.getValue() + " _ choice="
+ vote.getIdChoice());
}
this.context.getChoice(vote.getIdChoice())
1
0
Author: nrannou
Date: 2009-08-19 17:48:01 +0200 (Wed, 19 Aug 2009)
New Revision: 2736
Modified:
trunk/README.txt
trunk/pollen-business/src/main/java/org/chorem/pollen/business/business/PreventRuleManager.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataPreventRuleConverter.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/PreventRuleDTO.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollImpl.java
trunk/pollen-business/src/test/java/org/chorem/pollen/business/business/PreventRuleManagerTest.java
trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServiceChoiceImplTest.java
trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServicePollImplTest.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Chart.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/FeedBack.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Image.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AppModule.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/BackgroundWorkerImpl.java
trunk/pollen-ui/src/main/resources/pollen.properties
trunk/todo.txt
Log:
correction recherche de sondages en cours + mails de rappel
Modified: trunk/README.txt
===================================================================
--- trunk/README.txt 2009-08-19 08:50:33 UTC (rev 2735)
+++ trunk/README.txt 2009-08-19 15:48:01 UTC (rev 2736)
@@ -39,6 +39,9 @@
# Répertoire des flux de syndication (Atom)
feedDir=/tmp/pollen/feeds
+
+ # Adresse du site (utilisée pour les emails de rappel)
+ siteUrl=http://www.site.org/pollen/
Pour une base PostgreSQL on aura :
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/business/PreventRuleManager.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/business/PreventRuleManager.java 2009-08-19 08:50:33 UTC (rev 2735)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/business/PreventRuleManager.java 2009-08-19 15:48:01 UTC (rev 2736)
@@ -33,6 +33,8 @@
*/
public class PreventRuleManager {
+ /** Représente l'action qui ne fait rien. */
+ public static final String NULL_ACTION = "nullAction";
/** Représente l'action qui écrit sur la sortie standard. */
public static final String PRINT_ACTION = "printAction";
/** Représente l'action qui envoi un email de notification. */
@@ -103,6 +105,20 @@
* @return true si la méthode à été exécutée, false sinon.
*/
public boolean execute(String scope, Integer value, Object data) {
+
+ // Si la règle n'est pas active, on ne fait rien
+ if (!preventRule.isActive()) {
+ log.debug("Règle non active");
+ return false;
+ }
+
+ // Si la règle est à exécution unique, on la désactive
+ if (preventRule.isOneTime()) {
+ log.debug("Règle à exécution unique : désactivation");
+ preventRule.setActive(false);
+ }
+
+ // Si la règle est répétitive (exécution tous les n), on met à jour la valeur
if (value != null && preventRule.isRepeated()
&& preventRule.getSensibility() != 0) {
value = value % preventRule.getSensibility()
@@ -133,6 +149,13 @@
}
/**
+ * Action qui ne fait rien.
+ */
+ public static void nullAction(Object data) {
+ // ne fait rien
+ }
+
+ /**
* Action qui écrit sur la sortie standard.
*/
public static void printAction(Object data) {
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataPreventRuleConverter.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataPreventRuleConverter.java 2009-08-19 08:50:33 UTC (rev 2735)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataPreventRuleConverter.java 2009-08-19 15:48:01 UTC (rev 2736)
@@ -46,6 +46,8 @@
PreventRule ePreventRule) throws TopiaException {
ePreventRule.setScope(preventRuleDTO.getScope());
ePreventRule.setSensibility(preventRuleDTO.getSensibility());
+ ePreventRule.setActive(preventRuleDTO.isActive());
+ ePreventRule.setOneTime(preventRuleDTO.isOneTime());
ePreventRule.setRepeated(preventRuleDTO.isRepeated());
ePreventRule.setMethod(preventRuleDTO.getMethod());
@@ -68,6 +70,8 @@
preventRuleDTO.setId(preventRule.getTopiaId());
preventRuleDTO.setScope(preventRule.getScope());
preventRuleDTO.setSensibility(preventRule.getSensibility());
+ preventRuleDTO.setActive(preventRule.getActive());
+ preventRuleDTO.setOneTime(preventRule.getOneTime());
preventRuleDTO.setRepeated(preventRule.getRepeated());
preventRuleDTO.setMethod(preventRule.getMethod());
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/PreventRuleDTO.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/PreventRuleDTO.java 2009-08-19 08:50:33 UTC (rev 2735)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/PreventRuleDTO.java 2009-08-19 15:48:01 UTC (rev 2736)
@@ -35,6 +35,10 @@
private int sensibility = 0;
+ private boolean active = true;
+
+ private boolean oneTime = false;
+
private boolean repeated = false;
private String method = "";
@@ -97,6 +101,22 @@
this.sensibility = sensibility;
}
+ public boolean isActive() {
+ return active;
+ }
+
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+ public boolean isOneTime() {
+ return oneTime;
+ }
+
+ public void setOneTime(boolean oneTime) {
+ this.oneTime = oneTime;
+ }
+
public boolean isRepeated() {
return repeated;
}
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollImpl.java 2009-08-19 08:50:33 UTC (rev 2735)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollImpl.java 2009-08-19 15:48:01 UTC (rev 2736)
@@ -418,12 +418,14 @@
pollEntities = transaction
.find("from "
+ Poll.class.getName()
- + " as poll where poll.endDate is not null and poll.endDate > current_timestamp()");
+ + " as poll where (poll.endDate is not null and poll.endDate > current_timestamp())"
+ + " and (poll.beginDate is null or poll.beginDate < current_timestamp())");
} else {
pollEntities = transaction
.find("from "
+ Poll.class.getName()
- + " as poll where poll.endDate is null or poll.endDate > current_timestamp()");
+ + " as poll where (poll.endDate is null or poll.endDate > current_timestamp())"
+ + " and (poll.beginDate is null or poll.beginDate < current_timestamp())");
}
converter.setTransaction(transaction);
Modified: trunk/pollen-business/src/test/java/org/chorem/pollen/business/business/PreventRuleManagerTest.java
===================================================================
--- trunk/pollen-business/src/test/java/org/chorem/pollen/business/business/PreventRuleManagerTest.java 2009-08-19 08:50:33 UTC (rev 2735)
+++ trunk/pollen-business/src/test/java/org/chorem/pollen/business/business/PreventRuleManagerTest.java 2009-08-19 15:48:01 UTC (rev 2736)
@@ -92,4 +92,24 @@
assertFalse(manager.execute(1));
assertFalse(manager.execute(5));
}
+
+ /**
+ * Test of execute method, of class PreventRuleManager. Using PRINT_ACTION
+ * oneTime execution.
+ */
+ @Test
+ public void testPrintActionOneTime() {
+ PreventRuleDTO preventRule = new PreventRuleDTO("test", 2, false,
+ PreventRuleManager.PRINT_ACTION);
+ preventRule.setOneTime(true);
+ manager = new PreventRuleManager(preventRule);
+
+ assertTrue(manager.execute(2));
+ assertFalse(manager.execute(2));
+
+ preventRule.setActive(true);
+
+ assertTrue(manager.execute(2));
+ assertFalse(manager.execute(2));
+ }
}
\ No newline at end of file
Modified: trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServiceChoiceImplTest.java
===================================================================
--- trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServiceChoiceImplTest.java 2009-08-19 08:50:33 UTC (rev 2735)
+++ trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServiceChoiceImplTest.java 2009-08-19 15:48:01 UTC (rev 2736)
@@ -68,7 +68,7 @@
}
/**
- * Test of createChoice method, of class ChoiceImpl.
+ * Test of createChoice method, of class ServiceChoiceImpl.
*/
@Test
public void testCreateChoice() {
@@ -85,7 +85,7 @@
}
/**
- * Test of createChoices method, of class ChoiceImpl.
+ * Test of createChoices method, of class ServiceChoiceImpl.
*/
@Test
public void testCreateChoices() {
@@ -101,7 +101,7 @@
}
/**
- * Test of updateChoice method, of class ChoiceImpl.
+ * Test of updateChoice method, of class ServiceChoiceImpl.
*/
@Test
public void testUpdateChoice() {
@@ -117,7 +117,7 @@
}
/**
- * Test of deleteChoice method, of class ChoiceImpl.
+ * Test of deleteChoice method, of class ServiceChoiceImpl.
*/
@Test
public void testDeleteChoice() {
@@ -132,7 +132,7 @@
}
/**
- * Test of findChoiceById method, of class ChoiceImpl.
+ * Test of findChoiceById method, of class ServiceChoiceImpl.
*/
@Test
public void testFindChoiceById() {
@@ -147,7 +147,7 @@
}
/**
- * Test of selectChoices method, of class ChoiceImpl.
+ * Test of selectChoices method, of class ServiceChoiceImpl.
*/
@Test
public void testSelectChoices() {
Modified: trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServicePollImplTest.java
===================================================================
--- trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServicePollImplTest.java 2009-08-19 08:50:33 UTC (rev 2735)
+++ trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServicePollImplTest.java 2009-08-19 15:48:01 UTC (rev 2736)
@@ -224,6 +224,12 @@
poll3.setEndDate(new Date(now.getTime() - 100000));
instance.createPoll(poll3);
+ // sondage pas commencé
+ PollDTO poll4 = new PollDTO();
+ poll4.setTitle("Test_findRunningPolls4");
+ poll4.setBeginDate(new Date(now.getTime() + 100000));
+ instance.createPoll(poll4);
+
List<PollDTO> result1 = instance.findRunningPolls(true);
List<PollDTO> result2 = instance.findRunningPolls(false);
assertTrue(result2.size() > result1.size());
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Chart.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Chart.java 2009-08-19 08:50:33 UTC (rev 2735)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Chart.java 2009-08-19 15:48:01 UTC (rev 2736)
@@ -52,10 +52,8 @@
* <pre>
* Utilisation :
* <t:chart width="210" height="190" values="choice" title="title" type="1"/>
- *
* - choice est une liste de chaînes représentant les labels et leur valeurs respectives. ({"val1", "20", "val2", "10"}...)
* - type est le type de représentation du diagramme (1:PIE, 2:PIE3D...)
- *
* Pour généraliser à d'autres types de graphes il faudrait passer un JFreeChart :
* Persist Parameter(required=true)
* private JFreeChart _chart;
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/FeedBack.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/FeedBack.java 2009-08-19 08:50:33 UTC (rev 2735)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/FeedBack.java 2009-08-19 15:48:01 UTC (rev 2736)
@@ -36,7 +36,6 @@
* <pre>
* Utilisation :
* <t:feedback t:id="feedback"/>
- *
* @Component(id = "feedback") private FeedBack feedback;
* feedback.addInfo("message d'info");
* feedback.addError("message d'erreur");
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Image.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Image.java 2009-08-19 08:50:33 UTC (rev 2735)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Image.java 2009-08-19 15:48:01 UTC (rev 2736)
@@ -43,7 +43,6 @@
* <pre>
* Utilisation :
* <t:image src="/img/image.png" />
- *
* Pour afficher une image statique il est préférable d'utiliser :
* <img src="${asset:context:img}/image.png" />
* </pre>
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AppModule.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AppModule.java 2009-08-19 08:50:33 UTC (rev 2735)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AppModule.java 2009-08-19 15:48:01 UTC (rev 2736)
@@ -20,6 +20,7 @@
import org.apache.tapestry5.SymbolConstants;
import org.apache.tapestry5.ioc.MappedConfiguration;
+import org.apache.tapestry5.ioc.Messages;
import org.apache.tapestry5.ioc.OrderedConfiguration;
import org.apache.tapestry5.ioc.ServiceBinder;
import org.apache.tapestry5.ioc.annotations.EagerLoad;
@@ -28,6 +29,7 @@
import org.apache.tapestry5.ioc.services.RegistryShutdownHub;
import org.apache.tapestry5.ioc.services.RegistryShutdownListener;
import org.apache.tapestry5.ioc.services.SymbolProvider;
+import org.apache.tapestry5.services.ComponentSource;
import org.apache.tapestry5.services.Request;
import org.apache.tapestry5.services.RequestFilter;
import org.apache.tapestry5.services.RequestHandler;
@@ -71,10 +73,6 @@
binder.bind(ServicePollAccount.class);
binder.bind(ServiceResults.class);
binder.bind(ServiceVote.class);
-
- // UI specific services
- //binder.bind(Configuration.class);
- //binder.bind(BackgroundWorker.class).eagerLoad();
}
public static void contributeApplicationDefaults(
@@ -161,14 +159,14 @@
* This is the BackgroundWorker service definition. It build the service
* giving a Messages object for localization in the service.
*/
- /*@EagerLoad
+ @EagerLoad
public static BackgroundWorker buildBackgroundWorker(
ComponentSource componentSource, Configuration configuration,
ServicePoll servicePoll) {
Messages messages = componentSource.getPage("LocalMessages")
.getComponentResources().getMessages();
return new BackgroundWorkerImpl(messages, configuration, servicePoll);
- }*/
+ }
/**
* Make configuration from a Properties file available as symbols.
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/BackgroundWorkerImpl.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/BackgroundWorkerImpl.java 2009-08-19 08:50:33 UTC (rev 2735)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/BackgroundWorkerImpl.java 2009-08-19 15:48:01 UTC (rev 2736)
@@ -32,6 +32,8 @@
import org.chorem.pollen.business.dto.PreventRuleDTO;
import org.chorem.pollen.business.dto.VotingListDTO;
import org.chorem.pollen.business.services.ServicePoll;
+import org.chorem.pollen.business.services.ServicePreventRule;
+import org.chorem.pollen.business.services.ServicePreventRuleImpl;
/**
* Implémentation du service BackgroundWorker.
@@ -74,7 +76,13 @@
* Lancement des tâches en arrière-plan.
*/
public void executeTasks() {
- timer.schedule(new MailingTask(), 10000, 10000);
+ if ("".equals(conf.getProperty("siteUrl"))) {
+ log
+ .warn("No property siteUrl. Reminder emails would not contain it");
+ }
+
+ // Exécution de la tâche toutes les 10 min
+ timer.schedule(new MailingTask(), 600000, 600000);
}
/**
@@ -97,6 +105,8 @@
// Parcours des preventRules de chaque sondage
// envoi d'un email si endDate-nowDate <= preventRuleSensibility
if (poll.getEndDate() != null) {
+
+ // timeValue = endDate-nowDate
Long timeValue = poll.getEndDate().getTime()
- now.getTime();
@@ -107,9 +117,6 @@
}
// envoi des mails avec une sensibilité de l'ordre de l'heure
- if (log.isInfoEnabled()) {
- log.info("Sending reminder emails...");
- }
sendMailNotification(poll, timeValue / 3600000);
}
}
@@ -130,21 +137,37 @@
data.put("from", conf.getProperty("email_from"));
// Mails aux votants
- for (VotingListDTO list : poll.getVotingListDTOs()) {
- for (PollAccountDTO account : list.getPollAccountDTOs()) {
- if (account.getEmail() != null) {
- data.put("to", account.getEmail());
- data.put("title", messages.format("reminderEmail_subject",
- poll.getTitle()));
- data.put("msg", messages.format("reminderEmail_msg", poll
- .getTitle(), account.getVotingId(), voteURL));
+ for (PreventRuleDTO rule : poll.getPreventRuleDTOs()) {
+ if (rule.isActive()) {
+ Boolean hasRun = false;
+ PreventRuleManager manager = new PreventRuleManager(rule);
+ for (VotingListDTO list : poll.getVotingListDTOs()) {
+ for (PollAccountDTO account : list.getPollAccountDTOs()) {
+ if (account.getEmail() != null) {
+ String accountVoteURL = voteURL + ":"
+ + account.getAccountId();
- for (PreventRuleDTO rule : poll.getPreventRuleDTOs()) {
- PreventRuleManager manager = new PreventRuleManager(
- rule);
- manager.execute("rappel", timeValue.intValue(), data);
+ data.put("to", account.getEmail());
+ data.put("title", messages.format(
+ "reminderEmail_subject", poll.getTitle()));
+ data.put("msg", messages.format(
+ "reminderEmail_msg", poll.getTitle(),
+ account.getVotingId(), accountVoteURL));
+
+ // Exécution de la règle avec une valeur +1
+ // Sensibilité de 2h : 2h05 KO, 1h55 OK
+ hasRun = manager.execute("rappel", timeValue
+ .intValue() + 1, data);
+ }
}
}
+
+ // désactivation de la règle de rappel pour éviter qu'elle soit réexécutée
+ if (hasRun) {
+ rule.setActive(false);
+ ServicePreventRule spr = new ServicePreventRuleImpl();
+ spr.updatePreventRule(rule);
+ }
}
}
}
Modified: trunk/pollen-ui/src/main/resources/pollen.properties
===================================================================
--- trunk/pollen-ui/src/main/resources/pollen.properties 2009-08-19 08:50:33 UTC (rev 2735)
+++ trunk/pollen-ui/src/main/resources/pollen.properties 2009-08-19 15:48:01 UTC (rev 2736)
@@ -46,8 +46,8 @@
## Répertoire des flux de syndication (Atom)
feedDir=/tmp/pollen/feeds
-## Adresse du site
-siteUrl=http://localhost:8090/pollen-ui/
+## Adresse du site (utilisée pour les emails de rappel)
+siteUrl=
## Version de l'application
version=${project.version}
\ No newline at end of file
Modified: trunk/todo.txt
===================================================================
--- trunk/todo.txt 2009-08-19 08:50:33 UTC (rev 2735)
+++ trunk/todo.txt 2009-08-19 15:48:01 UTC (rev 2736)
@@ -1,6 +1,5 @@
TODO
-envoi emails de rappel
amélioration des tests
1
0