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
January 2012
- 4 participants
- 33 discussions
r3116 - branches/pollen-2.0-beta-1/pollen-domain/src/main/resources/i18n
by tchemit@users.chorem.org 24 Jan '12
by tchemit@users.chorem.org 24 Jan '12
24 Jan '12
Author: tchemit
Date: 2012-01-24 15:15:07 +0100 (Tue, 24 Jan 2012)
New Revision: 3116
Url: http://chorem.org/repositories/revision/pollen/3116
Log:
add svn properties
Modified:
branches/pollen-2.0-beta-1/pollen-domain/src/main/resources/i18n/pollen-domain_en_GB.properties
branches/pollen-2.0-beta-1/pollen-domain/src/main/resources/i18n/pollen-domain_fr_FR.properties
Property changes on: branches/pollen-2.0-beta-1/pollen-domain/src/main/resources/i18n/pollen-domain_en_GB.properties
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Property changes on: branches/pollen-2.0-beta-1/pollen-domain/src/main/resources/i18n/pollen-domain_fr_FR.properties
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
1
0
24 Jan '12
Author: tchemit
Date: 2012-01-24 15:11:32 +0100 (Tue, 24 Jan 2012)
New Revision: 3115
Url: http://chorem.org/repositories/revision/pollen/3115
Log:
- add i18n on enums
- clean codes (remo this., public modifiers on interfaces, usage of generics, for-each,...)
-This line, and those below, will be ignored--
M pollen-domain/src/test/java/org/chorem/pollen/votecounting/business/services/PollDTOCreatorVoteCounting.java
M pollen-domain/src/test/java/org/chorem/pollen/votecounting/business/services/PollDTOCreator.java
M pollen-domain/src/main/java/org/chorem/pollen/votecounting/utils/ListBehavior.java
M pollen-domain/src/main/java/org/chorem/pollen/votecounting/utils/PercentageBehavior.java
M pollen-domain/src/main/java/org/chorem/pollen/votecounting/services/ServiceExport.java
M pollen-domain/src/main/java/org/chorem/pollen/votecounting/services/ServiceExportImpl.java
M pollen-domain/src/main/java/org/chorem/pollen/votecounting/services/ServiceVoteCounting.java
M pollen-domain/src/main/java/org/chorem/pollen/votecounting/services/ServiceVoteCountingImpl.java
M pollen-domain/src/main/java/org/chorem/pollen/votecounting/dto/VotingPersonDTO.java
M pollen-domain/src/main/java/org/chorem/pollen/votecounting/dto/PollChoiceDTO.java
M pollen-domain/src/main/java/org/chorem/pollen/votecounting/dto/VotingGroupDTO.java
M pollen-domain/src/main/java/org/chorem/pollen/votecounting/dto/PollDTO.java
M pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/Method.java
M pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/CondorcetMethod.java
M pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/StandardMethod.java
M pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/Context.java
M pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/Choice.java
M pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/Group.java
M pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/Vote.java
M pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/PercentageMethod.java
M pollen-domain/src/main/java/org/chorem/pollen/common/VoteCountingType.java
M pollen-domain/src/main/java/org/chorem/pollen/common/PollType.java
M pollen-domain/src/main/java/org/chorem/pollen/common/ChoiceType.java
A pollen-domain/src/main/resources/i18n
AM pollen-domain/src/main/resources/i18n/pollen-domain_en_GB.properties
AM pollen-domain/src/main/resources/i18n/pollen-domain_fr_FR.properties
M pollen-domain/pom.xml
Added:
branches/pollen-2.0-beta-1/pollen-domain/src/main/resources/i18n/
branches/pollen-2.0-beta-1/pollen-domain/src/main/resources/i18n/pollen-domain_en_GB.properties
branches/pollen-2.0-beta-1/pollen-domain/src/main/resources/i18n/pollen-domain_fr_FR.properties
Modified:
branches/pollen-2.0-beta-1/pollen-domain/pom.xml
branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/common/ChoiceType.java
branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/common/PollType.java
branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/common/VoteCountingType.java
branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/Choice.java
branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/CondorcetMethod.java
branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/Context.java
branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/Group.java
branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/Method.java
branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/PercentageMethod.java
branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/StandardMethod.java
branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/Vote.java
branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/dto/PollChoiceDTO.java
branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/dto/PollDTO.java
branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/dto/VotingGroupDTO.java
branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/dto/VotingPersonDTO.java
branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/services/ServiceExport.java
branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/services/ServiceExportImpl.java
branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/services/ServiceVoteCounting.java
branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/services/ServiceVoteCountingImpl.java
branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/utils/ListBehavior.java
branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/utils/PercentageBehavior.java
branches/pollen-2.0-beta-1/pollen-domain/src/test/java/org/chorem/pollen/votecounting/business/services/PollDTOCreator.java
branches/pollen-2.0-beta-1/pollen-domain/src/test/java/org/chorem/pollen/votecounting/business/services/PollDTOCreatorVoteCounting.java
Modified: branches/pollen-2.0-beta-1/pollen-domain/pom.xml
===================================================================
--- branches/pollen-2.0-beta-1/pollen-domain/pom.xml 2012-01-24 10:08:09 UTC (rev 3114)
+++ branches/pollen-2.0-beta-1/pollen-domain/pom.xml 2012-01-24 14:11:32 UTC (rev 3115)
@@ -21,6 +21,10 @@
<artifactId>commons-logging</artifactId>
</dependency>
<dependency>
+ <groupId>org.nuiton.i18n</groupId>
+ <artifactId>nuiton-i18n</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom</artifactId>
</dependency>
@@ -34,4 +38,20 @@
<name>Pollen :: Domain</name>
<description>Service de dépouillement</description>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.nuiton.i18n</groupId>
+ <artifactId>maven-i18n-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>parserJava</goal>
+ <goal>gen</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</project>
Modified: branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/common/ChoiceType.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/common/ChoiceType.java 2012-01-24 10:08:09 UTC (rev 3114)
+++ branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/common/ChoiceType.java 2012-01-24 14:11:32 UTC (rev 3115)
@@ -39,19 +39,33 @@
package org.chorem.pollen.common;
+import static org.nuiton.i18n.I18n.n_;
+
public enum ChoiceType {
- TEXT, DATE, IMAGE;
+ TEXT(n_("pollen.choiceType.text")),
+ DATE(n_("pollen.choiceType.date")),
+ IMAGE(n_("pollen.choiceType.image"));
+ private final String i18nKey;
+
+ ChoiceType(String i18nKey) {
+ this.i18nKey = i18nKey;
+ }
+
+ public String getI18nKey() {
+ return i18nKey;
+ }
+
public boolean isText() {
- return this.equals(TEXT);
+ return equals(TEXT);
}
public boolean isDate() {
- return this.equals(DATE);
+ return equals(DATE);
}
public boolean isImage() {
- return this.equals(IMAGE);
+ return equals(IMAGE);
}
public static ChoiceType valueOf(int ordinal) {
Modified: branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/common/PollType.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/common/PollType.java 2012-01-24 10:08:09 UTC (rev 3114)
+++ branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/common/PollType.java 2012-01-24 14:11:32 UTC (rev 3115)
@@ -39,19 +39,34 @@
package org.chorem.pollen.common;
+import static org.nuiton.i18n.I18n.n_;
+
public enum PollType {
- FREE, RESTRICTED, GROUP;
+ FREE(n_("pollen.pollType.free")),
+ RESTRICTED(n_("pollen.pollType.restricted")),
+ GROUP(n_("pollen.pollType.group"));
+
+ private final String i18nKey;
+
+ PollType(String i18nKey) {
+ this.i18nKey = i18nKey;
+ }
+
+ public String getI18nKey() {
+ return i18nKey;
+ }
+
public boolean isFree() {
- return this.equals(FREE);
+ return equals(FREE);
}
public boolean isRestricted() {
- return this.equals(RESTRICTED);
+ return equals(RESTRICTED);
}
public boolean isGroup() {
- return this.equals(GROUP);
+ return equals(GROUP);
}
public boolean isRestrictedOrGroup() {
Modified: branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/common/VoteCountingType.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/common/VoteCountingType.java 2012-01-24 10:08:09 UTC (rev 3114)
+++ branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/common/VoteCountingType.java 2012-01-24 14:11:32 UTC (rev 3115)
@@ -39,23 +39,38 @@
package org.chorem.pollen.common;
+import static org.nuiton.i18n.I18n.n_;
+
public enum VoteCountingType {
- NORMAL, PERCENTAGE, CONDORCET, NUMBER;
+ NORMAL(n_("pollen.voteCountingType.normal")),
+ PERCENTAGE(n_("pollen.voteCountingType.percentage")),
+ CONDORCET(n_("pollen.voteCountingType.condorcet")),
+ NUMBER(n_("pollen.voteCountingType.number"));
+ private final String i18nKey;
+
+ VoteCountingType(String i18nKey) {
+ this.i18nKey = i18nKey;
+ }
+
+ public String getI18nKey() {
+ return i18nKey;
+ }
+
public boolean isNormal() {
- return this.equals(NORMAL);
+ return equals(NORMAL);
}
public boolean isPercentage() {
- return this.equals(PERCENTAGE);
+ return equals(PERCENTAGE);
}
public boolean isCondorcet() {
- return this.equals(CONDORCET);
+ return equals(CONDORCET);
}
public boolean isNumber() {
- return this.equals(NUMBER);
+ return equals(NUMBER);
}
public static VoteCountingType valueOf(int ordinal) {
Modified: branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/Choice.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/Choice.java 2012-01-24 10:08:09 UTC (rev 3114)
+++ branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/Choice.java 2012-01-24 14:11:32 UTC (rev 3115)
@@ -76,9 +76,9 @@
* @param id : identifiant du choix
*/
public Choice(String id) {
- this.idChoice = id;
- this.groups = new ArrayList<Group>();
- this.value = 0.;
+ idChoice = id;
+ groups = new ArrayList<Group>();
+ value = 0.;
}
/**
@@ -107,7 +107,7 @@
* @return valeur courante du choix
*/
public double getValue() {
- return this.value;
+ return value;
}
/**
@@ -116,7 +116,7 @@
* @return identifiant du choix
*/
public String getIdChoice() {
- return this.idChoice;
+ return idChoice;
}
/**
@@ -125,7 +125,7 @@
* @return nom du choix
*/
public String getName() {
- return this.name;
+ return name;
}
/**
@@ -134,7 +134,7 @@
* @return map des groupes pour ce choix
*/
public List<Group> getGroups() {
- return this.groups;
+ return groups;
}
/**
@@ -144,7 +144,7 @@
* @param idGroup : identifiant du groupe
*/
public void addGroup(String idGroup, double weight) {
- this.groups.add(new Group(idGroup, weight));
+ groups.add(new Group(idGroup, weight));
}
/**
@@ -154,7 +154,7 @@
* @return le groupe ayant l'identifiant idGroup
*/
public Group getGroup(String idGroup) {
- for (Group g : this.groups) {
+ for (Group g : groups) {
if (g.getIdGroup().equals(idGroup)) {
return g;
}
Modified: branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/CondorcetMethod.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/CondorcetMethod.java 2012-01-24 10:08:09 UTC (rev 3114)
+++ branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/CondorcetMethod.java 2012-01-24 14:11:32 UTC (rev 3115)
@@ -180,8 +180,7 @@
* autres votes du votant et mise à jour du nombre de victoires pour ce
* vote.
*
- * @see getVictories(String id, Choice choice, Map<String, Map<Choice,
- * Double>> votes)
+ * @see #getVictories(String, Choice choice, Map)
* @param choices Les choix utilisés pour le dépouillement.
* @param votes Les votes de chaque votant.
* @param byGroup Calcul sur des groupes.
Modified: branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/Context.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/Context.java 2012-01-24 10:08:09 UTC (rev 3114)
+++ branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/Context.java 2012-01-24 14:11:32 UTC (rev 3115)
@@ -81,9 +81,9 @@
*/
public Context(Method method, boolean groupCounting) {
this.groupCounting = groupCounting;
- this.choices = new ArrayList<Choice>();
- this.hiddenChoices = new ArrayList<Choice>();
- this.results = new ArrayList<Choice>();
+ choices = new ArrayList<Choice>();
+ hiddenChoices = new ArrayList<Choice>();
+ results = new ArrayList<Choice>();
this.method = method;
}
@@ -94,12 +94,12 @@
* @return choix
*/
public Choice getChoice(String idChoice) {
- for (Choice choice : this.choices) {
+ for (Choice choice : choices) {
if (choice.getIdChoice().equals(idChoice)) {
return choice;
}
}
- for (Choice choice : this.hiddenChoices) {
+ for (Choice choice : hiddenChoices) {
if (choice.getIdChoice().equals(idChoice)) {
return choice;
}
@@ -113,7 +113,7 @@
* @return liste des choix
*/
public List<Choice> getChoices() {
- return this.choices;
+ return choices;
}
/**
@@ -122,7 +122,7 @@
* @return liste des choix cachés
*/
public List<Choice> getHiddenChoices() {
- return this.hiddenChoices;
+ return hiddenChoices;
}
/**
@@ -131,25 +131,25 @@
* @return liste des choix résultats
*/
public List<Choice> getResults() {
- return this.results;
+ return results;
}
/**
* Ajout d'un nouveau choix au contexte
*
- * @param idChoice : identifiant du choix
+ * @param choice : identifiant du choix
*/
public void addChoice(PollChoiceDTO choice) {
- this.choices.add(new Choice(choice.getIdChoice(), choice.getName()));
+ choices.add(new Choice(choice.getIdChoice(), choice.getName()));
}
/**
* Ajout d'un nouveau choix au contexte
*
- * @param idChoice : identifiant du choix
+ * @param choice : identifiant du choix
*/
public void addHiddenChoice(PollChoiceDTO choice) {
- this.hiddenChoices.add(new Choice(choice.getIdChoice(), choice.getName()));
+ hiddenChoices.add(new Choice(choice.getIdChoice(), choice.getName()));
}
/**
@@ -159,10 +159,10 @@
* @param weight : poids du groupe
*/
public void addGroup(String idGroup, double weight) {
- for (Choice choice : this.choices) {
+ for (Choice choice : choices) {
choice.addGroup(idGroup, weight);
}
- for (Choice choice : this.hiddenChoices) {
+ for (Choice choice : hiddenChoices) {
choice.addGroup(idGroup, weight);
}
}
@@ -196,20 +196,20 @@
log.error("L'exécution du dépouillement a échoué", e);
return false;
}
-
- this.results.clear();
+
+ results.clear();
Choice result = new Choice("");
- for (Choice curr : this.choices) {
+ for (Choice curr : choices) {
if (curr.value() > result.value()) {
result = curr;
- this.results.clear();
+ results.clear();
} else if (curr.value() == result.value()) {
- this.results.add(curr);
+ results.add(curr);
}
}
-
- this.results.add(result);
+
+ results.add(result);
return true;
}
Modified: branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/Group.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/Group.java 2012-01-24 10:08:09 UTC (rev 3114)
+++ branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/Group.java 2012-01-24 14:11:32 UTC (rev 3115)
@@ -76,10 +76,10 @@
* @param weight : poids du groupe
*/
public Group(String id, double weight) {
- this.idGroup = id;
+ idGroup = id;
this.weight = weight;
- this.value = 0.;
- this.votes = new ArrayList<Vote>();
+ value = 0.;
+ votes = new ArrayList<Vote>();
}
/**
@@ -88,7 +88,7 @@
* @return identifiant du groupe
*/
public String getIdGroup() {
- return this.idGroup;
+ return idGroup;
}
/**
@@ -97,7 +97,7 @@
* @return poids du groupe
*/
public double getWeight() {
- return this.weight;
+ return weight;
}
/**
@@ -115,7 +115,7 @@
* @return la valeur du groupe
*/
public double getValue() {
- return this.value;
+ return value;
}
/**
@@ -124,7 +124,7 @@
* @return liste des votes
*/
public List<Vote> getVotes() {
- return this.votes;
+ return votes;
}
/**
@@ -132,9 +132,10 @@
*
* @param value : valeur du vote
* @param weight : poids du vote
+ * @param votingID id of vote
*/
public void addVote(double value, double weight, String votingID) {
- this.votes.add(new Vote(value, weight, votingID));
+ votes.add(new Vote(value, weight, votingID));
}
@Override
Modified: branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/Method.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/Method.java 2012-01-24 10:08:09 UTC (rev 3114)
+++ branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/Method.java 2012-01-24 14:11:32 UTC (rev 3115)
@@ -55,7 +55,7 @@
* @param choices l'ensemble des choix à dépouiller
* @param groupCounting si le dépouillement doit être groupé
*/
- public void executeCounting(List<Choice> choices, boolean groupCounting);
+ void executeCounting(List<Choice> choices, boolean groupCounting);
/**
* Effectue des statistiques sur le <code>choice</code> specifié.
@@ -68,6 +68,6 @@
* @param choice le choix sur lequel effectuer des statistiques
* @param choiceDTO le choix contenant les resultats statistiques
*/
- public void executeStats(List<Choice> choices, boolean groupCounting,
- Choice choice, ChoiceDTO choiceDTO);
+ void executeStats(List<Choice> choices, boolean groupCounting,
+ Choice choice, ChoiceDTO choiceDTO);
}
Modified: branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/PercentageMethod.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/PercentageMethod.java 2012-01-24 10:08:09 UTC (rev 3114)
+++ branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/PercentageMethod.java 2012-01-24 14:11:32 UTC (rev 3115)
@@ -48,7 +48,7 @@
* @author rannou
* @version $Id$
*/
-public class PercentageMethod extends StandardMethod implements Method {
+public class PercentageMethod extends StandardMethod {
@Override
public double getValueForChoiceByGroup(Choice choice, String idGroup,
Modified: branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/StandardMethod.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/StandardMethod.java 2012-01-24 10:08:09 UTC (rev 3114)
+++ branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/StandardMethod.java 2012-01-24 14:11:32 UTC (rev 3115)
@@ -68,7 +68,7 @@
for (Choice choice : choices) {
double totalChoice = 0.;
for (Group group : choice.getGroups()) {
- this.getValueForGroup(group);
+ getValueForGroup(group);
totalChoice += group.getValue();
}
choice.setValue(totalChoice);
@@ -85,13 +85,12 @@
// Calcul avec prise en compte des groupes
public void calculateChoicesByGroup(List<Choice> choices) {
- Map<String, List<String>> mapGroupsChoosenChoices = this
- .getChoosenChoicesByGroup(choices);
+ Map<String, List<String>> mapGroupsChoosenChoices = getChoosenChoicesByGroup(choices);
for (Choice choice : choices) {
double totalChoice = 0.;
for (String idGroup : mapGroupsChoosenChoices.keySet()) {
- totalChoice += this.getValueForChoiceByGroup(choice, idGroup,
+ totalChoice += getValueForChoiceByGroup(choice, idGroup,
mapGroupsChoosenChoices.get(idGroup));
}
choice.setValue(totalChoice);
Modified: branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/Vote.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/Vote.java 2012-01-24 10:08:09 UTC (rev 3114)
+++ branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/business/Vote.java 2012-01-24 14:11:32 UTC (rev 3115)
@@ -75,7 +75,7 @@
* @return valeur du vote
*/
public double getValue() {
- return this.value;
+ return value;
}
/**
@@ -84,7 +84,7 @@
* @return poids du vote
*/
public double getWeight() {
- return this.weight;
+ return weight;
}
/**
@@ -93,6 +93,6 @@
* @return identifiant du votant
*/
public String getVotingID() {
- return this.votingID;
+ return votingID;
}
}
Modified: branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/dto/PollChoiceDTO.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/dto/PollChoiceDTO.java 2012-01-24 10:08:09 UTC (rev 3114)
+++ branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/dto/PollChoiceDTO.java 2012-01-24 14:11:32 UTC (rev 3115)
@@ -55,16 +55,16 @@
public PollChoiceDTO(String idChoice) {
this.idChoice = idChoice;
- this.name = "";
- this.description = "";
- this.hidden = false;
+ name = "";
+ description = "";
+ hidden = false;
}
public PollChoiceDTO(int idChoice) {
this.idChoice = String.valueOf(idChoice);
- this.name = "";
- this.description = "";
- this.hidden = false;
+ name = "";
+ description = "";
+ hidden = false;
}
public String getIdChoice() {
Modified: branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/dto/PollDTO.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/dto/PollDTO.java 2012-01-24 10:08:09 UTC (rev 3114)
+++ branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/dto/PollDTO.java 2012-01-24 14:11:32 UTC (rev 3115)
@@ -62,29 +62,29 @@
private Date beginDate = new Date();
- private Date endDate = null;
+ private Date endDate;
- private Date beginChoiceDate = null;
+ private Date beginChoiceDate;
- private int maxChoiceNb = 0;
+ private int maxChoiceNb;
private boolean closed = true;
- private boolean choiceAddAllowed = false;
+ private boolean choiceAddAllowed;
- private boolean anonymousVoteAllowed = false;
+ private boolean anonymousVoteAllowed;
- private boolean anonymous = false;
+ private boolean anonymous;
- private boolean publicResults = false;
+ private boolean publicResults;
- private boolean continuousResults = false;
+ private boolean continuousResults;
- private PollType pollType = null;
+ private PollType pollType;
- private VoteCountingType voteCounting = null;
+ private VoteCountingType voteCounting;
- private ChoiceType choiceType = null;
+ private ChoiceType choiceType;
private String creatorId = "";
Modified: branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/dto/VotingGroupDTO.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/dto/VotingGroupDTO.java 2012-01-24 10:08:09 UTC (rev 3114)
+++ branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/dto/VotingGroupDTO.java 2012-01-24 14:11:32 UTC (rev 3115)
@@ -62,7 +62,7 @@
public VotingGroupDTO(String idGroup, double weight) {
this.idGroup = idGroup;
this.weight = weight;
- this.votingPersons = new ArrayList<VotingPersonDTO>();
+ votingPersons = new ArrayList<VotingPersonDTO>();
}
@Override
Modified: branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/dto/VotingPersonDTO.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/dto/VotingPersonDTO.java 2012-01-24 10:08:09 UTC (rev 3114)
+++ branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/dto/VotingPersonDTO.java 2012-01-24 14:11:32 UTC (rev 3115)
@@ -65,11 +65,11 @@
private List<VoteToChoiceDTO> choices;
public VotingPersonDTO(String votingId, double weight) {
- this.choices = new ArrayList<VoteToChoiceDTO>();
- this.comment = "";
- this.email = "";
- this.login = "";
- this.votingDate = new Date();
+ choices = new ArrayList<VoteToChoiceDTO>();
+ comment = "";
+ email = "";
+ login = "";
+ votingDate = new Date();
this.votingId = votingId;
this.weight = weight;
}
Modified: branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/services/ServiceExport.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/services/ServiceExport.java 2012-01-24 10:08:09 UTC (rev 3114)
+++ branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/services/ServiceExport.java 2012-01-24 14:11:32 UTC (rev 3115)
@@ -58,7 +58,7 @@
* @param export : DTO à exporter.
* @return le chemin du fichier exporté.
*/
- public String executeExport(PollExportDTO export);
+ String executeExport(PollExportDTO export);
/**
* Export d'un sondage et de ses résultats au format XML. Le DTO contient le
@@ -67,7 +67,7 @@
* @param export : DTO à exporter.
* @return le fichier exporté.
*/
- public File executeFileExport(PollExportDTO export);
+ File executeFileExport(PollExportDTO export);
/**
* Import d'un sondage et de ses résultats à partir d'un fichier XML.
@@ -75,5 +75,5 @@
* @param filePath chemin du fichier à importer.
* @return le sondage importé
*/
- public PollExportDTO executeImport(String filePath);
+ PollExportDTO executeImport(String filePath);
}
Modified: branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/services/ServiceExportImpl.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/services/ServiceExportImpl.java 2012-01-24 10:08:09 UTC (rev 3114)
+++ branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/services/ServiceExportImpl.java 2012-01-24 14:11:32 UTC (rev 3115)
@@ -41,8 +41,8 @@
import java.io.File;
import java.io.FileOutputStream;
+import java.io.IOException;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import org.apache.commons.logging.Log;
@@ -137,8 +137,7 @@
/**
* Construction du document XML à partir du sondage.
*
- * @param le chemin du fichier à créer
- * @return le fichier créé
+ * @param filePath chemin du fichier à créer
*/
private void savePoll(String filePath) {
@@ -188,9 +187,8 @@
// Création des commentaires
Element commentsElm = new Element("comments");
- Iterator iteratorComment = poll.getComments().listIterator();
- while (iteratorComment.hasNext()) {
- Element commentElm = save((CommentDTO) iteratorComment.next());
+ for (CommentDTO commentDTO : poll.getComments()) {
+ Element commentElm = save(commentDTO);
commentsElm.addContent(commentElm);
}
@@ -199,9 +197,8 @@
// Création des groupes de votants
Element groupsElm = new Element("groups");
- Iterator iteratorGroup = poll.getVotingGroups().listIterator();
- while (iteratorGroup.hasNext()) {
- Element groupElm = save((VotingGroupDTO) iteratorGroup.next());
+ for (VotingGroupDTO votingGroupDTO : poll.getVotingGroups()) {
+ Element groupElm = save(votingGroupDTO);
groupsElm.addContent(groupElm);
}
@@ -210,9 +207,8 @@
// Création des choix
Element pollChoicesElm = new Element("pollChoices");
- Iterator itPollChoices = poll.getChoices().listIterator();
- while (itPollChoices.hasNext()) {
- Element pollChoiceElm = save((PollChoiceDTO) itPollChoices.next());
+ for (PollChoiceDTO pollChoiceDTO : poll.getChoices()) {
+ Element pollChoiceElm = save(pollChoiceDTO);
pollChoicesElm.addContent(pollChoiceElm);
}
pollElm.addContent(pollChoicesElm);
@@ -220,11 +216,8 @@
// Création des résultats
Element voteCountingResultsElm = new Element("voteCountingResults");
- Iterator iteratorvoteCountingResults = voteCountingResults
- .listIterator();
- while (iteratorvoteCountingResults.hasNext()) {
- Element voteCountingResult = save((VoteCountingResultDTO) iteratorvoteCountingResults
- .next());
+ for (VoteCountingResultDTO voteCountingResult1 : voteCountingResults) {
+ Element voteCountingResult = save(voteCountingResult1);
voteCountingResultsElm.addContent(voteCountingResult);
}
@@ -258,11 +251,8 @@
Element votingPersonsElm = new Element("votingPersons");
- Iterator iteratorVotingPersons = group.getVotingPersons()
- .listIterator();
- while (iteratorVotingPersons.hasNext()) {
- Element votingPersonElm = save((VotingPersonDTO) iteratorVotingPersons
- .next());
+ for (VotingPersonDTO votingPersonDTO : group.getVotingPersons()) {
+ Element votingPersonElm = save(votingPersonDTO);
votingPersonsElm.addContent(votingPersonElm);
}
groupElm.addContent(votingPersonsElm);
@@ -287,14 +277,11 @@
Element choicesElm = new Element("choices");
- Iterator iteratorChoices = votingPerson.getChoices().listIterator();
- while (iteratorChoices.hasNext()) {
- VoteToChoiceDTO voteToChoice = (VoteToChoiceDTO) iteratorChoices
- .next();
+ for (VoteToChoiceDTO voteToChoice : votingPerson.getChoices()) {
Element choiceElm = new Element("choice");
choiceElm.setAttribute("idChoice", voteToChoice.getIdChoice());
choiceElm.setAttribute("value", Double.toString(voteToChoice
- .getValue()));
+ .getValue()));
choicesElm.addContent(choiceElm);
}
@@ -339,10 +326,8 @@
Element choicesElm = new Element("choices");
- Iterator iteratorChoices = voteCountingResults.getChoices()
- .listIterator();
- while (iteratorChoices.hasNext()) {
- Element choiceElm = save((ChoiceDTO) iteratorChoices.next());
+ for (ChoiceDTO choiceDTO : voteCountingResults.getChoices()) {
+ Element choiceElm = save(choiceDTO);
choicesElm.addContent(choiceElm);
}
@@ -384,8 +369,13 @@
// Mise en forme classique avec getPrettyFormat()
XMLOutputter sortie = new XMLOutputter(Format.getPrettyFormat());
- sortie.output(document, new FileOutputStream(file));
- } catch (java.io.IOException e) {
+ FileOutputStream out = new FileOutputStream(file);
+ try {
+ sortie.output(document, out);
+ } finally {
+ out.close();
+ }
+ } catch (IOException e) {
log.error("Erreur lors de l'enregistrement du document : "
+ filePath, e);
}
@@ -430,14 +420,14 @@
// Ajout des commentaires
Element commentsElm = pollElm.getChild("comments");
List<Element> listComments = commentsElm.getChildren("comment");
- List vectorComments = loadComments(listComments);
+ List<CommentDTO> vectorComments = loadComments(listComments);
poll.setComments(vectorComments);
// Ajout des groupes
Element groupsElm = pollElm.getChild("groups");
List<Element> listGroups = groupsElm.getChildren("group");
- List vectorGroups = loadGroups(listGroups);
+ List<VotingGroupDTO> vectorGroups = loadGroups(listGroups);
poll.setVotingGroups(vectorGroups);
@@ -445,7 +435,7 @@
Element pollChoicesElm = pollElm.getChild("pollChoices");
List<Element> listPollChoices = pollChoicesElm
.getChildren("pollChoice");
- List vectorPollChoices = loadPollChoices(listPollChoices);
+ List<PollChoiceDTO> vectorPollChoices = loadPollChoices(listPollChoices);
poll.setChoices(vectorPollChoices);
@@ -453,7 +443,7 @@
Element voteCountingResultsElm = racine.getChild("voteCountingResults");
List<Element> listVoteCountingResults = voteCountingResultsElm
.getChildren("voteCountingResult");
- List vectorVoteCountingResults = loadVoteCountingResults(listVoteCountingResults);
+ List<VoteCountingResultDTO> vectorVoteCountingResults = loadVoteCountingResults(listVoteCountingResults);
// Création du sondage PollExportDTO
PollExportDTO pollExport = new PollExportDTO();
@@ -464,36 +454,32 @@
return pollExport;
}
- private List loadComments(List<Element> listComments) {
- List vectorComments = new ArrayList<CommentDTO>();
+ private List<CommentDTO> loadComments(List<Element> listComments) {
+ List<CommentDTO> vectorComments = new ArrayList<CommentDTO>();
- Iterator i = listComments.listIterator();
- while (i.hasNext()) {
- Element commentElm = (Element) i.next();
+ for (Element commentElm : listComments) {
CommentDTO comment = new CommentDTO(commentElm
- .getAttributeValue("votingId"), commentElm.getText());
+ .getAttributeValue("votingId"), commentElm.getText());
vectorComments.add(comment);
}
return vectorComments;
}
- private List loadGroups(List<Element> listGroups) {
- List vectorGroups = new ArrayList<VotingGroupDTO>();
+ private List<VotingGroupDTO> loadGroups(List<Element> listGroups) {
+ List<VotingGroupDTO> vectorGroups = new ArrayList<VotingGroupDTO>();
- Iterator i = listGroups.listIterator();
- while (i.hasNext()) {
- Element groupElm = (Element) i.next();
+ for (Element groupElm : listGroups) {
VotingGroupDTO group = new VotingGroupDTO(groupElm
- .getAttributeValue("idGroup"), Double.parseDouble((groupElm
- .getAttributeValue("weight"))));
+ .getAttributeValue("idGroup"), Double.parseDouble(groupElm
+ .getAttributeValue("weight")));
group.setName(groupElm.getAttributeValue("name"));
Element votingPersonsElm = groupElm.getChild("votingPersons");
List<Element> listVotingPersons = votingPersonsElm
.getChildren("votingPerson");
- List vectorVotingPersons = loadVotingPersons(listVotingPersons);
+ List<VotingPersonDTO> vectorVotingPersons = loadVotingPersons(listVotingPersons);
group.setVotingPersons(vectorVotingPersons);
@@ -503,24 +489,22 @@
return vectorGroups;
}
- private List loadVotingPersons(List<Element> listVotingPersons) {
- List vectorVotingPersons = new ArrayList<VotingPersonDTO>();
+ private List<VotingPersonDTO> loadVotingPersons(List<Element> listVotingPersons) {
+ List<VotingPersonDTO> vectorVotingPersons = new ArrayList<VotingPersonDTO>();
- Iterator i = listVotingPersons.listIterator();
- while (i.hasNext()) {
- Element votingPersonElm = (Element) i.next();
+ for (Element votingPersonElm : listVotingPersons) {
VotingPersonDTO votingPerson = new VotingPersonDTO(votingPersonElm
- .getAttributeValue("votingId"), Double
- .parseDouble((votingPersonElm.getAttributeValue("weight"))));
+ .getAttributeValue("votingId"), Double
+ .parseDouble(votingPersonElm.getAttributeValue("weight")));
votingPerson.setEmail(votingPersonElm.getChild("email").getValue());
votingPerson.setComment(votingPersonElm.getChild("comment")
- .getValue());
+ .getValue());
Element choicesElm = votingPersonElm.getChild("choices");
List<Element> listVoteToChoices = choicesElm.getChildren("choice");
- List vectorVoteToChoices = loadVoteToChoices(listVoteToChoices);
+ List<VoteToChoiceDTO> vectorVoteToChoices = loadVoteToChoices(listVoteToChoices);
votingPerson.setChoices(vectorVoteToChoices);
vectorVotingPersons.add(votingPerson);
@@ -529,15 +513,12 @@
return vectorVotingPersons;
}
- private List loadVoteToChoices(List<Element> listVoteToChoices) {
- List vectorVoteToChoices = new ArrayList<VotingPersonDTO>();
+ private List<VoteToChoiceDTO> loadVoteToChoices(List<Element> listVoteToChoices) {
+ List<VoteToChoiceDTO> vectorVoteToChoices = new ArrayList<VoteToChoiceDTO>();
- Iterator i = listVoteToChoices.listIterator();
- while (i.hasNext()) {
- Element voteToChoiceElm = (Element) i.next();
-
+ for (Element voteToChoiceElm : listVoteToChoices) {
VoteToChoiceDTO voteToChoice = new VoteToChoiceDTO(voteToChoiceElm
- .getAttributeValue("idChoice"), Double
+ .getAttributeValue("idChoice"), Double
.parseDouble(voteToChoiceElm.getAttributeValue("value")));
vectorVoteToChoices.add(voteToChoice);
}
@@ -545,22 +526,20 @@
return vectorVoteToChoices;
}
- private List loadPollChoices(List<Element> listPollChoices) {
- List vectorPollChoices = new ArrayList<PollChoiceDTO>();
+ private List<PollChoiceDTO> loadPollChoices(List<Element> listPollChoices) {
+ List<PollChoiceDTO> vectorPollChoices = new ArrayList<PollChoiceDTO>();
- Iterator i = listPollChoices.listIterator();
- while (i.hasNext()) {
- Element pollChoiceElm = (Element) i.next();
+ for (Element pollChoiceElm : listPollChoices) {
PollChoiceDTO pollChoice = new PollChoiceDTO(pollChoiceElm
- .getAttributeValue("idChoice"));
+ .getAttributeValue("idChoice"));
String pollChoiceName = pollChoiceElm.getChild("name").getValue();
pollChoice.setName(pollChoiceName);
pollChoice.setHidden(pollChoiceName != null
- && pollChoiceName.startsWith(NumberMethod.HIDDEN_PREFIX));
+ && pollChoiceName.startsWith(NumberMethod.HIDDEN_PREFIX));
pollChoice.setDescription(pollChoiceElm.getChild("description")
- .getValue());
+ .getValue());
vectorPollChoices.add(pollChoice);
}
@@ -568,27 +547,25 @@
return vectorPollChoices;
}
- private List loadVoteCountingResults(List<Element> listVoteCountingResults) {
- List vectorVoteCountingResults = new ArrayList<VoteCountingResultDTO>();
+ private List<VoteCountingResultDTO> loadVoteCountingResults(List<Element> listVoteCountingResults) {
+ List<VoteCountingResultDTO> vectorVoteCountingResults = new ArrayList<VoteCountingResultDTO>();
- Iterator i = listVoteCountingResults.listIterator();
- while (i.hasNext()) {
- Element voteCountingResultElm = (Element) i.next();
+ for (Element voteCountingResultElm : listVoteCountingResults) {
VoteCountingResultDTO voteCountingResult = new VoteCountingResultDTO();
voteCountingResult.setIdPoll(voteCountingResultElm
- .getAttributeValue("idPoll"));
+ .getAttributeValue("idPoll"));
voteCountingResult.setNbVotes(Integer
- .parseInt(voteCountingResultElm.getChild("nbVotes")
- .getValue()));
+ .parseInt(voteCountingResultElm.getChild("nbVotes")
+ .getValue()));
voteCountingResult.setChoiceResult(voteCountingResultElm.getChild(
"choiceResult").getValue());
voteCountingResult.setByGroup(Boolean
- .parseBoolean((voteCountingResultElm.getChild("isByGroup")
- .getValue())));
+ .parseBoolean(voteCountingResultElm.getChild("isByGroup")
+ .getValue()));
Element choicesElm = voteCountingResultElm.getChild("choices");
List<Element> listChoices = choicesElm.getChildren("choice");
- List vectorChoices = loadChoices(listChoices);
+ List<ChoiceDTO> vectorChoices = loadChoices(listChoices);
voteCountingResult.setChoices(vectorChoices);
vectorVoteCountingResults.add(voteCountingResult);
}
@@ -596,17 +573,15 @@
return vectorVoteCountingResults;
}
- private List loadChoices(List<Element> listChoices) {
- List vectorChoices = new ArrayList<ChoiceDTO>();
+ private List<ChoiceDTO> loadChoices(List<Element> listChoices) {
+ List<ChoiceDTO> vectorChoices = new ArrayList<ChoiceDTO>();
- Iterator i = listChoices.listIterator();
- while (i.hasNext()) {
- Element choiceElm = (Element) i.next();
+ for (Element choiceElm : listChoices) {
ChoiceDTO choice = new ChoiceDTO(choiceElm.getAttribute("idChoice")
- .getName(), Double.parseDouble(choiceElm.getAttribute(
+ .getName(), Double.parseDouble(choiceElm.getAttribute(
"value").getValue()), Double.parseDouble(choiceElm
- .getChild("percentage").getValue()), Integer
- .parseInt((choiceElm.getChild("nbVotes").getValue())));
+ .getChild("percentage").getValue()), Integer
+ .parseInt(choiceElm.getChild("nbVotes").getValue()));
vectorChoices.add(choice);
}
Modified: branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/services/ServiceVoteCounting.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/services/ServiceVoteCounting.java 2012-01-24 10:08:09 UTC (rev 3114)
+++ branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/services/ServiceVoteCounting.java 2012-01-24 14:11:32 UTC (rev 3115)
@@ -49,7 +49,7 @@
*/
public interface ServiceVoteCounting {
- public VoteCountingResultDTO executeVoteCounting(PollDTO poll);
+ VoteCountingResultDTO executeVoteCounting(PollDTO poll);
- public VoteCountingResultDTO executeGroupCounting(PollDTO poll);
+ VoteCountingResultDTO executeGroupCounting(PollDTO poll);
}
Modified: branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/services/ServiceVoteCountingImpl.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/services/ServiceVoteCountingImpl.java 2012-01-24 10:08:09 UTC (rev 3114)
+++ branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/services/ServiceVoteCountingImpl.java 2012-01-24 14:11:32 UTC (rev 3115)
@@ -89,8 +89,8 @@
* Constructeur
*/
public ServiceVoteCountingImpl() {
- this.currentIdGroup = "";
- this.context = null;
+ currentIdGroup = "";
+ context = null;
}
/**
@@ -101,8 +101,8 @@
*/
@Override
public VoteCountingResultDTO executeVoteCounting(PollDTO poll) {
- this.isByGroup = false;
- return this.execute(poll);
+ isByGroup = false;
+ return execute(poll);
}
/**
@@ -113,8 +113,8 @@
*/
@Override
public VoteCountingResultDTO executeGroupCounting(PollDTO poll) {
- this.isByGroup = true;
- return this.execute(poll);
+ isByGroup = true;
+ return execute(poll);
}
/**
@@ -130,8 +130,8 @@
}
// Création et remplissage du contexte
- this.createContext(poll.getVoteCounting());
- this.fillContext(poll);
+ createContext(poll.getVoteCounting());
+ fillContext(poll);
// Execution
if (!context.executeCounting()) {
@@ -141,9 +141,9 @@
VoteCountingResultDTO result = new VoteCountingResultDTO();
result.setNbVotes(Utils.calculateNbVotes(poll.getVotingGroups(),
- this.isByGroup));
+ isByGroup));
result.setTypeVoteCounting(poll.getVoteCounting());
- result.setByGroup(this.isByGroup);
+ result.setByGroup(isByGroup);
result.setIdPoll(poll.getPollId());
result.setChoices(resChoices);
return result;
@@ -155,7 +155,7 @@
* @param type : type de dépouillement
*/
private void createContext(VoteCountingType type) {
- Method method = null;
+ Method method;
switch (type) {
case NORMAL:
method = new StandardMethod();
@@ -172,7 +172,7 @@
default:
method = new StandardMethod();
}
- this.context = new Context(method, this.isByGroup);
+ context = new Context(method, isByGroup);
}
/**
@@ -186,14 +186,14 @@
}
for (PollChoiceDTO choice : poll.getChoices()) {
if (choice.isHidden()) {
- this.context.addHiddenChoice(choice);
+ context.addHiddenChoice(choice);
} else {
- this.context.addChoice(choice);
+ context.addChoice(choice);
}
}
for (Object o : poll.getVotingGroups()) {
VotingGroupDTO group = (VotingGroupDTO) o;
- this.routeGroup(group);
+ routeGroup(group);
}
}
@@ -207,11 +207,11 @@
log.debug("Ajout group : " + group.getIdGroup() + " _ weight="
+ group.getWeight());
}
- this.context.addGroup(group.getIdGroup(), group.getWeight());
+ context.addGroup(group.getIdGroup(), group.getWeight());
for (Object o : group.getVotingPersons()) {
VotingPersonDTO person = (VotingPersonDTO) o;
- this.currentIdGroup = group.getIdGroup();
- this.routePerson(person);
+ currentIdGroup = group.getIdGroup();
+ routePerson(person);
}
}
@@ -226,7 +226,7 @@
+ person.getWeight());
}
for (VoteToChoiceDTO vote : person.getChoices()) {
- this.addVoteToContext(vote, person.getWeight(), person
+ addVoteToContext(vote, person.getWeight(), person
.getVotingId());
}
}
@@ -243,8 +243,8 @@
log.debug("Ajout vote : " + vote.getValue() + " _ choice="
+ vote.getIdChoice());
}
- Choice choice = this.context.getChoice(vote.getIdChoice());
- Group group = choice.getGroup(this.currentIdGroup);
+ Choice choice = context.getChoice(vote.getIdChoice());
+ Group group = choice.getGroup(currentIdGroup);
group.addVote(vote.getValue(), weight, votingID);
}
Modified: branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/utils/ListBehavior.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/utils/ListBehavior.java 2012-01-24 10:08:09 UTC (rev 3114)
+++ branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/utils/ListBehavior.java 2012-01-24 14:11:32 UTC (rev 3115)
@@ -47,5 +47,5 @@
* @version $Id$
*/
public interface ListBehavior<T> {
- public List<T> list();
+ List<T> list();
}
Modified: branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/utils/PercentageBehavior.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/utils/PercentageBehavior.java 2012-01-24 10:08:09 UTC (rev 3114)
+++ branches/pollen-2.0-beta-1/pollen-domain/src/main/java/org/chorem/pollen/votecounting/utils/PercentageBehavior.java 2012-01-24 14:11:32 UTC (rev 3115)
@@ -45,5 +45,5 @@
* @version $Id$
*/
public interface PercentageBehavior {
- public double value();
+ double value();
}
Added: branches/pollen-2.0-beta-1/pollen-domain/src/main/resources/i18n/pollen-domain_en_GB.properties
===================================================================
--- branches/pollen-2.0-beta-1/pollen-domain/src/main/resources/i18n/pollen-domain_en_GB.properties (rev 0)
+++ branches/pollen-2.0-beta-1/pollen-domain/src/main/resources/i18n/pollen-domain_en_GB.properties 2012-01-24 14:11:32 UTC (rev 3115)
@@ -0,0 +1,10 @@
+pollen.choiceType.date=Date
+pollen.choiceType.image=Image
+pollen.choiceType.text=Text
+pollen.pollType.free=Free
+pollen.pollType.group=Group
+pollen.pollType.restricted=Restricted
+pollen.voteCountingType.condorcet=Condorcet
+pollen.voteCountingType.normal=Normal
+pollen.voteCountingType.number=Number
+pollen.voteCountingType.percentage=Percentage
Property changes on: branches/pollen-2.0-beta-1/pollen-domain/src/main/resources/i18n/pollen-domain_en_GB.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: branches/pollen-2.0-beta-1/pollen-domain/src/main/resources/i18n/pollen-domain_fr_FR.properties
===================================================================
--- branches/pollen-2.0-beta-1/pollen-domain/src/main/resources/i18n/pollen-domain_fr_FR.properties (rev 0)
+++ branches/pollen-2.0-beta-1/pollen-domain/src/main/resources/i18n/pollen-domain_fr_FR.properties 2012-01-24 14:11:32 UTC (rev 3115)
@@ -0,0 +1,10 @@
+pollen.choiceType.date=Date
+pollen.choiceType.image=Image
+pollen.choiceType.text=Texte
+pollen.pollType.free=Libre
+pollen.pollType.group=Groupe
+pollen.pollType.restricted=Restreint
+pollen.voteCountingType.condorcet=Condorcet
+pollen.voteCountingType.normal=Normal
+pollen.voteCountingType.number=Nombre
+pollen.voteCountingType.percentage=Pourcentage
Property changes on: branches/pollen-2.0-beta-1/pollen-domain/src/main/resources/i18n/pollen-domain_fr_FR.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: branches/pollen-2.0-beta-1/pollen-domain/src/test/java/org/chorem/pollen/votecounting/business/services/PollDTOCreator.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-domain/src/test/java/org/chorem/pollen/votecounting/business/services/PollDTOCreator.java 2012-01-24 10:08:09 UTC (rev 3114)
+++ branches/pollen-2.0-beta-1/pollen-domain/src/test/java/org/chorem/pollen/votecounting/business/services/PollDTOCreator.java 2012-01-24 14:11:32 UTC (rev 3115)
@@ -53,12 +53,12 @@
*
* @return le sondage
*/
- public PollDTO createPoll();
+ PollDTO createPoll();
/**
* Création d'un sondage de test.
*
* @return le sondage
*/
- public PollDTO createTestPoll();
+ PollDTO createTestPoll();
}
Modified: branches/pollen-2.0-beta-1/pollen-domain/src/test/java/org/chorem/pollen/votecounting/business/services/PollDTOCreatorVoteCounting.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-domain/src/test/java/org/chorem/pollen/votecounting/business/services/PollDTOCreatorVoteCounting.java 2012-01-24 10:08:09 UTC (rev 3114)
+++ branches/pollen-2.0-beta-1/pollen-domain/src/test/java/org/chorem/pollen/votecounting/business/services/PollDTOCreatorVoteCounting.java 2012-01-24 14:11:32 UTC (rev 3115)
@@ -71,25 +71,25 @@
.getLog(PollDTOCreatorVoteCounting.class);
public PollDTOCreatorVoteCounting(int maxchoice, VoteCountingType typeCount) {
- this.maxChoice = maxchoice;
- this.maxChoiceNb = this.getAleaNb(this.maxChoice);
+ maxChoice = maxchoice;
+ maxChoiceNb = getAleaNb(maxChoice);
this.typeCount = typeCount;
}
@Override
public PollDTO createPoll() {
if (log.isDebugEnabled()) {
- log.debug("Création du sondage : " + "maxchoice=" + this.maxChoice
- + " _ " + "maxchoiceByPerson=" + this.maxChoiceNb + " _ "
- + "typeVoteCounting=" + this.typeCount);
+ log.debug("Création du sondage : " + "maxchoice=" + maxChoice
+ + " _ " + "maxchoiceByPerson=" + maxChoiceNb + " _ "
+ + "typeVoteCounting=" + typeCount);
}
PollDTO poll = new PollDTO("RandomPoll");
- poll.setMaxChoiceNb(this.maxChoiceNb);
+ poll.setMaxChoiceNb(maxChoiceNb);
poll.setPollType(PollType.FREE);
- poll.setVoteCounting(this.typeCount);
- poll.setChoices(this.createChoices());
- poll.setVotingGroups(this.createGroups());
+ poll.setVoteCounting(typeCount);
+ poll.setChoices(createChoices());
+ poll.setVotingGroups(createGroups());
return poll;
}
@@ -98,7 +98,7 @@
log.debug("Création des choix : ");
}
List<PollChoiceDTO> choices = new ArrayList<PollChoiceDTO>();
- for (int i = 1; i <= this.maxChoice; i++) {
+ for (int i = 1; i <= maxChoice; i++) {
choices.add(new PollChoiceDTO(String.valueOf(i)));
if (log.isDebugEnabled()) {
log.debug("Choice : id=" + i);
@@ -109,19 +109,19 @@
private List<VotingGroupDTO> createGroups() {
List<VotingGroupDTO> groups = new ArrayList<VotingGroupDTO>();
- int nbGroups = this.getAleaNb(3);
+ int nbGroups = getAleaNb(3);
if (log.isDebugEnabled()) {
log.debug("Création des groupes : " + nbGroups);
}
int oldNbPersons = 1;
for (int i = 1; i <= nbGroups; i++) {
- double weight = this.getAleaWeight();
+ double weight = getAleaWeight();
VotingGroupDTO group = new VotingGroupDTO(Integer.toString(i),
weight);
if (log.isDebugEnabled()) {
log.debug("_Groupe : id=" + i + " _ weight=" + weight);
}
- group.setVotingPersons(this.createPersons(oldNbPersons));
+ group.setVotingPersons(createPersons(oldNbPersons));
oldNbPersons += group.getVotingPersons().size();
groups.add(group);
}
@@ -130,18 +130,18 @@
private List<VotingPersonDTO> createPersons(int next) {
List<VotingPersonDTO> persons = new ArrayList<VotingPersonDTO>();
- int nbPersons = this.getAleaNb(3);
+ int nbPersons = getAleaNb(3);
if (log.isDebugEnabled()) {
log.debug("_Création des votants : " + nbPersons);
}
for (int i = 1; i <= nbPersons; i++) {
- double weight = this.getAleaWeight();
+ double weight = getAleaWeight();
VotingPersonDTO person = new VotingPersonDTO("person" + next,
weight);
if (log.isDebugEnabled()) {
log.debug("__Votant : id=person" + next + " _ " + weight);
}
- person.setChoices(this.createVotes());
+ person.setChoices(createVotes());
persons.add(person);
next++;
}
@@ -150,14 +150,14 @@
private List<VoteToChoiceDTO> createVotes() {
List<VoteToChoiceDTO> choices = new ArrayList<VoteToChoiceDTO>();
- int nbchoice = this.getAleaNb(this.maxChoiceNb);
+ int nbchoice = getAleaNb(maxChoiceNb);
if (log.isDebugEnabled()) {
log.debug("__Création du vote : " + nbchoice);
}
List<Integer> choicesId = new ArrayList<Integer>();
for (int i = 1; i <= nbchoice; i++) {
- int choiceId = this.getAleaNb(this.maxChoice, choicesId);
- int value = this.getAleaValue(nbchoice);
+ int choiceId = getAleaNb(maxChoice, choicesId);
+ int value = getAleaValue(nbchoice);
choicesId.add(new Integer(choiceId));
choices.add(new VoteToChoiceDTO(choiceId, value));
if (log.isDebugEnabled()) {
@@ -174,7 +174,7 @@
private int getAleaNb(int max, List<Integer> prevs) {
int val = 0;
do {
- val = this.getAleaNb(max);
+ val = getAleaNb(max);
} while (findInteger(prevs, val));
return val;
}
@@ -192,7 +192,7 @@
}
private int getAleaValue(int nbchoice) {
- switch (this.typeCount) {
+ switch (typeCount) {
case NORMAL:
return 1;
case PERCENTAGE:
1
0
Author: athimel
Date: 2012-01-24 11:08:09 +0100 (Tue, 24 Jan 2012)
New Revision: 3114
Url: http://chorem.org/repositories/revision/pollen/3114
Log:
Add choice types and some additionnal comments in screen models
Modified:
branches/pollen-2.0-beta-1/doc/new-poll-2.0-beta-1.ep
Modified: branches/pollen-2.0-beta-1/doc/new-poll-2.0-beta-1.ep
===================================================================
(Binary files differ)
1
0
Author: athimel
Date: 2012-01-24 10:11:48 +0100 (Tue, 24 Jan 2012)
New Revision: 3113
Url: http://chorem.org/repositories/revision/pollen/3113
Log:
Add some comments in screens model
Modified:
branches/pollen-2.0-beta-1/
branches/pollen-2.0-beta-1/doc/new-poll-2.0-beta-1.ep
Property changes on: branches/pollen-2.0-beta-1
___________________________________________________________________
Modified: svn:ignore
- *.ipr
*.iws
*.iml
.classpath
.project
target
.settings
nbactions.xml
+ *.ipr
*.iws
*.iml
.classpath
.project
target
.settings
nbactions.xml
.idea
Modified: branches/pollen-2.0-beta-1/doc/new-poll-2.0-beta-1.ep
===================================================================
(Binary files differ)
1
0
r3112 - in branches/pollen-2.0-beta-1: doc pollen-services/src/main/java/org/chorem/pollen/services/exceptions pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/admin pollen-ui-struts2/src/main/resources/template/css_xhtml
by tchemit@users.chorem.org 23 Jan '12
by tchemit@users.chorem.org 23 Jan '12
23 Jan '12
Author: tchemit
Date: 2012-01-24 00:10:51 +0100 (Tue, 24 Jan 2012)
New Revision: 3112
Url: http://chorem.org/repositories/revision/pollen/3112
Log:
header + svn properties
Modified:
branches/pollen-2.0-beta-1/doc/new-poll-2.0-beta-1.ep
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/FavoriteListAlreadyExistException.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/ParticipantAlreadyFoundInListException.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/ParticipantExistWithoutMailException.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollAlreadyClosedException.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollAlreadyExistException.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollNotFoundException.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/VoteDoubloonException.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/VoteNotAllowedException.java
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetUser.java
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/admin/ManageUsers-createUser-validation.xml
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/admin/ManageUsers-updateUser-validation.xml
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/template/css_xhtml/checkbox.ftl
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/template/css_xhtml/controlheader-core.ftl
Property changes on: branches/pollen-2.0-beta-1/doc/new-poll-2.0-beta-1.ep
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/FavoriteListAlreadyExistException.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/FavoriteListAlreadyExistException.java 2012-01-23 23:05:59 UTC (rev 3111)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/FavoriteListAlreadyExistException.java 2012-01-23 23:10:51 UTC (rev 3112)
@@ -1,3 +1,26 @@
+/*
+ * #%L
+ * Pollen :: Services
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2012 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%
+ */
package org.chorem.pollen.services.exceptions;
/**
Property changes on: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/FavoriteListAlreadyExistException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/ParticipantAlreadyFoundInListException.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/ParticipantAlreadyFoundInListException.java 2012-01-23 23:05:59 UTC (rev 3111)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/ParticipantAlreadyFoundInListException.java 2012-01-23 23:10:51 UTC (rev 3112)
@@ -1,3 +1,26 @@
+/*
+ * #%L
+ * Pollen :: Services
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2012 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%
+ */
package org.chorem.pollen.services.exceptions;
/**
Property changes on: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/ParticipantAlreadyFoundInListException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/ParticipantExistWithoutMailException.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/ParticipantExistWithoutMailException.java 2012-01-23 23:05:59 UTC (rev 3111)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/ParticipantExistWithoutMailException.java 2012-01-23 23:10:51 UTC (rev 3112)
@@ -1,3 +1,26 @@
+/*
+ * #%L
+ * Pollen :: Services
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2012 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%
+ */
package org.chorem.pollen.services.exceptions;
/**
Property changes on: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/ParticipantExistWithoutMailException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollAlreadyClosedException.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollAlreadyClosedException.java 2012-01-23 23:05:59 UTC (rev 3111)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollAlreadyClosedException.java 2012-01-23 23:10:51 UTC (rev 3112)
@@ -1,3 +1,26 @@
+/*
+ * #%L
+ * Pollen :: Services
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2012 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%
+ */
package org.chorem.pollen.services.exceptions;
/**
Property changes on: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollAlreadyClosedException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollAlreadyExistException.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollAlreadyExistException.java 2012-01-23 23:05:59 UTC (rev 3111)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollAlreadyExistException.java 2012-01-23 23:10:51 UTC (rev 3112)
@@ -1,3 +1,26 @@
+/*
+ * #%L
+ * Pollen :: Services
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2012 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%
+ */
package org.chorem.pollen.services.exceptions;
/**
Property changes on: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollAlreadyExistException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollNotFoundException.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollNotFoundException.java 2012-01-23 23:05:59 UTC (rev 3111)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollNotFoundException.java 2012-01-23 23:10:51 UTC (rev 3112)
@@ -1,3 +1,26 @@
+/*
+ * #%L
+ * Pollen :: Services
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2012 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%
+ */
package org.chorem.pollen.services.exceptions;
/**
Property changes on: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollNotFoundException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/VoteDoubloonException.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/VoteDoubloonException.java 2012-01-23 23:05:59 UTC (rev 3111)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/VoteDoubloonException.java 2012-01-23 23:10:51 UTC (rev 3112)
@@ -1,3 +1,26 @@
+/*
+ * #%L
+ * Pollen :: Services
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2012 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%
+ */
package org.chorem.pollen.services.exceptions;
/**
Property changes on: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/VoteDoubloonException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/VoteNotAllowedException.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/VoteNotAllowedException.java 2012-01-23 23:05:59 UTC (rev 3111)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/VoteNotAllowedException.java 2012-01-23 23:10:51 UTC (rev 3112)
@@ -1,3 +1,26 @@
+/*
+ * #%L
+ * Pollen :: Services
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2012 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%
+ */
package org.chorem.pollen.services.exceptions;
/**
Property changes on: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/VoteNotAllowedException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetUser.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetUser.java 2012-01-23 23:05:59 UTC (rev 3111)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetUser.java 2012-01-23 23:10:51 UTC (rev 3112)
@@ -1,3 +1,26 @@
+/*
+ * #%L
+ * Pollen :: UI (strust2)
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2012 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%
+ */
package org.chorem.pollen.ui.actions.json;
import com.google.common.collect.Maps;
Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetUser.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/admin/ManageUsers-createUser-validation.xml
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/admin/ManageUsers-createUser-validation.xml 2012-01-23 23:05:59 UTC (rev 3111)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/admin/ManageUsers-createUser-validation.xml 2012-01-23 23:10:51 UTC (rev 3112)
@@ -1,3 +1,26 @@
+<!--
+ #%L
+ Pollen :: UI (strust2)
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2009 - 2012 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%
+ -->
<!DOCTYPE validators PUBLIC
"-//OpenSymphony Group//XWork Validator 1.0.2//EN"
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/admin/ManageUsers-createUser-validation.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/admin/ManageUsers-updateUser-validation.xml
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/admin/ManageUsers-updateUser-validation.xml 2012-01-23 23:05:59 UTC (rev 3111)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/admin/ManageUsers-updateUser-validation.xml 2012-01-23 23:10:51 UTC (rev 3112)
@@ -1,3 +1,26 @@
+<!--
+ #%L
+ Pollen :: UI (strust2)
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2009 - 2012 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%
+ -->
<!DOCTYPE validators PUBLIC
"-//OpenSymphony Group//XWork Validator 1.0.2//EN"
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/admin/ManageUsers-updateUser-validation.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/template/css_xhtml/checkbox.ftl
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/template/css_xhtml/checkbox.ftl 2012-01-23 23:05:59 UTC (rev 3111)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/template/css_xhtml/checkbox.ftl 2012-01-23 23:10:51 UTC (rev 3112)
@@ -2,8 +2,8 @@
#%L
EchoBase :: UI
- $Id: checkbox.ftl 80 2011-11-14 15:09:26Z tchemit $
- $HeadURL: http://svn.forge.codelutin.com/svn/echobase/trunk/echobase-ui/src/main/reso… $
+ $Id$
+ $HeadURL$
%%
Copyright (C) 2011 Ifremer, Codelutin
%%
Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/template/css_xhtml/checkbox.ftl
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/template/css_xhtml/controlheader-core.ftl
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/template/css_xhtml/controlheader-core.ftl 2012-01-23 23:05:59 UTC (rev 3111)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/template/css_xhtml/controlheader-core.ftl 2012-01-23 23:10:51 UTC (rev 3112)
@@ -2,8 +2,8 @@
#%L
EchoBase :: UI
- $Id: controlheader-core.ftl 80 2011-11-14 15:09:26Z tchemit $
- $HeadURL: http://svn.forge.codelutin.com/svn/echobase/trunk/echobase-ui/src/main/reso… $
+ $Id$
+ $HeadURL$
%%
Copyright (C) 2011 Ifremer, Codelutin
%%
Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/template/css_xhtml/controlheader-core.ftl
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
1
0
Author: tchemit
Date: 2012-01-24 00:05:59 +0100 (Tue, 24 Jan 2012)
New Revision: 3111
Url: http://chorem.org/repositories/revision/pollen/3111
Log:
- optimize dependencies
- begin of remove PollenException
Modified:
branches/pollen-2.0-beta-1/pollen-persistence/pom.xml
branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenContext.java
branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/ChoiceImpl.java
branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/UserAccountImpl.java
branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/service/legacy/ServiceUser.java
branches/pollen-2.0-beta-1/pollen-persistence/src/main/xmi/pollen.properties
branches/pollen-2.0-beta-1/pollen-services/pom.xml
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/PollenContextImpl.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/bean/PollenEmail.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceEmail.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceEmailAbstract.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceEmailImpl.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceFavorite.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceFavoriteAbstract.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceFavoriteImpl.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServicePoll.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServicePollAbstract.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServicePollImpl.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceUserAbstract.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceUserImpl.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceVote.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceVoteAbstract.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceVoteImpl.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/FavoriteService.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/PollService.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserService.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/VoteService.java
branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/service/legacy/ServicePollImplTest.java
branches/pollen-2.0-beta-1/pollen-ui-struts2/pom.xml
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/CreatePoll.java
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties
branches/pollen-2.0-beta-1/pom.xml
Modified: branches/pollen-2.0-beta-1/pollen-persistence/pom.xml
===================================================================
--- branches/pollen-2.0-beta-1/pollen-persistence/pom.xml 2012-01-23 22:31:35 UTC (rev 3110)
+++ branches/pollen-2.0-beta-1/pollen-persistence/pom.xml 2012-01-23 23:05:59 UTC (rev 3111)
@@ -35,26 +35,10 @@
<artifactId>commons-logging</artifactId>
</dependency>
<dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- </dependency>
- <dependency>
<groupId>org.apache.commons</groupId>
- <artifactId>commons-email</artifactId>
+ <artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
- <groupId>javax.mail</groupId>
- <artifactId>mail</artifactId>
- </dependency>
- <dependency>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-utils</artifactId>
</dependency>
@@ -63,14 +47,6 @@
<artifactId>nuiton-i18n</artifactId>
</dependency>
<dependency>
- <groupId>net.sf.opencsv</groupId>
- <artifactId>opencsv</artifactId>
- </dependency>
- <!-- <dependency>
- <groupId>org.chorem</groupId>
- <artifactId>chorem-commons</artifactId>
- </dependency>-->
- <dependency>
<groupId>org.nuiton.topia</groupId>
<artifactId>topia-persistence</artifactId>
</dependency>
@@ -93,10 +69,6 @@
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
</dependencies>
Modified: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenContext.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenContext.java 2012-01-23 22:31:35 UTC (rev 3110)
+++ branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenContext.java 2012-01-23 23:05:59 UTC (rev 3111)
@@ -123,10 +123,8 @@
* @param eee
* @param message
* @param args
- * @throws PollenException
*/
- void treateError(Exception eee, String message, Object... args)
- throws PollenException;
+ void treateError(Exception eee, String message, Object... args);
/**
* doCatch :
@@ -134,10 +132,9 @@
* @param eee
* @param message
* @param args
- * @throws PollenException
*/
void treateError(TopiaContext transaction, Exception eee,
- String message, Object... args) throws PollenException;
+ String message, Object... args) ;
/**
* doFinally :
Modified: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/ChoiceImpl.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/ChoiceImpl.java 2012-01-23 22:31:35 UTC (rev 3110)
+++ branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/ChoiceImpl.java 2012-01-23 23:05:59 UTC (rev 3111)
@@ -24,7 +24,7 @@
package org.chorem.pollen.entity;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.chorem.pollen.votecounting.business.NumberMethod;
/**
Modified: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/UserAccountImpl.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/UserAccountImpl.java 2012-01-23 22:31:35 UTC (rev 3110)
+++ branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/UserAccountImpl.java 2012-01-23 23:05:59 UTC (rev 3111)
@@ -24,7 +24,7 @@
package org.chorem.pollen.entity;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
/**
* UserAccountImpl
Modified: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/service/legacy/ServiceUser.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/service/legacy/ServiceUser.java 2012-01-23 22:31:35 UTC (rev 3110)
+++ branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/service/legacy/ServiceUser.java 2012-01-23 23:05:59 UTC (rev 3111)
@@ -23,27 +23,27 @@
*/
package org.chorem.pollen.service.legacy;
-import java.util.Map;
import org.chorem.pollen.PollenBusinessException;
-import org.chorem.pollen.PollenException;
import org.chorem.pollen.entity.UserAccount;
import org.nuiton.topia.framework.EntityFilter;
+import java.util.Map;
+
@Deprecated
public interface ServiceUser {
- UserAccount connect(String login, String password) throws PollenException, PollenBusinessException;
+ UserAccount connect(String login, String password) throws PollenBusinessException;
- UserAccount getNewUser() throws PollenException;
+ UserAccount getNewUser();
- void createUser(UserAccount user) throws PollenException, PollenBusinessException;
+ void createUser(UserAccount user) throws PollenBusinessException;
- void updateUser(UserAccount user, boolean byAdmin) throws PollenException, PollenBusinessException;
+ void updateUser(UserAccount user, boolean byAdmin) throws PollenBusinessException;
- void deleteUser(String login) throws PollenException;
+ void deleteUser(String login);
- Map<String, UserAccount> getUsers(EntityFilter filter) throws PollenException;
+ Map<String, UserAccount> getUsers(EntityFilter filter);
- int getNbUsers() throws PollenException;
+ int getNbUsers();
} //ServiceUser
Modified: branches/pollen-2.0-beta-1/pollen-persistence/src/main/xmi/pollen.properties
===================================================================
--- branches/pollen-2.0-beta-1/pollen-persistence/src/main/xmi/pollen.properties 2012-01-23 22:31:35 UTC (rev 3110)
+++ branches/pollen-2.0-beta-1/pollen-persistence/src/main/xmi/pollen.properties 2012-01-23 23:05:59 UTC (rev 3111)
@@ -22,7 +22,7 @@
# #L%
###
# Pr\u00e9cise l'ent\u00eate de l'ensemble des fichiers g\u00e9n\u00e9r\u00e9s
-model.tagvalue.copyright=/* *##%\n Copyright (C) 2009 Pollen\n *##%*/
+#model.tagvalue.copyright=/* *##%\n Copyright (C) 2009 Pollen\n *##%*/
# toString are particularly difficult to use because of lazy initialization
model.tagvalue.notGenerateToString=true
#model.tagvalue.useLegacyDAO=true
@@ -31,7 +31,7 @@
model.tagvalue.constantPrefix=PROPERTY_
model.tagvalue.java.lang.String=text
-model.tagvalue.exceptionClass=org.chorem.pollen.PollenException
+#model.tagvalue.exceptionClass=org.chorem.pollen.PollenTechnicalException
org.chorem.pollen.entity.UserAccount.attribute.login.tagvalue.naturalId=true
org.chorem.pollen.entity.UserAccount.attribute.email.tagvalue.unique=true
Modified: branches/pollen-2.0-beta-1/pollen-services/pom.xml
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/pom.xml 2012-01-23 22:31:35 UTC (rev 3110)
+++ branches/pollen-2.0-beta-1/pollen-services/pom.xml 2012-01-23 23:05:59 UTC (rev 3111)
@@ -42,14 +42,22 @@
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-email</artifactId>
</dependency>
<dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core</artifactId>
+ </dependency>
+ <dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
</dependency>
@@ -65,27 +73,15 @@
<groupId>net.sf.opencsv</groupId>
<artifactId>opencsv</artifactId>
</dependency>
- <!-- <dependency>
- <groupId>org.chorem</groupId>
- <artifactId>chorem-commons</artifactId>
- </dependency>-->
<dependency>
<groupId>org.nuiton.topia</groupId>
<artifactId>topia-persistence</artifactId>
</dependency>
- <!--dependency>
- <groupId>org.nuiton.topia</groupId>
- <artifactId>topia-service-migration</artifactId>
- </dependency-->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
- <!--dependency>
- <groupId>postgresql</groupId>
- <artifactId>postgresql</artifactId>
- </dependency-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/PollenContextImpl.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/PollenContextImpl.java 2012-01-23 22:31:35 UTC (rev 3110)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/PollenContextImpl.java 2012-01-23 23:05:59 UTC (rev 3111)
@@ -297,11 +297,10 @@
* @param eee the exception to manage
* @param message the message to add to the new PollenException
* @param args for message
- * @throws PollenException which contains the exception as the cause
*/
@Override
public void treateError(Exception eee, String message, Object... args)
- throws PollenException {
+ {
treateError(null, eee, message, args);
}
@@ -315,11 +314,10 @@
* @param eee the exception to manage
* @param message the message to add to the new PollenException
* @param args for message
- * @throws PollenException
*/
@Override
public void treateError(TopiaContext transaction, Exception eee,
- String message, Object... args) throws PollenException {
+ String message, Object... args) {
if (log.isErrorEnabled()) {
log.error(_(message, args), eee);
}
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/bean/PollenEmail.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/bean/PollenEmail.java 2012-01-23 22:31:35 UTC (rev 3110)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/bean/PollenEmail.java 2012-01-23 23:05:59 UTC (rev 3111)
@@ -23,7 +23,7 @@
*/
package org.chorem.pollen.bean;
-import org.apache.commons.lang.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.SimpleEmail;
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceEmail.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceEmail.java 2012-01-23 22:31:35 UTC (rev 3110)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceEmail.java 2012-01-23 23:05:59 UTC (rev 3111)
@@ -24,7 +24,6 @@
package org.chorem.pollen.service.legacy;
import org.chorem.pollen.PollenBusinessException;
-import org.chorem.pollen.PollenException;
import org.chorem.pollen.bean.PollenEmail;
import org.chorem.pollen.entity.UserAccount;
@@ -33,8 +32,8 @@
PollenEmail createEmail();
- void sendEmail(PollenEmail email) throws PollenException, PollenBusinessException;
+ void sendEmail(PollenEmail email) throws PollenBusinessException;
- PollenEmail getNewEmail(UserAccount toUser) throws PollenException;
+ PollenEmail getNewEmail(UserAccount toUser);
} //ServiceEmail
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceEmailAbstract.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceEmailAbstract.java 2012-01-23 22:31:35 UTC (rev 3110)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceEmailAbstract.java 2012-01-23 23:05:59 UTC (rev 3111)
@@ -23,16 +23,16 @@
*/
package org.chorem.pollen.service.legacy;
-import java.util.ArrayList;
-import java.util.List;
import org.chorem.pollen.PollenBusinessException;
-import org.chorem.pollen.PollenException;
import org.chorem.pollen.bean.PollenEmail;
import org.chorem.pollen.entity.UserAccount;
import org.nuiton.i18n.I18n;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
+import java.util.ArrayList;
+import java.util.List;
+
@Deprecated
public abstract class ServiceEmailAbstract implements ServiceEmail {
@@ -40,15 +40,15 @@
protected void commitTransaction(TopiaContext transaction) throws TopiaException {
transaction.commitTransaction();
-}
+ }
protected abstract void closeTransaction(TopiaContext transaction) throws TopiaException;
- protected abstract void treateError(TopiaContext transaction, Exception eee, String message, Object... args) throws PollenException;
+ protected abstract void treateError(TopiaContext transaction, Exception eee, String message, Object... args);
- protected void treateError(Exception eee, String message, Object... args) throws PollenException {
- treateError(null, eee, message, args);
- }
+ protected void treateError(Exception eee, String message, Object... args) {
+ treateError(null, eee, message, args);
+ }
public abstract void executeSendEmail(PollenEmail pollenEmail) throws Exception;
@@ -70,29 +70,29 @@
}
@Override
- public void sendEmail(PollenEmail email) throws PollenException, PollenBusinessException {
+ public void sendEmail(PollenEmail email) throws PollenBusinessException {
List<Object> errorArgs = new ArrayList<Object>();
-
+
try {
-
- executeSendEmail(email);
-
+
+ executeSendEmail(email);
+
} catch (PollenBusinessException eee) {
- throw eee;
+ throw eee;
} catch (Exception eee) {
- treateError(eee, I18n.n_("pollen.error.serviceEmail.sendEmail"), errorArgs.toArray());
+ treateError(eee, I18n.n_("pollen.error.serviceEmail.sendEmail"), errorArgs.toArray());
}
-
+
}
@Override
- public PollenEmail getNewEmail(UserAccount toUser) throws PollenException {
+ public PollenEmail getNewEmail(UserAccount toUser) {
try {
-
- PollenEmail result = executeGetNewEmail(toUser);
- return result;
+
+ PollenEmail result = executeGetNewEmail(toUser);
+ return result;
} catch (Exception eee) {
- treateError(eee, I18n.n_("pollen.error.serviceEmail.getNewEmail"));
+ treateError(eee, I18n.n_("pollen.error.serviceEmail.getNewEmail"));
}
return null;
}
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceEmailImpl.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceEmailImpl.java 2012-01-23 22:31:35 UTC (rev 3110)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceEmailImpl.java 2012-01-23 23:05:59 UTC (rev 3111)
@@ -67,7 +67,7 @@
@Override
protected void treateError(TopiaContext transaction, Exception eee,
- String message, Object... args) throws PollenException {
+ String message, Object... args) {
context.treateError(transaction, eee, message, args);
}
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceFavorite.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceFavorite.java 2012-01-23 22:31:35 UTC (rev 3110)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceFavorite.java 2012-01-23 23:05:59 UTC (rev 3111)
@@ -23,38 +23,38 @@
*/
package org.chorem.pollen.service.legacy;
-import java.util.List;
-import java.util.Map;
import org.chorem.pollen.PollenBusinessException;
-import org.chorem.pollen.PollenException;
import org.chorem.pollen.entity.FavoriteList;
import org.chorem.pollen.entity.FavoriteParticipant;
import org.chorem.pollen.entity.UserAccount;
import org.nuiton.topia.framework.EntityFilter;
+import java.util.List;
+import java.util.Map;
+
@Deprecated
public interface ServiceFavorite {
- void createFavoriteParticipant(FavoriteParticipant participant) throws PollenException, PollenBusinessException;
+ void createFavoriteParticipant(FavoriteParticipant participant) throws PollenBusinessException;
- void deleteFavoriteParticipant(String id) throws PollenException;
+ void deleteFavoriteParticipant(String id);
- FavoriteParticipant getFavoriteParticipant(String id) throws PollenException;
+ FavoriteParticipant getFavoriteParticipant(String id);
- Map<String, FavoriteParticipant> getFavoriteParticipants(EntityFilter filter) throws PollenException;
+ Map<String, FavoriteParticipant> getFavoriteParticipants(EntityFilter filter);
- List<FavoriteList> getFavoriteLists(UserAccount user) throws PollenException;
+ List<FavoriteList> getFavoriteLists(UserAccount user);
- void deleteFavoriteList(FavoriteList list) throws PollenException;
+ void deleteFavoriteList(FavoriteList list);
- void createFavoriteList(FavoriteList list) throws PollenException, PollenBusinessException;
+ void createFavoriteList(FavoriteList list) throws PollenBusinessException;
- int getNbFavoriteParticipants(EntityFilter filter) throws PollenException;
+ int getNbFavoriteParticipants(EntityFilter filter);
- FavoriteParticipant getNewFavoriteParticipant(FavoriteList list) throws PollenException;
+ FavoriteParticipant getNewFavoriteParticipant(FavoriteList list);
- FavoriteList getNewFavoriteList(UserAccount user) throws PollenException;
+ FavoriteList getNewFavoriteList(UserAccount user);
- void updateFavoriteParticipant(FavoriteParticipant participant) throws PollenException, PollenBusinessException;
+ void updateFavoriteParticipant(FavoriteParticipant participant) throws PollenBusinessException;
} //ServiceFavorite
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceFavoriteAbstract.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceFavoriteAbstract.java 2012-01-23 22:31:35 UTC (rev 3110)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceFavoriteAbstract.java 2012-01-23 23:05:59 UTC (rev 3111)
@@ -23,10 +23,7 @@
*/
package org.chorem.pollen.service.legacy;
-import java.util.List;
-import java.util.Map;
import org.chorem.pollen.PollenBusinessException;
-import org.chorem.pollen.PollenException;
import org.chorem.pollen.entity.FavoriteList;
import org.chorem.pollen.entity.FavoriteParticipant;
import org.chorem.pollen.entity.UserAccount;
@@ -35,6 +32,9 @@
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.framework.EntityFilter;
+import java.util.List;
+import java.util.Map;
+
@Deprecated
public abstract class ServiceFavoriteAbstract implements ServiceFavorite {
@@ -42,15 +42,15 @@
protected void commitTransaction(TopiaContext transaction) throws TopiaException {
transaction.commitTransaction();
-}
+ }
protected abstract void closeTransaction(TopiaContext transaction) throws TopiaException;
- protected abstract void treateError(TopiaContext transaction, Exception eee, String message, Object... args) throws PollenException;
+ protected abstract void treateError(TopiaContext transaction, Exception eee, String message, Object... args);
- protected void treateError(Exception eee, String message, Object... args) throws PollenException {
- treateError(null, eee, message, args);
- }
+ protected void treateError(Exception eee, String message, Object... args) {
+ treateError(null, eee, message, args);
+ }
protected abstract void executeCreateFavoriteParticipant(TopiaContext transaction, FavoriteParticipant participant) throws Exception;
@@ -75,47 +75,47 @@
protected abstract void executeUpdateFavoriteParticipant(TopiaContext transaction, FavoriteParticipant participant) throws Exception;
@Override
- public void createFavoriteParticipant(FavoriteParticipant participant) throws PollenException, PollenBusinessException {
+ public void createFavoriteParticipant(FavoriteParticipant participant) throws PollenBusinessException {
TopiaContext transaction = null;
try {
transaction = beginTransaction();
try {
executeCreateFavoriteParticipant(transaction, participant);
-
+
} finally {
closeTransaction(transaction);
}
-
+
} catch (PollenBusinessException eee) {
- throw eee;
+ throw eee;
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.serviceFavorite.createFavoriteParticipant"));
+ treateError(transaction, eee, I18n.n_("pollen.error.serviceFavorite.createFavoriteParticipant"));
}
-
+
}
@Override
- public void deleteFavoriteParticipant(String id) throws PollenException {
+ public void deleteFavoriteParticipant(String id) {
TopiaContext transaction = null;
try {
transaction = beginTransaction();
try {
executeDeleteFavoriteParticipant(transaction, id);
-
+
} finally {
closeTransaction(transaction);
}
-
+
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.serviceFavorite.deleteFavoriteParticipant"));
+ treateError(transaction, eee, I18n.n_("pollen.error.serviceFavorite.deleteFavoriteParticipant"));
}
-
+
}
@Override
- public FavoriteParticipant getFavoriteParticipant(String id) throws PollenException {
+ public FavoriteParticipant getFavoriteParticipant(String id) {
TopiaContext transaction = null;
try {
transaction = beginTransaction();
@@ -126,15 +126,15 @@
} finally {
closeTransaction(transaction);
}
-
+
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.serviceFavorite.getFavoriteParticipant"));
+ treateError(transaction, eee, I18n.n_("pollen.error.serviceFavorite.getFavoriteParticipant"));
}
return null;
}
@Override
- public Map<String, FavoriteParticipant> getFavoriteParticipants(EntityFilter filter) throws PollenException {
+ public Map<String, FavoriteParticipant> getFavoriteParticipants(EntityFilter filter) {
TopiaContext transaction = null;
try {
transaction = beginTransaction();
@@ -145,15 +145,15 @@
} finally {
closeTransaction(transaction);
}
-
+
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.serviceFavorite.getFavoriteParticipants"));
+ treateError(transaction, eee, I18n.n_("pollen.error.serviceFavorite.getFavoriteParticipants"));
}
return null;
}
@Override
- public List<FavoriteList> getFavoriteLists(UserAccount user) throws PollenException {
+ public List<FavoriteList> getFavoriteLists(UserAccount user) {
TopiaContext transaction = null;
try {
transaction = beginTransaction();
@@ -164,55 +164,55 @@
} finally {
closeTransaction(transaction);
}
-
+
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.serviceFavorite.getFavoriteLists"));
+ treateError(transaction, eee, I18n.n_("pollen.error.serviceFavorite.getFavoriteLists"));
}
return null;
}
@Override
- public void deleteFavoriteList(FavoriteList list) throws PollenException {
+ public void deleteFavoriteList(FavoriteList list) {
TopiaContext transaction = null;
try {
transaction = beginTransaction();
try {
executeDeleteFavoriteList(transaction, list);
-
+
} finally {
closeTransaction(transaction);
}
-
+
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.serviceFavorite.deleteFavoriteList"));
+ treateError(transaction, eee, I18n.n_("pollen.error.serviceFavorite.deleteFavoriteList"));
}
-
+
}
@Override
- public void createFavoriteList(FavoriteList list) throws PollenException, PollenBusinessException {
+ public void createFavoriteList(FavoriteList list) throws PollenBusinessException {
TopiaContext transaction = null;
try {
transaction = beginTransaction();
try {
executeCreateFavoriteList(transaction, list);
-
+
} finally {
closeTransaction(transaction);
}
-
+
} catch (PollenBusinessException eee) {
- throw eee;
+ throw eee;
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.serviceFavorite.createFavoriteList"));
+ treateError(transaction, eee, I18n.n_("pollen.error.serviceFavorite.createFavoriteList"));
}
-
+
}
@Override
- public int getNbFavoriteParticipants(EntityFilter filter) throws PollenException {
+ public int getNbFavoriteParticipants(EntityFilter filter) {
TopiaContext transaction = null;
try {
transaction = beginTransaction();
@@ -223,56 +223,56 @@
} finally {
closeTransaction(transaction);
}
-
+
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.serviceFavorite.getNbFavoriteParticipants"));
+ treateError(transaction, eee, I18n.n_("pollen.error.serviceFavorite.getNbFavoriteParticipants"));
}
return 0;
}
@Override
- public FavoriteParticipant getNewFavoriteParticipant(FavoriteList list) throws PollenException {
+ public FavoriteParticipant getNewFavoriteParticipant(FavoriteList list) {
try {
-
- FavoriteParticipant result = executeGetNewFavoriteParticipant(list);
- return result;
+
+ FavoriteParticipant result = executeGetNewFavoriteParticipant(list);
+ return result;
} catch (Exception eee) {
- treateError(eee, I18n.n_("pollen.error.serviceFavorite.getNewFavoriteParticipant"));
+ treateError(eee, I18n.n_("pollen.error.serviceFavorite.getNewFavoriteParticipant"));
}
return null;
}
@Override
- public FavoriteList getNewFavoriteList(UserAccount user) throws PollenException {
+ public FavoriteList getNewFavoriteList(UserAccount user) {
try {
-
- FavoriteList result = executeGetNewFavoriteList(user);
- return result;
+
+ FavoriteList result = executeGetNewFavoriteList(user);
+ return result;
} catch (Exception eee) {
- treateError(eee, I18n.n_("pollen.error.serviceFavorite.getNewFavoriteList"));
+ treateError(eee, I18n.n_("pollen.error.serviceFavorite.getNewFavoriteList"));
}
return null;
}
@Override
- public void updateFavoriteParticipant(FavoriteParticipant participant) throws PollenException, PollenBusinessException {
+ public void updateFavoriteParticipant(FavoriteParticipant participant) throws PollenBusinessException {
TopiaContext transaction = null;
try {
transaction = beginTransaction();
try {
executeUpdateFavoriteParticipant(transaction, participant);
-
+
} finally {
closeTransaction(transaction);
}
-
+
} catch (PollenBusinessException eee) {
- throw eee;
+ throw eee;
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.serviceFavorite.updateFavoriteParticipant"));
+ treateError(transaction, eee, I18n.n_("pollen.error.serviceFavorite.updateFavoriteParticipant"));
}
-
+
}
} //ServiceFavoriteAbstract
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceFavoriteImpl.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceFavoriteImpl.java 2012-01-23 22:31:35 UTC (rev 3110)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceFavoriteImpl.java 2012-01-23 23:05:59 UTC (rev 3111)
@@ -23,14 +23,13 @@
*/
package org.chorem.pollen.service.legacy;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.pollen.PollenBusinessException;
import org.chorem.pollen.PollenBusinessException.PollenExceptionType;
import org.chorem.pollen.PollenContext;
import org.chorem.pollen.PollenDAOHelper;
-import org.chorem.pollen.PollenException;
import org.chorem.pollen.PollenQueryHelper;
import org.chorem.pollen.entity.FavoriteList;
import org.chorem.pollen.entity.FavoriteListDAO;
@@ -77,7 +76,7 @@
@Override
protected void treateError(TopiaContext transaction, Exception eee,
- String message, Object... args) throws PollenException {
+ String message, Object... args) {
context.treateError(transaction, eee, message, args);
}
@@ -95,7 +94,7 @@
@Override
public void executeCreateFavoriteList(TopiaContext transaction,
- FavoriteList list) throws TopiaException, PollenBusinessException {
+ FavoriteList list) throws TopiaException, PollenBusinessException {
FavoriteListDAO dao = PollenDAOHelper.getFavoriteListDAO(transaction);
@@ -115,8 +114,8 @@
}
@Override
- public void executeDeleteFavoriteList(TopiaContext transaction,
- FavoriteList list) throws TopiaException {
+ public void executeDeleteFavoriteList(TopiaContext transaction,
+ FavoriteList list) throws TopiaException {
FavoriteListDAO dao = PollenDAOHelper.getFavoriteListDAO(transaction);
FavoriteList listLoaded = dao.findByTopiaId(list.getId());
@@ -126,7 +125,7 @@
}
@Override
- public List<FavoriteList> executeGetFavoriteLists(
+ public List<FavoriteList> executeGetFavoriteLists(
TopiaContext transaction, UserAccount user) throws TopiaException {
FavoriteListDAO dao = PollenDAOHelper.getFavoriteListDAO(transaction);
@@ -180,7 +179,7 @@
}
@Override
- public FavoriteParticipant executeGetNewFavoriteParticipant(
+ public FavoriteParticipant executeGetNewFavoriteParticipant(
FavoriteList list) {
FavoriteParticipant result = new FavoriteParticipantImpl();
result.setFavoriteList(list);
@@ -189,8 +188,8 @@
}
@Override
- public void executeCreateFavoriteParticipant(TopiaContext transaction,
- FavoriteParticipant participant)
+ public void executeCreateFavoriteParticipant(TopiaContext transaction,
+ FavoriteParticipant participant)
throws PollenBusinessException, TopiaException {
FavoriteParticipantDAO dao =
@@ -201,8 +200,8 @@
// Create newParticipant with naturalId
FavoriteParticipant newParticipant =
dao.create(participant.getName(),
- participant.getEmail(),
- participant.getFavoriteList());
+ participant.getEmail(),
+ participant.getFavoriteList());
// Set other field
newParticipant.setWeight(participant.getWeight());
@@ -211,8 +210,8 @@
}
@Override
- public void executeDeleteFavoriteParticipant(TopiaContext transaction,
- String id) throws TopiaException {
+ public void executeDeleteFavoriteParticipant(TopiaContext transaction,
+ String id) throws TopiaException {
FavoriteParticipantDAO dao =
PollenDAOHelper.getFavoriteParticipantDAO(transaction);
@@ -225,8 +224,8 @@
}
@Override
- public void executeUpdateFavoriteParticipant(TopiaContext transaction,
- FavoriteParticipant participant)
+ public void executeUpdateFavoriteParticipant(TopiaContext transaction,
+ FavoriteParticipant participant)
throws TopiaException, PollenBusinessException {
FavoriteParticipantDAO dao =
@@ -248,7 +247,7 @@
}
@Override
- public FavoriteParticipant executeGetFavoriteParticipant(
+ public FavoriteParticipant executeGetFavoriteParticipant(
TopiaContext transaction, String id) throws TopiaException {
FavoriteParticipantDAO dao =
@@ -262,7 +261,7 @@
}
@Override
- public Map<String, FavoriteParticipant> executeGetFavoriteParticipants(
+ public Map<String, FavoriteParticipant> executeGetFavoriteParticipants(
TopiaContext transaction, EntityFilter filter) throws TopiaException {
FavoriteParticipantDAO dao =
@@ -286,8 +285,8 @@
}
@Override
- public int executeGetNbFavoriteParticipants(TopiaContext transaction,
- EntityFilter filter) throws TopiaException {
+ public int executeGetNbFavoriteParticipants(TopiaContext transaction,
+ EntityFilter filter) throws TopiaException {
FavoriteParticipantDAO dao =
PollenDAOHelper.getFavoriteParticipantDAO(transaction);
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServicePoll.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServicePoll.java 2012-01-23 22:31:35 UTC (rev 3110)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServicePoll.java 2012-01-23 23:05:59 UTC (rev 3111)
@@ -23,10 +23,7 @@
*/
package org.chorem.pollen.service.legacy;
-import java.util.Collection;
-import java.util.List;
import org.chorem.pollen.PollenBusinessException;
-import org.chorem.pollen.PollenException;
import org.chorem.pollen.bean.UserPoll;
import org.chorem.pollen.entity.Choice;
import org.chorem.pollen.entity.Comment;
@@ -37,63 +34,66 @@
import org.chorem.pollen.entity.UserAccount;
import org.nuiton.topia.framework.EntityFilter;
+import java.util.Collection;
+import java.util.List;
+
@Deprecated
public interface ServicePoll {
/**
* Build a new Poll instance with given {@code user} as administrator
+ *
* @param user Build a new Poll instance with given {@code user} as administrator
* @return Build a new Poll instance with given {@code user} as administrator
- * @throws PollenException
*/
- Poll getNewPoll(UserAccount user) throws PollenException;
+ Poll getNewPoll(UserAccount user);
/**
* Build a new Poll instance based on existing {@code poll} (copy)
+ *
* @param poll Build a new Poll instance based on existing {@code poll} (copy)
* @return Build a new Poll instance based on existing {@code poll} (copy)
- * @throws PollenException
*/
- Poll getNewPoll(Poll poll) throws PollenException;
+ Poll getNewPoll(Poll poll);
- Poll createPoll(Poll poll, Collection<ParticipantList> lists) throws PollenException, PollenBusinessException;
+ Poll createPoll(Poll poll, Collection<ParticipantList> lists) throws PollenBusinessException;
- Poll updatePoll(Poll poll) throws PollenException;
+ Poll updatePoll(Poll poll);
- void deletePoll(Poll poll) throws PollenException;
+ void deletePoll(Poll poll);
- boolean deleteChoice(Choice choice) throws PollenException;
+ boolean deleteChoice(Choice choice);
- List<UserPoll> getPolls(EntityFilter filter) throws PollenException;
+ List<UserPoll> getPolls(EntityFilter filter);
- List<Comment> getComments(EntityFilter filter) throws PollenException;
+ List<Comment> getComments(EntityFilter filter);
- ParticipantList getNewPollList() throws PollenException;
+ ParticipantList getNewPollList();
- Participant getNewPollParticipant() throws PollenException;
+ Participant getNewPollParticipant();
- Poll getPoll(String pollUid, String... properties) throws PollenException, PollenBusinessException;
+ Poll getPoll(String pollUid, String... properties) throws PollenBusinessException;
- boolean canAdminPoll(String accountUid, String pollUid) throws PollenException;
+ boolean canAdminPoll(String accountUid, String pollUid);
- int getNbTotalPolls() throws PollenException;
+ int getNbTotalPolls();
- int getNbPollsByUser(UserAccount user) throws PollenException;
+ int getNbPollsByUser(UserAccount user);
- List<Poll> getRunningPolls() throws PollenException;
+ List<Poll> getRunningPolls();
- int getNbComments(Poll poll) throws PollenException;
+ int getNbComments(Poll poll);
- Comment createComment(Poll poll, Comment comment) throws PollenException;
+ Comment createComment(Poll poll, Comment comment);
- boolean deleteComment(Comment comment) throws PollenException;
+ boolean deleteComment(Comment comment);
- Comment getNewComment(PollAccount account) throws PollenException;
+ Comment getNewComment(PollAccount account);
- Choice createChoice(Poll poll, Choice choice) throws PollenException;
+ Choice createChoice(Poll poll, Choice choice);
- Choice getNewChoice(Poll poll) throws PollenException;
+ Choice getNewChoice(Poll poll);
- void setPollClosed(Poll poll, boolean closed) throws PollenException;
+ void setPollClosed(Poll poll, boolean closed);
} //ServicePoll
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServicePollAbstract.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServicePollAbstract.java 2012-01-23 22:31:35 UTC (rev 3110)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServicePollAbstract.java 2012-01-23 23:05:59 UTC (rev 3111)
@@ -23,11 +23,7 @@
*/
package org.chorem.pollen.service.legacy;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
import org.chorem.pollen.PollenBusinessException;
-import org.chorem.pollen.PollenException;
import org.chorem.pollen.bean.UserPoll;
import org.chorem.pollen.entity.Choice;
import org.chorem.pollen.entity.Comment;
@@ -41,6 +37,10 @@
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.framework.EntityFilter;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
@Deprecated
public abstract class ServicePollAbstract implements ServicePoll {
@@ -48,15 +48,15 @@
protected void commitTransaction(TopiaContext transaction) throws TopiaException {
transaction.commitTransaction();
-}
+ }
protected abstract void closeTransaction(TopiaContext transaction) throws TopiaException;
- protected abstract void treateError(TopiaContext transaction, Exception eee, String message, Object... args) throws PollenException;
+ protected abstract void treateError(TopiaContext transaction, Exception eee, String message, Object... args);
- protected void treateError(Exception eee, String message, Object... args) throws PollenException {
- treateError(null, eee, message, args);
- }
+ protected void treateError(Exception eee, String message, Object... args) {
+ treateError(null, eee, message, args);
+ }
protected abstract Poll executeGetNewPoll(UserAccount user) throws Exception;
@@ -103,33 +103,33 @@
protected abstract void executeSetPollClosed(TopiaContext transaction, Poll poll, boolean closed) throws Exception;
@Override
- public Poll getNewPoll(UserAccount user) throws PollenException {
+ public Poll getNewPoll(UserAccount user) {
try {
-
- Poll result = executeGetNewPoll(user);
- return result;
+
+ Poll result = executeGetNewPoll(user);
+ return result;
} catch (Exception eee) {
- treateError(eee, I18n.n_("pollen.error.servicePoll.getNewPoll"));
+ treateError(eee, I18n.n_("pollen.error.servicePoll.getNewPoll"));
}
return null;
}
@Override
- public Poll getNewPoll(Poll poll) throws PollenException {
+ public Poll getNewPoll(Poll poll) {
try {
-
- Poll result = executeGetNewPoll(poll);
- return result;
+
+ Poll result = executeGetNewPoll(poll);
+ return result;
} catch (Exception eee) {
- treateError(eee, I18n.n_("pollen.error.servicePoll.getNewPoll"));
+ treateError(eee, I18n.n_("pollen.error.servicePoll.getNewPoll"));
}
return null;
}
@Override
- public Poll createPoll(Poll poll, Collection<ParticipantList> lists) throws PollenException, PollenBusinessException {
+ public Poll createPoll(Poll poll, Collection<ParticipantList> lists) throws PollenBusinessException {
List<Object> errorArgs = new ArrayList<Object>();
-
+
TopiaContext transaction = null;
try {
transaction = beginTransaction();
@@ -140,17 +140,17 @@
} finally {
closeTransaction(transaction);
}
-
+
} catch (PollenBusinessException eee) {
- throw eee;
+ throw eee;
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.servicePoll.createPoll"), errorArgs.toArray());
+ treateError(transaction, eee, I18n.n_("pollen.error.servicePoll.createPoll"), errorArgs.toArray());
}
return null;
}
@Override
- public Poll updatePoll(Poll poll) throws PollenException {
+ public Poll updatePoll(Poll poll) {
TopiaContext transaction = null;
try {
transaction = beginTransaction();
@@ -161,34 +161,34 @@
} finally {
closeTransaction(transaction);
}
-
+
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.servicePoll.updatePoll"));
+ treateError(transaction, eee, I18n.n_("pollen.error.servicePoll.updatePoll"));
}
return null;
}
@Override
- public void deletePoll(Poll poll) throws PollenException {
+ public void deletePoll(Poll poll) {
TopiaContext transaction = null;
try {
transaction = beginTransaction();
try {
executeDeletePoll(transaction, poll);
-
+
} finally {
closeTransaction(transaction);
}
-
+
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.servicePoll.deletePoll"));
+ treateError(transaction, eee, I18n.n_("pollen.error.servicePoll.deletePoll"));
}
-
+
}
@Override
- public boolean deleteChoice(Choice choice) throws PollenException {
+ public boolean deleteChoice(Choice choice) {
TopiaContext transaction = null;
try {
transaction = beginTransaction();
@@ -199,15 +199,15 @@
} finally {
closeTransaction(transaction);
}
-
+
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.servicePoll.deleteChoice"));
+ treateError(transaction, eee, I18n.n_("pollen.error.servicePoll.deleteChoice"));
}
return false;
}
@Override
- public List<UserPoll> getPolls(EntityFilter filter) throws PollenException {
+ public List<UserPoll> getPolls(EntityFilter filter) {
TopiaContext transaction = null;
try {
transaction = beginTransaction();
@@ -218,15 +218,15 @@
} finally {
closeTransaction(transaction);
}
-
+
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.servicePoll.getPolls"));
+ treateError(transaction, eee, I18n.n_("pollen.error.servicePoll.getPolls"));
}
return null;
}
@Override
- public List<Comment> getComments(EntityFilter filter) throws PollenException {
+ public List<Comment> getComments(EntityFilter filter) {
TopiaContext transaction = null;
try {
transaction = beginTransaction();
@@ -237,39 +237,39 @@
} finally {
closeTransaction(transaction);
}
-
+
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.servicePoll.getComments"));
+ treateError(transaction, eee, I18n.n_("pollen.error.servicePoll.getComments"));
}
return null;
}
@Override
- public ParticipantList getNewPollList() throws PollenException {
+ public ParticipantList getNewPollList() {
try {
-
- ParticipantList result = executeGetNewPollList();
- return result;
+
+ ParticipantList result = executeGetNewPollList();
+ return result;
} catch (Exception eee) {
- treateError(eee, I18n.n_("pollen.error.servicePoll.getNewPollList"));
+ treateError(eee, I18n.n_("pollen.error.servicePoll.getNewPollList"));
}
return null;
}
@Override
- public Participant getNewPollParticipant() throws PollenException {
+ public Participant getNewPollParticipant() {
try {
-
- Participant result = executeGetNewPollParticipant();
- return result;
+
+ Participant result = executeGetNewPollParticipant();
+ return result;
} catch (Exception eee) {
- treateError(eee, I18n.n_("pollen.error.servicePoll.getNewPollParticipant"));
+ treateError(eee, I18n.n_("pollen.error.servicePoll.getNewPollParticipant"));
}
return null;
}
@Override
- public Poll getPoll(String pollUid, String... properties) throws PollenException, PollenBusinessException {
+ public Poll getPoll(String pollUid, String... properties) throws PollenBusinessException {
TopiaContext transaction = null;
try {
transaction = beginTransaction();
@@ -280,17 +280,17 @@
} finally {
closeTransaction(transaction);
}
-
+
} catch (PollenBusinessException eee) {
- throw eee;
+ throw eee;
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.servicePoll.getPoll"));
+ treateError(transaction, eee, I18n.n_("pollen.error.servicePoll.getPoll"));
}
return null;
}
@Override
- public boolean canAdminPoll(String accountUid, String pollUid) throws PollenException {
+ public boolean canAdminPoll(String accountUid, String pollUid) {
TopiaContext transaction = null;
try {
transaction = beginTransaction();
@@ -301,15 +301,15 @@
} finally {
closeTransaction(transaction);
}
-
+
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.servicePoll.canAdminPoll"));
+ treateError(transaction, eee, I18n.n_("pollen.error.servicePoll.canAdminPoll"));
}
return false;
}
@Override
- public int getNbTotalPolls() throws PollenException {
+ public int getNbTotalPolls() {
TopiaContext transaction = null;
try {
transaction = beginTransaction();
@@ -320,15 +320,15 @@
} finally {
closeTransaction(transaction);
}
-
+
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.servicePoll.getNbTotalPolls"));
+ treateError(transaction, eee, I18n.n_("pollen.error.servicePoll.getNbTotalPolls"));
}
return 0;
}
@Override
- public int getNbPollsByUser(UserAccount user) throws PollenException {
+ public int getNbPollsByUser(UserAccount user) {
TopiaContext transaction = null;
try {
transaction = beginTransaction();
@@ -339,15 +339,15 @@
} finally {
closeTransaction(transaction);
}
-
+
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.servicePoll.getNbPollsByUser"));
+ treateError(transaction, eee, I18n.n_("pollen.error.servicePoll.getNbPollsByUser"));
}
return 0;
}
@Override
- public List<Poll> getRunningPolls() throws PollenException {
+ public List<Poll> getRunningPolls() {
TopiaContext transaction = null;
try {
transaction = beginTransaction();
@@ -358,15 +358,15 @@
} finally {
closeTransaction(transaction);
}
-
+
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.servicePoll.getRunningPolls"));
+ treateError(transaction, eee, I18n.n_("pollen.error.servicePoll.getRunningPolls"));
}
return null;
}
@Override
- public int getNbComments(Poll poll) throws PollenException {
+ public int getNbComments(Poll poll) {
TopiaContext transaction = null;
try {
transaction = beginTransaction();
@@ -377,15 +377,15 @@
} finally {
closeTransaction(transaction);
}
-
+
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.servicePoll.getNbComments"));
+ treateError(transaction, eee, I18n.n_("pollen.error.servicePoll.getNbComments"));
}
return 0;
}
@Override
- public Comment createComment(Poll poll, Comment comment) throws PollenException {
+ public Comment createComment(Poll poll, Comment comment) {
TopiaContext transaction = null;
try {
transaction = beginTransaction();
@@ -396,15 +396,15 @@
} finally {
closeTransaction(transaction);
}
-
+
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.servicePoll.createComment"));
+ treateError(transaction, eee, I18n.n_("pollen.error.servicePoll.createComment"));
}
return null;
}
@Override
- public boolean deleteComment(Comment comment) throws PollenException {
+ public boolean deleteComment(Comment comment) {
TopiaContext transaction = null;
try {
transaction = beginTransaction();
@@ -415,27 +415,27 @@
} finally {
closeTransaction(transaction);
}
-
+
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.servicePoll.deleteComment"));
+ treateError(transaction, eee, I18n.n_("pollen.error.servicePoll.deleteComment"));
}
return false;
}
@Override
- public Comment getNewComment(PollAccount account) throws PollenException {
+ public Comment getNewComment(PollAccount account) {
try {
-
- Comment result = executeGetNewComment(account);
- return result;
+
+ Comment result = executeGetNewComment(account);
+ return result;
} catch (Exception eee) {
- treateError(eee, I18n.n_("pollen.error.servicePoll.getNewComment"));
+ treateError(eee, I18n.n_("pollen.error.servicePoll.getNewComment"));
}
return null;
}
@Override
- public Choice createChoice(Poll poll, Choice choice) throws PollenException {
+ public Choice createChoice(Poll poll, Choice choice) {
TopiaContext transaction = null;
try {
transaction = beginTransaction();
@@ -446,42 +446,42 @@
} finally {
closeTransaction(transaction);
}
-
+
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.servicePoll.createChoice"));
+ treateError(transaction, eee, I18n.n_("pollen.error.servicePoll.createChoice"));
}
return null;
}
@Override
- public Choice getNewChoice(Poll poll) throws PollenException {
+ public Choice getNewChoice(Poll poll) {
try {
-
- Choice result = executeGetNewChoice(poll);
- return result;
+
+ Choice result = executeGetNewChoice(poll);
+ return result;
} catch (Exception eee) {
- treateError(eee, I18n.n_("pollen.error.servicePoll.getNewChoice"));
+ treateError(eee, I18n.n_("pollen.error.servicePoll.getNewChoice"));
}
return null;
}
@Override
- public void setPollClosed(Poll poll, boolean closed) throws PollenException {
+ public void setPollClosed(Poll poll, boolean closed) {
TopiaContext transaction = null;
try {
transaction = beginTransaction();
try {
executeSetPollClosed(transaction, poll, closed);
-
+
} finally {
closeTransaction(transaction);
}
-
+
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.servicePoll.setPollClosed"));
+ treateError(transaction, eee, I18n.n_("pollen.error.servicePoll.setPollClosed"));
}
-
+
}
} //ServicePollAbstract
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServicePollImpl.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServicePollImpl.java 2012-01-23 22:31:35 UTC (rev 3110)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServicePollImpl.java 2012-01-23 23:05:59 UTC (rev 3111)
@@ -30,7 +30,6 @@
import org.chorem.pollen.PollenBusinessException;
import org.chorem.pollen.PollenContext;
import org.chorem.pollen.PollenDAOHelper;
-import org.chorem.pollen.PollenException;
import org.chorem.pollen.PollenQueryHelper;
import org.chorem.pollen.bean.UserPoll;
import org.chorem.pollen.common.ChoiceType;
@@ -70,7 +69,7 @@
* Created: 23 mars 2010
*
* @author fdesbois
- * $Id$
+ * $Id$
*/
@Deprecated
public class ServicePollImpl extends ServicePollAbstract {
@@ -90,7 +89,7 @@
@Override
protected void treateError(TopiaContext transaction, Exception eee,
- String message, Object... args) throws PollenException {
+ String message, Object... args) {
context.treateError(transaction, eee, message, args);
}
@@ -100,7 +99,7 @@
}
@Override
- public Poll executeGetNewPoll(UserAccount user) {
+ public Poll executeGetNewPoll(UserAccount user) {
Poll poll = new PollImpl();
poll.setChoiceType(ChoiceType.TEXT);
poll.setVoteCounting(VoteCountingType.NORMAL);
@@ -122,15 +121,15 @@
}
@Override
- public Poll executeGetNewPoll(Poll poll) {
+ public Poll executeGetNewPoll(Poll poll) {
Poll result = new PollImpl();
TopiaEntityBinder<Poll> binder = PollenBinderHelper.getSimpleTopiaBinder(Poll.class);
//TODO-fdesbois-2010-07-13 : add test and check if exluding only those properties is realistic
binder.copyExcluding(poll, result,
- Poll.PROPERTY_UID,
- Poll.PROPERTY_CLOSED,
- Poll.PROPERTY_RESULT,
- Poll.PROPERTY_POLL_ACCOUNT
+ Poll.PROPERTY_UID,
+ Poll.PROPERTY_CLOSED,
+ Poll.PROPERTY_RESULT,
+ Poll.PROPERTY_POLL_ACCOUNT
);
// Copy of participants only for no free poll
if (poll.getType().isRestrictedOrGroup()) {
@@ -140,8 +139,8 @@
}
@Override
- public Poll executeCreatePoll(TopiaContext transaction,
- List<Object> errorArgs, Poll poll, Collection<ParticipantList> lists)
+ public Poll executeCreatePoll(TopiaContext transaction,
+ List<Object> errorArgs, Poll poll, Collection<ParticipantList> lists)
throws TopiaException,
IllegalArgumentException,
PollenBusinessException {
@@ -163,7 +162,7 @@
if (!newPoll.getType().isFree()) {
// Create accounts depends on pollType and lists argument
List<PollAccount> accounts = createPollAccounts(transaction,
- newPoll.getType(), lists);
+ newPoll.getType(), lists);
newPoll.setPollAccount(accounts);
}
@@ -181,8 +180,8 @@
}
@Override
- public Poll executeUpdatePoll(TopiaContext transaction,
- Poll poll) throws TopiaException {
+ public Poll executeUpdatePoll(TopiaContext transaction,
+ Poll poll) throws TopiaException {
PollDAO dao = PollenDAOHelper.getPollDAO(transaction);
@@ -219,17 +218,17 @@
// Idea, if we can use Embeddable object for Hibernate, Options will be a good use case
binder.copy(poll, pollToUpdate,
- Poll.PROPERTY_TITLE,
- Poll.PROPERTY_DESCRIPTION,
- Poll.PROPERTY_BEGIN_DATE,
- Poll.PROPERTY_END_DATE,
- Poll.PROPERTY_ANONYMOUS_VOTE_ALLOWED,
- Poll.PROPERTY_CHOICE_ADD_ALLOWED,
- Poll.PROPERTY_BEGIN_CHOICE_DATE,
- Poll.PROPERTY_END_CHOICE_DATE,
- Poll.PROPERTY_CONTINUOUS_RESULTS,
- Poll.PROPERTY_PUBLIC_RESULTS,
- Poll.PROPERTY_MAX_CHOICE_NB
+ Poll.PROPERTY_TITLE,
+ Poll.PROPERTY_DESCRIPTION,
+ Poll.PROPERTY_BEGIN_DATE,
+ Poll.PROPERTY_END_DATE,
+ Poll.PROPERTY_ANONYMOUS_VOTE_ALLOWED,
+ Poll.PROPERTY_CHOICE_ADD_ALLOWED,
+ Poll.PROPERTY_BEGIN_CHOICE_DATE,
+ Poll.PROPERTY_END_CHOICE_DATE,
+ Poll.PROPERTY_CONTINUOUS_RESULTS,
+ Poll.PROPERTY_PUBLIC_RESULTS,
+ Poll.PROPERTY_MAX_CHOICE_NB
);
// if not started
@@ -266,14 +265,14 @@
}
@Override
- public void executeDeletePoll(TopiaContext transaction, Poll poll)
+ public void executeDeletePoll(TopiaContext transaction, Poll poll)
throws TopiaException {
PollDAO dao = PollenDAOHelper.getPollDAO(transaction);
dao.delete(poll);
- transaction.commitTransaction();
+ transaction.commitTransaction();
}
@Override
@@ -284,7 +283,7 @@
}
@Override
- public void executeSetPollClosed(TopiaContext transaction, Poll poll, boolean closed) throws TopiaException {
+ public void executeSetPollClosed(TopiaContext transaction, Poll poll, boolean closed) throws TopiaException {
PollDAO dao = PollenDAOHelper.getPollDAO(transaction);
@@ -296,8 +295,8 @@
}
@Override
- public Choice executeCreateChoice(TopiaContext transaction,
- Poll poll, Choice choice)
+ public Choice executeCreateChoice(TopiaContext transaction,
+ Poll poll, Choice choice)
throws TopiaException {
ChoiceDAO dao = PollenDAOHelper.getChoiceDAO(transaction);
@@ -321,7 +320,7 @@
}
@Override
- public boolean executeDeleteChoice(TopiaContext transaction, Choice choice)
+ public boolean executeDeleteChoice(TopiaContext transaction, Choice choice)
throws TopiaException {
ChoiceDAO dao = PollenDAOHelper.getChoiceDAO(transaction);
@@ -333,7 +332,7 @@
}
@Override
- public List<Poll> executeGetRunningPolls(TopiaContext transaction)
+ public List<Poll> executeGetRunningPolls(TopiaContext transaction)
throws TopiaException {
PollDAO dao = PollenDAOHelper.getPollDAO(transaction);
@@ -344,9 +343,9 @@
Date now = context.getCurrentDate();
query.addWhere(Poll.PROPERTY_BEGIN_DATE, TopiaQuery.Op.LE, now).
- addWhere(Poll.PROPERTY_END_DATE, TopiaQuery.Op.GE, now).
- addEquals(Poll.PROPERTY_CLOSED, Boolean.FALSE).
- addOrderDesc(Poll.TOPIA_CREATE_DATE);
+ addWhere(Poll.PROPERTY_END_DATE, TopiaQuery.Op.GE, now).
+ addEquals(Poll.PROPERTY_CLOSED, Boolean.FALSE).
+ addOrderDesc(Poll.TOPIA_CREATE_DATE);
List<Poll> results = dao.findAllByQuery(query);
@@ -354,14 +353,14 @@
}
@Override
- public List<UserPoll> executeGetPolls(TopiaContext transaction,
- EntityFilter filter)
+ public List<UserPoll> executeGetPolls(TopiaContext transaction,
+ EntityFilter filter)
throws TopiaException {
PollDAO dao = PollenDAOHelper.getPollDAO(transaction);
PollenQueryHelper.PollAccountProperty participantProperty =
- PollenQueryHelper.newPollAccountChildProperty();
+ PollenQueryHelper.newPollAccountChildProperty();
// Filter can be apply on userAccount as reference
TopiaQuery query = dao.createQueryFindAllByUser(filter);
@@ -376,8 +375,8 @@
}
@Override
- public int executeGetNbPollsByUser(TopiaContext transaction,
- UserAccount user)
+ public int executeGetNbPollsByUser(TopiaContext transaction,
+ UserAccount user)
throws TopiaException {
PollDAO dao = PollenDAOHelper.getPollDAO(transaction);
@@ -392,7 +391,7 @@
}
@Override
- public int executeGetNbTotalPolls(TopiaContext transaction)
+ public int executeGetNbTotalPolls(TopiaContext transaction)
throws TopiaException {
Long result = PollenDAOHelper.getPollDAO(transaction).count();
@@ -401,8 +400,8 @@
}
@Override
- public List<Comment> executeGetComments(TopiaContext transaction,
- EntityFilter filter)
+ public List<Comment> executeGetComments(TopiaContext transaction,
+ EntityFilter filter)
throws TopiaException {
CommentDAO dao = PollenDAOHelper.getCommentDAO(transaction);
@@ -431,8 +430,8 @@
}
@Override
- public int executeGetNbComments(TopiaContext transaction,
- Poll poll)
+ public int executeGetNbComments(TopiaContext transaction,
+ Poll poll)
throws TopiaException {
PollDAO dao = PollenDAOHelper.getPollDAO(transaction);
@@ -445,8 +444,8 @@
}
@Override
- public Comment executeCreateComment(TopiaContext transaction,
- Poll poll, Comment comment)
+ public Comment executeCreateComment(TopiaContext transaction,
+ Poll poll, Comment comment)
throws TopiaException {
CommentDAO dao = PollenDAOHelper.getCommentDAO(transaction);
@@ -471,8 +470,8 @@
}
@Override
- public boolean executeDeleteComment(TopiaContext transaction,
- Comment comment)
+ public boolean executeDeleteComment(TopiaContext transaction,
+ Comment comment)
throws TopiaException {
CommentDAO dao = PollenDAOHelper.getCommentDAO(transaction);
@@ -485,7 +484,7 @@
}
@Override
- public Comment executeGetNewComment(PollAccount account) {
+ public Comment executeGetNewComment(PollAccount account) {
Comment newComment = new CommentImpl();
if (account != null) {
newComment.setAuthor(account.getName());
@@ -494,7 +493,7 @@
}
@Override
- public ParticipantList executeGetNewPollList() {
+ public ParticipantList executeGetNewPollList() {
PollAccount list = new PollAccountImpl();
list.setList(true);
list.setChild(new ArrayList<PollAccount>());
@@ -502,15 +501,15 @@
}
@Override
- public Participant executeGetNewPollParticipant() {
+ public Participant executeGetNewPollParticipant() {
PollAccount participant = new PollAccountImpl();
participant.setWeight(1.);
return participant;
}
@Override
- public boolean executeCanAdminPoll(TopiaContext transaction,
- String accountUid, String pollUid)
+ public boolean executeCanAdminPoll(TopiaContext transaction,
+ String accountUid, String pollUid)
throws TopiaException {
// String creatorUidProperty =
@@ -537,8 +536,8 @@
}
@Override
- public Poll executeGetPoll(TopiaContext transaction,
- String pollUid, String... properties)
+ public Poll executeGetPoll(TopiaContext transaction,
+ String pollUid, String... properties)
throws TopiaException, PollenBusinessException {
// Property is used to control the alias and dependencies inside the query
@@ -579,20 +578,20 @@
// Closed (not used in this case) and Creator (managed separately)
PollenBinderHelper.getSimpleTopiaBinder(Poll.class).
copyExcluding(source, newPoll,
- Poll.PROPERTY_UID,
- Poll.PROPERTY_CLOSED,
- Poll.PROPERTY_CREATOR);
+ Poll.PROPERTY_UID,
+ Poll.PROPERTY_CLOSED,
+ Poll.PROPERTY_CREATOR);
// Create creator and set him to the poll
PollAccount creator = accountDAO.create(context.createPollenUrlId());
PollenBinderHelper.getSimpleTopiaBinder(PollAccount.class).
copy(source.getCreator(), creator,
- PollAccount.PROPERTY_NAME,
- PollAccount.PROPERTY_EMAIL,
+ PollAccount.PROPERTY_NAME,
+ PollAccount.PROPERTY_EMAIL,
// PollAccount.WEIGHT,
- PollAccount.PROPERTY_ADMIN,
- PollAccount.PROPERTY_USER_ACCOUNT);
+ PollAccount.PROPERTY_ADMIN,
+ PollAccount.PROPERTY_USER_ACCOUNT);
accountDAO.update(creator);
newPoll.setCreator(creator);
@@ -613,16 +612,16 @@
case RESTRICTED:
if (CollectionUtils.isEmpty(lists)) {
throw new IllegalArgumentException("lists can't be empty" +
- " for restricted poll");
+ " for restricted poll");
}
// Create accounts only on first participant list
results = createPersonAccounts(accountDAO,
- lists.iterator().next());
+ lists.iterator().next());
break;
case GROUP:
if (CollectionUtils.isEmpty(lists)) {
throw new IllegalArgumentException("lists can't be empty" +
- " for group poll");
+ " for group poll");
}
for (ParticipantList list : lists) {
@@ -679,8 +678,8 @@
return results;
}
- protected List<UserPoll> retrieveUserPolls(TopiaContext transaction,
- TopiaQuery query)
+ protected List<UserPoll> retrieveUserPolls(TopiaContext transaction,
+ TopiaQuery query)
throws TopiaException {
List<UserPoll> results = new ArrayList<UserPoll>();
@@ -695,10 +694,10 @@
PollAccount account = (PollAccount) row[1];
if (log.isDebugEnabled()) {
log.debug("account : " + account.getUid() + " : " +
- account.getName() +
- " list(" + account.isList() + ")" +
- " admin(" + account.isAdmin() + ")" +
- " for poll " + poll.getTitle());
+ account.getName() +
+ " list(" + account.isList() + ")" +
+ " admin(" + account.isAdmin() + ")" +
+ " for poll " + poll.getTitle());
}
UserPoll userPoll = pollsCache.get(poll.getTopiaId());
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceUserAbstract.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceUserAbstract.java 2012-01-23 22:31:35 UTC (rev 3110)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceUserAbstract.java 2012-01-23 23:05:59 UTC (rev 3111)
@@ -23,17 +23,17 @@
*/
package org.chorem.pollen.service.legacy;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
import org.chorem.pollen.PollenBusinessException;
-import org.chorem.pollen.PollenException;
import org.chorem.pollen.entity.UserAccount;
import org.nuiton.i18n.I18n;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.framework.EntityFilter;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
@Deprecated
public abstract class ServiceUserAbstract implements ServiceUser {
@@ -41,15 +41,15 @@
protected void commitTransaction(TopiaContext transaction) throws TopiaException {
transaction.commitTransaction();
-}
+ }
protected abstract void closeTransaction(TopiaContext transaction) throws TopiaException;
- protected abstract void treateError(TopiaContext transaction, Exception eee, String message, Object... args) throws PollenException;
+ protected abstract void treateError(TopiaContext transaction, Exception eee, String message, Object... args);
- protected void treateError(Exception eee, String message, Object... args) throws PollenException {
- treateError(null, eee, message, args);
- }
+ protected void treateError(Exception eee, String message, Object... args) {
+ treateError(null, eee, message, args);
+ }
protected abstract UserAccount executeConnect(TopiaContext transaction, List<Object> errorArgs, String login, String password) throws Exception;
@@ -66,9 +66,9 @@
protected abstract int executeGetNbUsers(TopiaContext transaction) throws Exception;
@Override
- public UserAccount connect(String login, String password) throws PollenException, PollenBusinessException {
+ public UserAccount connect(String login, String password) throws PollenBusinessException {
List<Object> errorArgs = new ArrayList<Object>();
-
+
TopiaContext transaction = null;
try {
transaction = beginTransaction();
@@ -79,94 +79,94 @@
} finally {
closeTransaction(transaction);
}
-
+
} catch (PollenBusinessException eee) {
- throw eee;
+ throw eee;
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.serviceUser.connect"), errorArgs.toArray());
+ treateError(transaction, eee, I18n.n_("pollen.error.serviceUser.connect"), errorArgs.toArray());
}
return null;
}
@Override
- public UserAccount getNewUser() throws PollenException {
+ public UserAccount getNewUser() {
try {
-
- UserAccount result = executeGetNewUser();
- return result;
+
+ UserAccount result = executeGetNewUser();
+ return result;
} catch (Exception eee) {
- treateError(eee, I18n.n_("pollen.error.serviceUser.getNewUser"));
+ treateError(eee, I18n.n_("pollen.error.serviceUser.getNewUser"));
}
return null;
}
@Override
- public void createUser(UserAccount user) throws PollenException, PollenBusinessException {
+ public void createUser(UserAccount user) throws PollenBusinessException {
List<Object> errorArgs = new ArrayList<Object>();
-
+
TopiaContext transaction = null;
try {
transaction = beginTransaction();
try {
executeCreateUser(transaction, errorArgs, user);
-
+
} finally {
closeTransaction(transaction);
}
-
+
} catch (PollenBusinessException eee) {
- throw eee;
+ throw eee;
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.serviceUser.createUser"), errorArgs.toArray());
+ treateError(transaction, eee, I18n.n_("pollen.error.serviceUser.createUser"), errorArgs.toArray());
}
-
+
}
@Override
- public void updateUser(UserAccount user, boolean byAdmin) throws PollenException, PollenBusinessException {
+ public void updateUser(UserAccount user, boolean byAdmin) throws PollenBusinessException {
List<Object> errorArgs = new ArrayList<Object>();
-
+
TopiaContext transaction = null;
try {
transaction = beginTransaction();
try {
executeUpdateUser(transaction, errorArgs, user, byAdmin);
-
+
} finally {
closeTransaction(transaction);
}
-
+
} catch (PollenBusinessException eee) {
- throw eee;
+ throw eee;
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.serviceUser.updateUser"), errorArgs.toArray());
+ treateError(transaction, eee, I18n.n_("pollen.error.serviceUser.updateUser"), errorArgs.toArray());
}
-
+
}
@Override
- public void deleteUser(String login) throws PollenException {
+ public void deleteUser(String login) {
TopiaContext transaction = null;
try {
transaction = beginTransaction();
try {
executeDeleteUser(transaction, login);
-
+
} finally {
closeTransaction(transaction);
}
-
+
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.serviceUser.deleteUser"));
+ treateError(transaction, eee, I18n.n_("pollen.error.serviceUser.deleteUser"));
}
-
+
}
@Override
- public Map<String, UserAccount> getUsers(EntityFilter filter) throws PollenException {
+ public Map<String, UserAccount> getUsers(EntityFilter filter) {
TopiaContext transaction = null;
try {
transaction = beginTransaction();
@@ -177,15 +177,15 @@
} finally {
closeTransaction(transaction);
}
-
+
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.serviceUser.getUsers"));
+ treateError(transaction, eee, I18n.n_("pollen.error.serviceUser.getUsers"));
}
return null;
}
@Override
- public int getNbUsers() throws PollenException {
+ public int getNbUsers() {
TopiaContext transaction = null;
try {
transaction = beginTransaction();
@@ -196,9 +196,9 @@
} finally {
closeTransaction(transaction);
}
-
+
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.serviceUser.getNbUsers"));
+ treateError(transaction, eee, I18n.n_("pollen.error.serviceUser.getNbUsers"));
}
return 0;
}
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceUserImpl.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceUserImpl.java 2012-01-23 22:31:35 UTC (rev 3110)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceUserImpl.java 2012-01-23 23:05:59 UTC (rev 3111)
@@ -24,7 +24,7 @@
package org.chorem.pollen.service.legacy;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.pollen.PollenBinderHelper;
@@ -32,7 +32,6 @@
import org.chorem.pollen.PollenBusinessException.PollenExceptionType;
import org.chorem.pollen.PollenContext;
import org.chorem.pollen.PollenDAOHelper;
-import org.chorem.pollen.PollenException;
import org.chorem.pollen.entity.UserAccount;
import org.chorem.pollen.entity.UserAccountDAO;
import org.chorem.pollen.entity.UserAccountImpl;
@@ -76,7 +75,7 @@
@Override
protected void treateError(TopiaContext transaction, Exception eee,
- String message, Object... args) throws PollenException {
+ String message, Object... args) {
context.treateError(transaction, eee, message, args);
}
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceVote.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceVote.java 2012-01-23 22:31:35 UTC (rev 3110)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceVote.java 2012-01-23 23:05:59 UTC (rev 3111)
@@ -23,9 +23,7 @@
*/
package org.chorem.pollen.service.legacy;
-import java.util.List;
import org.chorem.pollen.PollenBusinessException;
-import org.chorem.pollen.PollenException;
import org.chorem.pollen.entity.Choice;
import org.chorem.pollen.entity.Poll;
import org.chorem.pollen.entity.PollAccount;
@@ -33,25 +31,27 @@
import org.chorem.pollen.entity.Vote;
import org.nuiton.topia.framework.EntityFilter;
+import java.util.List;
+
@Deprecated
public interface ServiceVote {
- boolean canVote(Poll poll, PollAccount participant) throws PollenException;
+ boolean canVote(Poll poll, PollAccount participant);
- PollAccount getNewPollAccount(UserAccount user) throws PollenException;
+ PollAccount getNewPollAccount(UserAccount user);
- PollAccount getPollAccount(String accountUid) throws PollenException;
+ PollAccount getPollAccount(String accountUid);
- List<PollAccount> getVotes(EntityFilter filter) throws PollenException;
+ List<PollAccount> getVotes(EntityFilter filter);
- void deleteVote(Poll poll, PollAccount participant) throws PollenException;
+ void deleteVote(Poll poll, PollAccount participant);
- int getNbVotes(Poll poll) throws PollenException;
+ int getNbVotes(Poll poll);
- Vote getNewVote(Choice choice) throws PollenException;
+ Vote getNewVote(Choice choice);
- PollAccount saveVote(Poll poll, PollAccount participant) throws PollenException, PollenBusinessException;
+ PollAccount saveVote(Poll poll, PollAccount participant) throws PollenBusinessException;
- PollAccount findPollAccount(Poll poll, UserAccount user) throws PollenException;
+ PollAccount findPollAccount(Poll poll, UserAccount user);
} //ServiceVote
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceVoteAbstract.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceVoteAbstract.java 2012-01-23 22:31:35 UTC (rev 3110)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceVoteAbstract.java 2012-01-23 23:05:59 UTC (rev 3111)
@@ -23,9 +23,7 @@
*/
package org.chorem.pollen.service.legacy;
-import java.util.List;
import org.chorem.pollen.PollenBusinessException;
-import org.chorem.pollen.PollenException;
import org.chorem.pollen.entity.Choice;
import org.chorem.pollen.entity.Poll;
import org.chorem.pollen.entity.PollAccount;
@@ -36,6 +34,8 @@
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.framework.EntityFilter;
+import java.util.List;
+
@Deprecated
public abstract class ServiceVoteAbstract implements ServiceVote {
@@ -43,15 +43,15 @@
protected void commitTransaction(TopiaContext transaction) throws TopiaException {
transaction.commitTransaction();
-}
+ }
protected abstract void closeTransaction(TopiaContext transaction) throws TopiaException;
- protected abstract void treateError(TopiaContext transaction, Exception eee, String message, Object... args) throws PollenException;
+ protected abstract void treateError(TopiaContext transaction, Exception eee, String message, Object... args);
- protected void treateError(Exception eee, String message, Object... args) throws PollenException {
- treateError(null, eee, message, args);
- }
+ protected void treateError(Exception eee, String message, Object... args) {
+ treateError(null, eee, message, args);
+ }
protected abstract boolean executeCanVote(TopiaContext transaction, Poll poll, PollAccount participant) throws Exception;
@@ -72,7 +72,7 @@
protected abstract PollAccount executeFindPollAccount(TopiaContext transaction, Poll poll, UserAccount user) throws Exception;
@Override
- public boolean canVote(Poll poll, PollAccount participant) throws PollenException {
+ public boolean canVote(Poll poll, PollAccount participant) {
TopiaContext transaction = null;
try {
transaction = beginTransaction();
@@ -83,27 +83,27 @@
} finally {
closeTransaction(transaction);
}
-
+
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.serviceVote.canVote"));
+ treateError(transaction, eee, I18n.n_("pollen.error.serviceVote.canVote"));
}
return false;
}
@Override
- public PollAccount getNewPollAccount(UserAccount user) throws PollenException {
+ public PollAccount getNewPollAccount(UserAccount user) {
try {
-
- PollAccount result = executeGetNewPollAccount(user);
- return result;
+
+ PollAccount result = executeGetNewPollAccount(user);
+ return result;
} catch (Exception eee) {
- treateError(eee, I18n.n_("pollen.error.serviceVote.getNewPollAccount"));
+ treateError(eee, I18n.n_("pollen.error.serviceVote.getNewPollAccount"));
}
return null;
}
@Override
- public PollAccount getPollAccount(String accountUid) throws PollenException {
+ public PollAccount getPollAccount(String accountUid) {
TopiaContext transaction = null;
try {
transaction = beginTransaction();
@@ -114,15 +114,15 @@
} finally {
closeTransaction(transaction);
}
-
+
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.serviceVote.getPollAccount"));
+ treateError(transaction, eee, I18n.n_("pollen.error.serviceVote.getPollAccount"));
}
return null;
}
@Override
- public List<PollAccount> getVotes(EntityFilter filter) throws PollenException {
+ public List<PollAccount> getVotes(EntityFilter filter) {
TopiaContext transaction = null;
try {
transaction = beginTransaction();
@@ -133,34 +133,34 @@
} finally {
closeTransaction(transaction);
}
-
+
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.serviceVote.getVotes"));
+ treateError(transaction, eee, I18n.n_("pollen.error.serviceVote.getVotes"));
}
return null;
}
@Override
- public void deleteVote(Poll poll, PollAccount participant) throws PollenException {
+ public void deleteVote(Poll poll, PollAccount participant) {
TopiaContext transaction = null;
try {
transaction = beginTransaction();
try {
executeDeleteVote(transaction, poll, participant);
-
+
} finally {
closeTransaction(transaction);
}
-
+
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.serviceVote.deleteVote"));
+ treateError(transaction, eee, I18n.n_("pollen.error.serviceVote.deleteVote"));
}
-
+
}
@Override
- public int getNbVotes(Poll poll) throws PollenException {
+ public int getNbVotes(Poll poll) {
TopiaContext transaction = null;
try {
transaction = beginTransaction();
@@ -171,27 +171,27 @@
} finally {
closeTransaction(transaction);
}
-
+
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.serviceVote.getNbVotes"));
+ treateError(transaction, eee, I18n.n_("pollen.error.serviceVote.getNbVotes"));
}
return 0;
}
@Override
- public Vote getNewVote(Choice choice) throws PollenException {
+ public Vote getNewVote(Choice choice) {
try {
-
- Vote result = executeGetNewVote(choice);
- return result;
+
+ Vote result = executeGetNewVote(choice);
+ return result;
} catch (Exception eee) {
- treateError(eee, I18n.n_("pollen.error.serviceVote.getNewVote"));
+ treateError(eee, I18n.n_("pollen.error.serviceVote.getNewVote"));
}
return null;
}
@Override
- public PollAccount saveVote(Poll poll, PollAccount participant) throws PollenException, PollenBusinessException {
+ public PollAccount saveVote(Poll poll, PollAccount participant) throws PollenBusinessException {
TopiaContext transaction = null;
try {
transaction = beginTransaction();
@@ -202,17 +202,17 @@
} finally {
closeTransaction(transaction);
}
-
+
} catch (PollenBusinessException eee) {
- throw eee;
+ throw eee;
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.serviceVote.saveVote"));
+ treateError(transaction, eee, I18n.n_("pollen.error.serviceVote.saveVote"));
}
return null;
}
@Override
- public PollAccount findPollAccount(Poll poll, UserAccount user) throws PollenException {
+ public PollAccount findPollAccount(Poll poll, UserAccount user) {
TopiaContext transaction = null;
try {
transaction = beginTransaction();
@@ -223,9 +223,9 @@
} finally {
closeTransaction(transaction);
}
-
+
} catch (Exception eee) {
- treateError(transaction, eee, I18n.n_("pollen.error.serviceVote.findPollAccount"));
+ treateError(transaction, eee, I18n.n_("pollen.error.serviceVote.findPollAccount"));
}
return null;
}
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceVoteImpl.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceVoteImpl.java 2012-01-23 22:31:35 UTC (rev 3110)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceVoteImpl.java 2012-01-23 23:05:59 UTC (rev 3111)
@@ -23,14 +23,13 @@
*/
package org.chorem.pollen.service.legacy;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.pollen.PollenBinderHelper;
import org.chorem.pollen.PollenBusinessException;
import org.chorem.pollen.PollenContext;
import org.chorem.pollen.PollenDAOHelper;
-import org.chorem.pollen.PollenException;
import org.chorem.pollen.PollenQueryHelper;
import org.chorem.pollen.entity.Choice;
import org.chorem.pollen.entity.Poll;
@@ -74,7 +73,7 @@
@Override
protected void treateError(TopiaContext transaction, Exception eee,
- String message, Object... args) throws PollenException {
+ String message, Object... args) {
context.treateError(transaction, eee, message, args);
}
@@ -100,7 +99,7 @@
if (source.isAnonymous()) {
if (log.isInfoEnabled()) {
log.info("Anonymous vote, doesn't copy participant's data : " +
- "name, email, userAccount");
+ "name, email, userAccount");
}
excludes = new String[]{
@@ -117,9 +116,9 @@
}
@Override
- public boolean executeCanVote(TopiaContext transaction,
- Poll poll,
- PollAccount participant)
+ public boolean executeCanVote(TopiaContext transaction,
+ Poll poll,
+ PollAccount participant)
throws TopiaException {
if (log.isDebugEnabled()) {
@@ -152,7 +151,7 @@
Poll.PROPERTY_CREATOR);
query.addEquals(participantAlias, participant).
- addWhere(pollCreatorProperty, TopiaQuery.Op.NEQ, participant);
+ addWhere(pollCreatorProperty, TopiaQuery.Op.NEQ, participant);
if (log.isDebugEnabled()) {
log.debug("Query : " + query);
@@ -164,7 +163,7 @@
}
@Override
- public PollAccount executeGetNewPollAccount(UserAccount user) {
+ public PollAccount executeGetNewPollAccount(UserAccount user) {
PollAccount account = new PollAccountImpl();
if (user != null) {
account.setName(user.getDisplayName());
@@ -175,8 +174,8 @@
}
@Override
- public PollAccount executeGetPollAccount(TopiaContext transaction,
- String accountUid)
+ public PollAccount executeGetPollAccount(TopiaContext transaction,
+ String accountUid)
throws TopiaException {
PollenQueryHelper.PollAccountProperty accountProperty =
@@ -185,7 +184,7 @@
TopiaQuery query = PollenQueryHelper.createQuery(accountProperty).
addEquals(accountProperty.uid(), accountUid).
// Need fetching account votes to edit them
- addFetch(accountProperty.choiceVote());
+ addFetch(accountProperty.choiceVote());
PollAccount result = PollenDAOHelper.getPollAccountDAO(transaction).
findByQuery(query);
@@ -194,8 +193,8 @@
}
@Override
- public List<PollAccount> executeGetVotes(TopiaContext transaction,
- EntityFilter filter)
+ public List<PollAccount> executeGetVotes(TopiaContext transaction,
+ EntityFilter filter)
throws TopiaException {
PollAccountDAO dao = PollenDAOHelper.getPollAccountDAO(transaction);
@@ -213,8 +212,8 @@
PollenQueryHelper.newPollAccountProperty();
TopiaQuery query = dao.createQueryFindAllByPoll(filter).
- addDistinct().
- addFetch(accountProperty.choiceVoteProperty().choice());
+ addDistinct().
+ addFetch(accountProperty.choiceVoteProperty().choice());
List<PollAccount> results = dao.findAllByQuery(query);
@@ -226,7 +225,7 @@
}
@Override
- public int executeGetNbVotes(TopiaContext transaction, Poll poll)
+ public int executeGetNbVotes(TopiaContext transaction, Poll poll)
throws TopiaException {
PollAccountDAO dao = PollenDAOHelper.getPollAccountDAO(transaction);
@@ -240,8 +239,8 @@
}
@Override
- public void executeDeleteVote(TopiaContext transaction, Poll poll,
- PollAccount participant) throws TopiaException {
+ public void executeDeleteVote(TopiaContext transaction, Poll poll,
+ PollAccount participant) throws TopiaException {
// For free poll, delete the participant
// For other types, delete all votes and set voteDate to null
@@ -275,15 +274,15 @@
}
@Override
- public Vote executeGetNewVote(Choice choice) {
+ public Vote executeGetNewVote(Choice choice) {
Vote result = new VoteImpl();
result.setChoice(choice);
return result;
}
@Override
- public PollAccount executeSaveVote(TopiaContext transaction, Poll poll,
- PollAccount participant)
+ public PollAccount executeSaveVote(TopiaContext transaction, Poll poll,
+ PollAccount participant)
throws TopiaException, PollenBusinessException {
// 1- executeCanVote(transaction, poll, participant);
@@ -326,7 +325,7 @@
if (log.isDebugEnabled()) {
log.debug("Vote " + participantToSave.getName() +
- " updated : " + participantToSave.getVoteDate());
+ " updated : " + participantToSave.getVoteDate());
}
// Save votes
@@ -349,7 +348,7 @@
}
@Override
- public PollAccount executeFindPollAccount(TopiaContext transaction, Poll poll, UserAccount user) throws Exception {
+ public PollAccount executeFindPollAccount(TopiaContext transaction, Poll poll, UserAccount user) throws Exception {
throw new UnsupportedOperationException("unsupported operation findPollAccount");
}
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/FavoriteService.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/FavoriteService.java 2012-01-23 22:31:35 UTC (rev 3110)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/FavoriteService.java 2012-01-23 23:05:59 UTC (rev 3111)
@@ -23,7 +23,7 @@
*/
package org.chorem.pollen.services;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.pollen.PollenDAOHelper;
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/PollService.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/PollService.java 2012-01-23 22:31:35 UTC (rev 3110)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/PollService.java 2012-01-23 23:05:59 UTC (rev 3111)
@@ -29,7 +29,6 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.pollen.PollenBinderHelper;
import org.chorem.pollen.PollenDAOHelper;
-import org.chorem.pollen.PollenException;
import org.chorem.pollen.PollenQueryHelper;
import org.chorem.pollen.PollenTechnicalException;
import org.chorem.pollen.bean.UserPoll;
@@ -72,15 +71,19 @@
/** Logger. */
private static final Log log = LogFactory.getLog(PollService.class);
+ public Poll getNewPoll() {
+ Poll result = new PollImpl();
+ return result;
+ }
+
/**
* Build a new Poll instance with given {@code user} as administrator
*
* @param user Build a new Poll instance with given {@code user} as administrator
* @return Build a new Poll instance with given {@code user} as administrator
- * @throws PollenException
*/
public Poll getNewPoll(UserAccount user) {
- Poll result = new PollImpl();
+ Poll result = getNewPoll();
result.setChoiceType(ChoiceType.TEXT);
result.setVoteCounting(VoteCountingType.NORMAL);
result.setType(PollType.FREE);
@@ -105,10 +108,9 @@
*
* @param poll Build a new Poll instance based on existing {@code poll} (copy)
* @return Build a new Poll instance based on existing {@code poll} (copy)
- * @throws PollenException
*/
public Poll getNewPoll(Poll poll) {
- Poll result = new PollImpl();
+ Poll result = getNewPoll();
TopiaEntityBinder<Poll> binder = PollenBinderHelper.getSimpleTopiaBinder(Poll.class);
//TODO-fdesbois-2010-07-13 : add test and check if exluding only those properties is realistic
binder.copyExcluding(poll, result,
@@ -190,7 +192,8 @@
throw new PollAlreadyClosedException();
}
- TopiaEntityBinder<Poll> binder = PollenBinderHelper.getSimpleTopiaBinder(Poll.class);
+ TopiaEntityBinder<Poll> binder =
+ PollenBinderHelper.getSimpleTopiaBinder(Poll.class);
// Idea, if we can use Embeddable object for Hibernate, Options will be a good use case
binder.copy(poll, pollToUpdate,
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserService.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserService.java 2012-01-23 22:31:35 UTC (rev 3110)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserService.java 2012-01-23 23:05:59 UTC (rev 3111)
@@ -23,7 +23,7 @@
*/
package org.chorem.pollen.services;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/VoteService.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/VoteService.java 2012-01-23 22:31:35 UTC (rev 3110)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/VoteService.java 2012-01-23 23:05:59 UTC (rev 3111)
@@ -23,12 +23,11 @@
*/
package org.chorem.pollen.services;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.pollen.PollenBinderHelper;
import org.chorem.pollen.PollenDAOHelper;
-import org.chorem.pollen.PollenException;
import org.chorem.pollen.PollenQueryHelper;
import org.chorem.pollen.PollenTechnicalException;
import org.chorem.pollen.entity.Choice;
@@ -198,7 +197,7 @@
}
}
- public int getNbVotes(Poll poll) throws PollenException {
+ public int getNbVotes(Poll poll) {
try {
PollAccountDAO dao =
PollenDAOHelper.getPollAccountDAO(getTransaction());
Modified: branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/service/legacy/ServicePollImplTest.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/service/legacy/ServicePollImplTest.java 2012-01-23 22:31:35 UTC (rev 3110)
+++ branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/service/legacy/ServicePollImplTest.java 2012-01-23 23:05:59 UTC (rev 3111)
@@ -23,7 +23,7 @@
*/
package org.chorem.pollen.service.legacy;
-import org.apache.commons.lang.time.DateUtils;
+import org.apache.commons.lang3.time.DateUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.pollen.PollenBusinessException;
Modified: branches/pollen-2.0-beta-1/pollen-ui-struts2/pom.xml
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/pom.xml 2012-01-23 22:31:35 UTC (rev 3110)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/pom.xml 2012-01-23 23:05:59 UTC (rev 3111)
@@ -19,11 +19,11 @@
<artifactId>pollen-ui-struts2</artifactId>
<dependencies>
- <dependency>
+ <!--dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pollen-domain</artifactId>
<version>${project.version}</version>
- </dependency>
+ </dependency-->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pollen-persistence</artifactId>
@@ -38,14 +38,30 @@
<dependency>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-validator</artifactId>
+ <scope>runtime</scope>
</dependency>
<dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
+ <groupId>org.nuiton</groupId>
+ <artifactId>nuiton-utils</artifactId>
</dependency>
<dependency>
+ <groupId>org.nuiton.i18n</groupId>
+ <artifactId>nuiton-i18n</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.nuiton.topia</groupId>
+ <artifactId>topia-persistence</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</dependency>
Modified: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/CreatePoll.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/CreatePoll.java 2012-01-23 22:31:35 UTC (rev 3110)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/CreatePoll.java 2012-01-23 23:05:59 UTC (rev 3111)
@@ -24,7 +24,6 @@
package org.chorem.pollen.ui.actions.poll;
import org.chorem.pollen.entity.Poll;
-import org.chorem.pollen.entity.PollImpl;
import org.chorem.pollen.services.PollService;
import org.chorem.pollen.ui.actions.PollenActionSupport;
import org.nuiton.topia.TopiaException;
@@ -47,7 +46,7 @@
public Poll getPoll() {
if (poll == null) {
- poll = new PollImpl();
+ poll = newService(PollService.class).getNewPoll();
}
return poll;
}
Modified: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-01-23 22:31:35 UTC (rev 3110)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-01-23 23:05:59 UTC (rev 3111)
@@ -32,9 +32,9 @@
pollen.fieldset.connexionInformation=Information de connexion
pollen.fieldset.login=Login
pollen.fieldset.userInformation=Informations de l'utilisateur
-pollen.fieldset.userInformation.toUpdate=User informations to update
pollen.fieldset.userInformation.toCreate=User informations to create
pollen.fieldset.userInformation.toDelete=User informations to delete
+pollen.fieldset.userInformation.toUpdate=User informations to update
pollen.information.need.login=You must be logged to access this page. Please fill the form below.
pollen.information.user.created=User %s created.
pollen.information.user.deleted=User %s deleted.
Modified: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-01-23 22:31:35 UTC (rev 3110)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-01-23 23:05:59 UTC (rev 3111)
@@ -32,9 +32,9 @@
pollen.fieldset.connexionInformation=Information de connexion
pollen.fieldset.login=Connexion
pollen.fieldset.userInformation=Informations de l'utilisateur
-pollen.fieldset.userInformation.toUpdate=Informations de l'utilisateur à mettre à jour
pollen.fieldset.userInformation.toCreate=Informations de l'utilisateur à créer
pollen.fieldset.userInformation.toDelete=Informations de l'utilisateur à supprimer
+pollen.fieldset.userInformation.toUpdate=Informations de l'utilisateur à mettre à jour
pollen.information.need.login=Vous devez être identifié pour pouvoir accéder à cette page. Veuillez remplir le formulaire ci-dessous.
pollen.information.user.created=L'utilisateur %s a été créé.
pollen.information.user.deleted=L'utilisateur %s a été supprimé.
Modified: branches/pollen-2.0-beta-1/pom.xml
===================================================================
--- branches/pollen-2.0-beta-1/pom.xml 2012-01-23 22:31:35 UTC (rev 3110)
+++ branches/pollen-2.0-beta-1/pom.xml 2012-01-23 23:05:59 UTC (rev 3111)
@@ -32,6 +32,12 @@
<dependencies>
<dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core</artifactId>
+ <version>3.6.9.Final</version>
+ </dependency>
+
+ <dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>11.0.1</version>
1
0
23 Jan '12
Author: tchemit
Date: 2012-01-23 23:31:35 +0100 (Mon, 23 Jan 2012)
New Revision: 3110
Url: http://chorem.org/repositories/revision/pollen/3110
Log:
- simplify user admin
- creates poll, user packages
- impact fro services api modification
Added:
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/CreatePoll.java
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DisplayCreatedPolls.java
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DisplayParticipatedPolls.java
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DisplayPoll.java
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DisplayPollResult.java
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/Login.java
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/Logout.java
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/RegisterUser.java
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/ShowUser.java
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/UpdateUser.java
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/admin/ManageUsers-createUser-validation.xml
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/admin/ManageUsers-updateUser-validation.xml
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/admin/
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/admin/pollsList.jsp
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/admin/usersList.jsp
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/createPoll.jsp
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/login.jsp
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/registerUser.jsp
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/showUser.jsp
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/updateUser.jsp
Removed:
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/CreatePoll.java
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayCreatedPolls.java
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayParticipatedPolls.java
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayPoll.java
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayPollResult.java
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/Login.java
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/Logout.java
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/RegisterUser.java
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/ShowUser.java
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/UpdateUser.java
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/CreateUser.java
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/DeleteUser.java
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/UpdateUser.java
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/admin/CreateUser-validation.xml
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/admin/UpdateUser-validation.xml
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/createPoll.jsp
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/login.jsp
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/pollsList.jsp
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/registerUser.jsp
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/showUser.jsp
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/updateUser.jsp
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/usersList.jsp
Modified:
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenApplicationListener.java
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/ManageUsers.java
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/config/struts-admin.xml
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/config/struts-poll.xml
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/config/struts-user.xml
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/struts.xml
Modified: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenApplicationListener.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenApplicationListener.java 2012-01-23 22:29:31 UTC (rev 3109)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenApplicationListener.java 2012-01-23 22:31:35 UTC (rev 3110)
@@ -23,14 +23,12 @@
*/
package org.chorem.pollen.ui;
-import org.apache.commons.collections.MapUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.pollen.PollenConfiguration;
import org.chorem.pollen.PollenTechnicalException;
-import org.chorem.pollen.PollenTopiaRootContextSupplierFactory;
+import org.chorem.pollen.PollenTopiaRootContextFactory;
import org.chorem.pollen.entity.Poll;
-import org.chorem.pollen.entity.UserAccount;
import org.chorem.pollen.services.PollenServiceContext;
import org.chorem.pollen.services.PollenServiceContextImpl;
import org.chorem.pollen.services.PollenServiceFactory;
@@ -41,14 +39,12 @@
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.framework.TopiaContextImplementor;
-import org.nuiton.topia.framework.TopiaFilter;
import org.nuiton.topia.framework.TopiaUtil;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import java.util.Date;
import java.util.Locale;
-import java.util.Map;
/**
* To listen start or end of the application.
@@ -92,8 +88,8 @@
if (log.isInfoEnabled()) {
log.info("Initializing RootContextSupplier...");
}
- PollenTopiaRootContextSupplierFactory factory =
- new PollenTopiaRootContextSupplierFactory();
+ PollenTopiaRootContextFactory factory =
+ new PollenTopiaRootContextFactory();
rootContext = factory.newDatabaseFromConfig(configuration);
applicationContext.setRootContext(rootContext);
@@ -154,9 +150,9 @@
UserService service =
serviceFactory.newService(UserService.class, serviceContext);
- Map<String, UserAccount> users = service.getUsers(new TopiaFilter());
+ int nbUsers = service.getNbUsers();
- if (MapUtils.isEmpty(users)) {
+ if (nbUsers == 0) {
// no users in database create the admin user
if (log.isInfoEnabled()) {
Deleted: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/CreatePoll.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/CreatePoll.java 2012-01-23 22:29:31 UTC (rev 3109)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/CreatePoll.java 2012-01-23 22:31:35 UTC (rev 3110)
@@ -1,72 +0,0 @@
-/*
- * #%L
- * Pollen :: UI (strust2)
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2009 - 2012 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%
- */
-package org.chorem.pollen.ui.actions;
-
-import org.chorem.pollen.entity.Poll;
-import org.chorem.pollen.entity.PollImpl;
-import org.chorem.pollen.services.PollService;
-import org.nuiton.topia.TopiaException;
-
-/**
- * Creates a new poll.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.0
- */
-public class CreatePoll extends PollenActionSupport {
-
- private static final long serialVersionUID = 1L;
-
- protected Poll poll;
-
- public String getPageLogo() {
- return "Creation";
- }
-
- public Poll getPoll() {
- if (poll == null) {
- poll = new PollImpl();
- }
- return poll;
- }
-
- @Override
- public String execute() throws Exception {
-
- PollService service = newService(PollService.class);
-
-
- try {
- Poll basicPoll = service.createBasicPoll(poll);
-
- return SUCCESS;
- } catch (TopiaException e) {
-
- }
-
- // back to input
- return INPUT;
-
- }
-}
Deleted: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayCreatedPolls.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayCreatedPolls.java 2012-01-23 22:29:31 UTC (rev 3109)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayCreatedPolls.java 2012-01-23 22:31:35 UTC (rev 3110)
@@ -1,35 +0,0 @@
-/*
- * #%L
- * Pollen :: UI (strust2)
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2009 - 2012 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%
- */
-package org.chorem.pollen.ui.actions;
-
-/**
- * Display list of created polls.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.0
- */
-public class DisplayCreatedPolls extends PollenActionSupport {
-
- private static final long serialVersionUID = 1L;
-}
Deleted: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayParticipatedPolls.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayParticipatedPolls.java 2012-01-23 22:29:31 UTC (rev 3109)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayParticipatedPolls.java 2012-01-23 22:31:35 UTC (rev 3110)
@@ -1,35 +0,0 @@
-/*
- * #%L
- * Pollen :: UI (strust2)
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2009 - 2012 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%
- */
-package org.chorem.pollen.ui.actions;
-
-/**
- * Display list of participated polls.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.0
- */
-public class DisplayParticipatedPolls extends PollenActionSupport {
-
- private static final long serialVersionUID = 1L;
-}
Deleted: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayPoll.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayPoll.java 2012-01-23 22:29:31 UTC (rev 3109)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayPoll.java 2012-01-23 22:31:35 UTC (rev 3110)
@@ -1,35 +0,0 @@
-/*
- * #%L
- * Pollen :: UI (strust2)
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2009 - 2012 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%
- */
-package org.chorem.pollen.ui.actions;
-
-/**
- * Display a poll.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.0
- */
-public class DisplayPoll extends PollenActionSupport {
-
- private static final long serialVersionUID = 1L;
-}
Deleted: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayPollResult.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayPollResult.java 2012-01-23 22:29:31 UTC (rev 3109)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayPollResult.java 2012-01-23 22:31:35 UTC (rev 3110)
@@ -1,35 +0,0 @@
-/*
- * #%L
- * Pollen :: UI (strust2)
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2009 - 2012 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%
- */
-package org.chorem.pollen.ui.actions;
-
-/**
- * Display results of a poll.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.0
- */
-public class DisplayPollResult extends PollenActionSupport {
-
- private static final long serialVersionUID = 1L;
-}
Deleted: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/Login.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/Login.java 2012-01-23 22:29:31 UTC (rev 3109)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/Login.java 2012-01-23 22:31:35 UTC (rev 3110)
@@ -1,82 +0,0 @@
-/*
- * #%L
- * Pollen :: UI (strust2)
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2009 - 2012 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%
- */
-package org.chorem.pollen.ui.actions;
-
-import com.opensymphony.xwork2.interceptor.annotations.InputConfig;
-import org.chorem.pollen.entity.UserAccount;
-import org.chorem.pollen.services.UserInvalidPasswordException;
-import org.chorem.pollen.services.UserNotFoundException;
-import org.chorem.pollen.services.UserService;
-
-/**
- * Login user to pollen.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.0
- */
-public class Login extends PollenActionSupport {
-
- private static final long serialVersionUID = 1L;
-
- protected String login;
-
- protected String password;
-
- public String getLogin() {
- return login;
- }
-
- public void setLogin(String login) {
- this.login = login;
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
- @InputConfig(resultName = "error")
- @Override
- public String execute() throws Exception {
-
- UserService service = newService(UserService.class);
-
- try {
- UserAccount userAccount = service.connect(login, password);
- getPollenSession().setUserAccount(userAccount);
- addActionMessage(_("pollen.information.your.are.loggued"));
- return SUCCESS;
- } catch (UserNotFoundException e) {
- addActionError(_("pollen.error.user.bad.login.or.password"));
- } catch (UserInvalidPasswordException e) {
- addActionError(_("pollen.error.user.bad.login.or.password"));
- }
-
- // if error go back to input
- return ERROR;
- }
-}
Deleted: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/Logout.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/Logout.java 2012-01-23 22:29:31 UTC (rev 3109)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/Logout.java 2012-01-23 22:31:35 UTC (rev 3110)
@@ -1,43 +0,0 @@
-/*
- * #%L
- * Pollen :: UI (strust2)
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2009 - 2012 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%
- */
-package org.chorem.pollen.ui.actions;
-
-/**
- * Logout from pollen.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.0
- */
-public class Logout extends PollenActionSupport {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public String execute() throws Exception {
-
- getPollenSession().setUserAccount(null);
-
- return SUCCESS;
- }
-}
Deleted: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/RegisterUser.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/RegisterUser.java 2012-01-23 22:29:31 UTC (rev 3109)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/RegisterUser.java 2012-01-23 22:31:35 UTC (rev 3110)
@@ -1,91 +0,0 @@
-/*
- * #%L
- * Pollen :: UI (strust2)
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2009 - 2012 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%
- */
-package org.chorem.pollen.ui.actions;
-
-import org.chorem.pollen.entity.UserAccount;
-import org.chorem.pollen.entity.UserAccountImpl;
-import org.chorem.pollen.services.UserEmailAlreadyUsedException;
-import org.chorem.pollen.services.UserLoginAlreadyUsedException;
-import org.chorem.pollen.services.UserService;
-
-/**
- * Register a new user.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.0
- */
-public class RegisterUser extends PollenActionSupport {
-
- private static final long serialVersionUID = 1L;
-
- protected UserAccount user;
-
- protected String password2;
-
- public UserAccount getUser() {
- if (user == null) {
- user = new UserAccountImpl();
- }
- return user;
- }
-
- public String getPassword2() {
- return password2;
- }
-
- public void setPassword2(String password2) {
- this.password2 = password2;
- }
-
- public String getPageLogo() {
- return "Creation";
- }
-
- @Override
- public String execute() throws Exception {
-
- UserService service = newService(UserService.class);
-
- try {
- UserAccount createdUser = service.createUser(user, false, getApplicationUrl());
- getTransaction().commitTransaction();
-
- getPollenSession().setUserAccount(createdUser);
- addActionMessage(_("pollen.information.your.are.loggued"));
- return SUCCESS;
- } catch (UserLoginAlreadyUsedException e) {
- addFieldError("user.login", _("pollen.error.user.login.already.used"));
- } catch (UserEmailAlreadyUsedException e) {
- addFieldError("user.email", _("pollen.error.user.email.already.used"));
- }
-
- // if error go back to input
-
- // reset password
- user.setPassword(null);
- password2 = null;
-
- return INPUT;
- }
-}
Deleted: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/ShowUser.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/ShowUser.java 2012-01-23 22:29:31 UTC (rev 3109)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/ShowUser.java 2012-01-23 22:31:35 UTC (rev 3110)
@@ -1,46 +0,0 @@
-/*
- * #%L
- * Pollen :: UI (strust2)
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2009 - 2012 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%
- */
-package org.chorem.pollen.ui.actions;
-
-import org.chorem.pollen.entity.UserAccount;
-
-/**
- * Show user account.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.0
- */
-public class ShowUser extends PollenActionSupport {
-
- private static final long serialVersionUID = 1L;
-
- public String getPageLogo() {
- return "Creation";
- }
-
- public UserAccount getUser() {
- return getPollenSession().getUserAccount();
- }
-
-}
Deleted: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/UpdateUser.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/UpdateUser.java 2012-01-23 22:29:31 UTC (rev 3109)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/UpdateUser.java 2012-01-23 22:31:35 UTC (rev 3110)
@@ -1,113 +0,0 @@
-/*
- * #%L
- * Pollen :: UI (strust2)
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2009 - 2012 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%
- */
-package org.chorem.pollen.ui.actions;
-
-import org.chorem.pollen.entity.UserAccount;
-import org.chorem.pollen.entity.UserAccountImpl;
-import org.chorem.pollen.services.UserEmailAlreadyUsedException;
-import org.chorem.pollen.services.UserInvalidPasswordException;
-import org.chorem.pollen.services.UserService;
-
-/**
- * Update a user.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.0
- */
-public class UpdateUser extends PollenActionSupport {
-
- private static final long serialVersionUID = 1L;
-
- protected UserAccount user;
-
- protected String newPassword;
-
- protected String newPassword2;
-
- public String getPageLogo() {
- return "Creation";
- }
-
- public UserAccount getUser() {
- if (user == null) {
- user = new UserAccountImpl();
- }
- return user;
- }
-
- public String getNewPassword() {
- return newPassword;
- }
-
- public void setNewPassword(String newPassword) {
- this.newPassword = newPassword;
- }
-
- public String getNewPassword2() {
- return newPassword2;
- }
-
- public void setNewPassword2(String newPassword2) {
- this.newPassword2 = newPassword2;
- }
-
- public String input() throws Exception {
- UserAccount userAccount = getPollenSession().getUserAccount();
- UserService userService = newService(UserService.class);
- user = userService.getEntityById(UserAccount.class, userAccount.getTopiaId());
- return INPUT;
- }
-
- @Override
- public String execute() throws Exception {
-
- // let's push back admin property to user to save
- user.setAdmin(getPollenSession().getUserAccount().isAdmin());
-
- UserService service = newService(UserService.class);
-
- try {
- UserAccount updatedUser =
- service.updateUser(user, newPassword, false);
- getTransaction().commitTransaction();
-
- // push back user to session
- getPollenSession().setUserAccount(updatedUser);
- return SUCCESS;
- } catch (UserEmailAlreadyUsedException e) {
- addFieldError("user.email", _("pollen.error.user.email.already.used"));
- } catch (UserInvalidPasswordException e) {
- addFieldError("user.password", _("pollen.error.user.invalid.password"));
- }
-
- // if error go back to input
-
- // reset password
- user.setPassword(null);
- newPassword = newPassword2 = null;
-
- return INPUT;
- }
-
-}
Deleted: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/CreateUser.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/CreateUser.java 2012-01-23 22:29:31 UTC (rev 3109)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/CreateUser.java 2012-01-23 22:31:35 UTC (rev 3110)
@@ -1,57 +0,0 @@
-package org.chorem.pollen.ui.actions.admin;
-
-import com.google.common.base.Preconditions;
-import org.chorem.pollen.entity.UserAccount;
-import org.chorem.pollen.entity.UserAccountImpl;
-import org.chorem.pollen.services.UserEmailAlreadyUsedException;
-import org.chorem.pollen.services.UserLoginAlreadyUsedException;
-import org.chorem.pollen.services.UserService;
-import org.chorem.pollen.ui.actions.PollenActionSupport;
-
-/**
- * Create a user informations from users admin screen.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.0
- */
-public class CreateUser extends PollenActionSupport {
-
- private static final long serialVersionUID = 1L;
-
- protected UserAccount createUser;
-
- public UserAccount getCreateUser() {
- if (createUser == null) {
- createUser = new UserAccountImpl();
- }
- return createUser;
- }
-
- public boolean isCreateUserNotNull() {
- return createUser !=null;
- }
-
- @Override
- public String execute() throws Exception {
-
- Preconditions.checkNotNull(createUser);
-
- UserService service = newService(UserService.class);
-
- try {
- service.createUser(createUser, true, getApplicationUrl());
- getTransaction().commitTransaction();
- addActionMessage(
- _("pollen.information.user.created", createUser.getDisplayName()));
- // remove this user, otherwise it will be reused in the user lists
- createUser = null;
- return SUCCESS;
- } catch (UserLoginAlreadyUsedException e) {
- addFieldError("createUser.login", _("pollen.error.user.login.already.used"));
- } catch (UserEmailAlreadyUsedException e) {
- addFieldError("createUser.email", _("pollen.error.user.email.already.used"));
- }
-
- return INPUT;
- }
-}
Deleted: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/DeleteUser.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/DeleteUser.java 2012-01-23 22:29:31 UTC (rev 3109)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/DeleteUser.java 2012-01-23 22:31:35 UTC (rev 3110)
@@ -1,49 +0,0 @@
-package org.chorem.pollen.ui.actions.admin;
-
-import com.google.common.base.Preconditions;
-import org.chorem.pollen.entity.UserAccount;
-import org.chorem.pollen.entity.UserAccountImpl;
-import org.chorem.pollen.services.UserService;
-import org.chorem.pollen.ui.actions.PollenActionSupport;
-
-/**
- * Delete a user.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.0
- */
-public class DeleteUser extends PollenActionSupport {
-
- private static final long serialVersionUID = 1L;
-
- protected UserAccount deleteUser;
-
- public UserAccount getDeleteUser() {
- if (deleteUser == null) {
- deleteUser = new UserAccountImpl();
- }
- return deleteUser;
- }
-
- public boolean isDeleteUserNotNull() {
- return deleteUser !=null;
- }
-
- @Override
- public String execute() throws Exception {
-
- Preconditions.checkNotNull(deleteUser);
-
- UserService service = newService(UserService.class);
-
- service.deleteUser(deleteUser.getLogin());
- getTransaction().commitTransaction();
-
- addActionMessage(
- _("pollen.information.user.deleted", deleteUser.getDisplayName()));
-
- // remove this user, otherwise it will be reused in the user lists
- deleteUser = null;
- return SUCCESS;
- }
-}
Modified: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/ManageUsers.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/ManageUsers.java 2012-01-23 22:29:31 UTC (rev 3109)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/ManageUsers.java 2012-01-23 22:31:35 UTC (rev 3110)
@@ -23,14 +23,108 @@
*/
package org.chorem.pollen.ui.actions.admin;
+import com.google.common.base.Preconditions;
+import org.chorem.pollen.entity.UserAccount;
+import org.chorem.pollen.services.exceptions.UserEmailAlreadyUsedException;
+import org.chorem.pollen.services.exceptions.UserInvalidPasswordException;
+import org.chorem.pollen.services.exceptions.UserLoginAlreadyUsedException;
+import org.chorem.pollen.services.UserService;
import org.chorem.pollen.ui.actions.PollenActionSupport;
/**
- *
* @author tchemit <chemit(a)codelutin.com>
* @since 2.0
*/
public class ManageUsers extends PollenActionSupport {
private static final long serialVersionUID = 1L;
+
+ protected String action;
+
+ protected UserAccount user;
+
+ public UserAccount getUser() {
+ if (user == null) {
+ UserService service = newService(UserService.class);
+ user = service.getNewUser();
+ }
+ return user;
+ }
+
+ public String getAction() {
+ return action;
+ }
+
+ public void setAction(String action) {
+ this.action = action;
+ }
+
+ public String createUser() throws Exception {
+
+ Preconditions.checkNotNull(user);
+
+ UserService service = newService(UserService.class);
+
+ try {
+ service.createUser(user, true, getApplicationUrl());
+ getTransaction().commitTransaction();
+ addActionMessage(
+ _("pollen.information.user.created", user.getDisplayName()));
+ // remove this user, otherwise it will be reused in the user lists
+ user = null;
+ action = null;
+ return SUCCESS;
+ } catch (UserLoginAlreadyUsedException e) {
+ addFieldError("user.login", _("pollen.error.user.login.already.used"));
+ } catch (UserEmailAlreadyUsedException e) {
+ addFieldError("user.email", _("pollen.error.user.email.already.used"));
+ }
+
+ return INPUT;
+ }
+
+ public String updateUser() throws Exception {
+
+ Preconditions.checkNotNull(user);
+
+ UserService service = newService(UserService.class);
+
+ try {
+ service.updateUser(user, null, true);
+ getTransaction().commitTransaction();
+ addActionMessage(
+ _("pollen.information.user.updated", user.getDisplayName()));
+
+ // remove this user, otherwise it will be reused in the user lists
+ user = null;
+ action = null;
+ return SUCCESS;
+ } catch (UserEmailAlreadyUsedException e) {
+ addFieldError("user.email", _("pollen.error.user.email.already.used"));
+ } catch (UserInvalidPasswordException e) {
+ addFieldError("user.password", _("pollen.error.user.invalid.password"));
+ }
+
+ return INPUT;
+ }
+
+ public String deleteUser() throws Exception {
+
+ Preconditions.checkNotNull(user);
+
+ UserService service = newService(UserService.class);
+
+ service.deleteUser(user.getLogin());
+ getTransaction().commitTransaction();
+
+ addActionMessage(
+ _("pollen.information.user.deleted", user.getDisplayName()));
+
+ // remove this user, otherwise it will be reused in the user lists
+ user = null;
+ action = null;
+ return SUCCESS;
+ }
+
+
}
Deleted: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/UpdateUser.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/UpdateUser.java 2012-01-23 22:29:31 UTC (rev 3109)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/UpdateUser.java 2012-01-23 22:31:35 UTC (rev 3110)
@@ -1,58 +0,0 @@
-package org.chorem.pollen.ui.actions.admin;
-
-import com.google.common.base.Preconditions;
-import org.chorem.pollen.entity.UserAccount;
-import org.chorem.pollen.entity.UserAccountImpl;
-import org.chorem.pollen.services.UserEmailAlreadyUsedException;
-import org.chorem.pollen.services.UserInvalidPasswordException;
-import org.chorem.pollen.services.UserService;
-import org.chorem.pollen.ui.actions.PollenActionSupport;
-
-/**
- * Update a user informations from users admin screen.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.0
- */
-public class UpdateUser extends PollenActionSupport {
-
- private static final long serialVersionUID = 7738596310901970593L;
-
- protected UserAccount updateUser;
-
- public UserAccount getUpdateUser() {
- if (updateUser == null) {
- updateUser = new UserAccountImpl();
- }
- return updateUser;
- }
-
- public boolean isUpdateUserNotNull() {
- return updateUser !=null;
- }
-
- @Override
- public String execute() throws Exception {
-
- Preconditions.checkNotNull(updateUser);
-
- UserService service = newService(UserService.class);
-
- try {
- service.updateUser(updateUser, null, true);
- getTransaction().commitTransaction();
- addActionMessage(
- _("pollen.information.user.updated", updateUser.getDisplayName()));
-
- // remove this user, otherwise it will be reused in the user lists
- updateUser = null;
- return SUCCESS;
- } catch (UserEmailAlreadyUsedException e) {
- addFieldError("updateUser.email", _("pollen.error.user.email.already.used"));
- } catch (UserInvalidPasswordException e) {
- addFieldError("updateUser.password", _("pollen.error.user.invalid.password"));
- }
-
- return INPUT;
- }
-}
Copied: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/CreatePoll.java (from rev 3105, branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/CreatePoll.java)
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/CreatePoll.java (rev 0)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/CreatePoll.java 2012-01-23 22:31:35 UTC (rev 3110)
@@ -0,0 +1,72 @@
+/*
+ * #%L
+ * Pollen :: UI (strust2)
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2012 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%
+ */
+package org.chorem.pollen.ui.actions.poll;
+
+import org.chorem.pollen.entity.Poll;
+import org.chorem.pollen.entity.PollImpl;
+import org.chorem.pollen.services.PollService;
+import org.chorem.pollen.ui.actions.PollenActionSupport;
+import org.nuiton.topia.TopiaException;
+
+/**
+ * Creates a new poll.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.0
+ */
+public class CreatePoll extends PollenActionSupport {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Poll poll;
+
+ public String getPageLogo() {
+ return "Creation";
+ }
+
+ public Poll getPoll() {
+ if (poll == null) {
+ poll = new PollImpl();
+ }
+ return poll;
+ }
+
+ @Override
+ public String execute() throws Exception {
+
+ PollService service = newService(PollService.class);
+
+ try {
+ Poll basicPoll = service.createBasicPoll(poll);
+
+ return SUCCESS;
+ } catch (TopiaException e) {
+
+ }
+
+ // back to input
+ return INPUT;
+
+ }
+}
Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/CreatePoll.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DisplayCreatedPolls.java (from rev 3105, branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayCreatedPolls.java)
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DisplayCreatedPolls.java (rev 0)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DisplayCreatedPolls.java 2012-01-23 22:31:35 UTC (rev 3110)
@@ -0,0 +1,37 @@
+/*
+ * #%L
+ * Pollen :: UI (strust2)
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2012 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%
+ */
+package org.chorem.pollen.ui.actions.poll;
+
+import org.chorem.pollen.ui.actions.PollenActionSupport;
+
+/**
+ * Display list of created polls.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.0
+ */
+public class DisplayCreatedPolls extends PollenActionSupport {
+
+ private static final long serialVersionUID = 1L;
+}
Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DisplayCreatedPolls.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DisplayParticipatedPolls.java (from rev 3105, branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayParticipatedPolls.java)
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DisplayParticipatedPolls.java (rev 0)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DisplayParticipatedPolls.java 2012-01-23 22:31:35 UTC (rev 3110)
@@ -0,0 +1,37 @@
+/*
+ * #%L
+ * Pollen :: UI (strust2)
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2012 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%
+ */
+package org.chorem.pollen.ui.actions.poll;
+
+import org.chorem.pollen.ui.actions.PollenActionSupport;
+
+/**
+ * Display list of participated polls.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.0
+ */
+public class DisplayParticipatedPolls extends PollenActionSupport {
+
+ private static final long serialVersionUID = 1L;
+}
Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DisplayParticipatedPolls.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DisplayPoll.java (from rev 3105, branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayPoll.java)
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DisplayPoll.java (rev 0)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DisplayPoll.java 2012-01-23 22:31:35 UTC (rev 3110)
@@ -0,0 +1,37 @@
+/*
+ * #%L
+ * Pollen :: UI (strust2)
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2012 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%
+ */
+package org.chorem.pollen.ui.actions.poll;
+
+import org.chorem.pollen.ui.actions.PollenActionSupport;
+
+/**
+ * Display a poll.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.0
+ */
+public class DisplayPoll extends PollenActionSupport {
+
+ private static final long serialVersionUID = 1L;
+}
Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DisplayPoll.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DisplayPollResult.java (from rev 3105, branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayPollResult.java)
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DisplayPollResult.java (rev 0)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DisplayPollResult.java 2012-01-23 22:31:35 UTC (rev 3110)
@@ -0,0 +1,37 @@
+/*
+ * #%L
+ * Pollen :: UI (strust2)
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2012 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%
+ */
+package org.chorem.pollen.ui.actions.poll;
+
+import org.chorem.pollen.ui.actions.PollenActionSupport;
+
+/**
+ * Display results of a poll.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.0
+ */
+public class DisplayPollResult extends PollenActionSupport {
+
+ private static final long serialVersionUID = 1L;
+}
Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DisplayPollResult.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/Login.java (from rev 3105, branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/Login.java)
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/Login.java (rev 0)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/Login.java 2012-01-23 22:31:35 UTC (rev 3110)
@@ -0,0 +1,83 @@
+/*
+ * #%L
+ * Pollen :: UI (strust2)
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2012 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%
+ */
+package org.chorem.pollen.ui.actions.user;
+
+import com.opensymphony.xwork2.interceptor.annotations.InputConfig;
+import org.chorem.pollen.entity.UserAccount;
+import org.chorem.pollen.services.exceptions.UserInvalidPasswordException;
+import org.chorem.pollen.services.exceptions.UserNotFoundException;
+import org.chorem.pollen.services.UserService;
+import org.chorem.pollen.ui.actions.PollenActionSupport;
+
+/**
+ * Login user to pollen.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.0
+ */
+public class Login extends PollenActionSupport {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String login;
+
+ protected String password;
+
+ public String getLogin() {
+ return login;
+ }
+
+ public void setLogin(String login) {
+ this.login = login;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ @InputConfig(resultName = "error")
+ @Override
+ public String execute() throws Exception {
+
+ UserService service = newService(UserService.class);
+
+ try {
+ UserAccount userAccount = service.connect(login, password);
+ getPollenSession().setUserAccount(userAccount);
+ addActionMessage(_("pollen.information.your.are.loggued"));
+ return SUCCESS;
+ } catch (UserNotFoundException e) {
+ addActionError(_("pollen.error.user.bad.login.or.password"));
+ } catch (UserInvalidPasswordException e) {
+ addActionError(_("pollen.error.user.bad.login.or.password"));
+ }
+
+ // if error go back to input
+ return ERROR;
+ }
+}
Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/Login.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/Logout.java (from rev 3105, branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/Logout.java)
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/Logout.java (rev 0)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/Logout.java 2012-01-23 22:31:35 UTC (rev 3110)
@@ -0,0 +1,45 @@
+/*
+ * #%L
+ * Pollen :: UI (strust2)
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2012 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%
+ */
+package org.chorem.pollen.ui.actions.user;
+
+import org.chorem.pollen.ui.actions.PollenActionSupport;
+
+/**
+ * Logout from pollen.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.0
+ */
+public class Logout extends PollenActionSupport {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String execute() throws Exception {
+
+ getPollenSession().setUserAccount(null);
+
+ return SUCCESS;
+ }
+}
Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/Logout.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/RegisterUser.java (from rev 3106, branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/RegisterUser.java)
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/RegisterUser.java (rev 0)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/RegisterUser.java 2012-01-23 22:31:35 UTC (rev 3110)
@@ -0,0 +1,92 @@
+/*
+ * #%L
+ * Pollen :: UI (strust2)
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2012 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%
+ */
+package org.chorem.pollen.ui.actions.user;
+
+import org.chorem.pollen.entity.UserAccount;
+import org.chorem.pollen.services.exceptions.UserEmailAlreadyUsedException;
+import org.chorem.pollen.services.exceptions.UserLoginAlreadyUsedException;
+import org.chorem.pollen.services.UserService;
+import org.chorem.pollen.ui.actions.PollenActionSupport;
+
+/**
+ * Register a new user.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.0
+ */
+public class RegisterUser extends PollenActionSupport {
+
+ private static final long serialVersionUID = 1L;
+
+ protected UserAccount user;
+
+ protected String password2;
+
+ public UserAccount getUser() {
+ if (user == null) {
+ UserService service = newService(UserService.class);
+ user = service.getNewUser();
+ }
+ return user;
+ }
+
+ public String getPassword2() {
+ return password2;
+ }
+
+ public void setPassword2(String password2) {
+ this.password2 = password2;
+ }
+
+ public String getPageLogo() {
+ return "Creation";
+ }
+
+ @Override
+ public String execute() throws Exception {
+
+ UserService service = newService(UserService.class);
+
+ try {
+ UserAccount createdUser = service.createUser(user, false, getApplicationUrl());
+ getTransaction().commitTransaction();
+
+ getPollenSession().setUserAccount(createdUser);
+ addActionMessage(_("pollen.information.your.are.loggued"));
+ return SUCCESS;
+ } catch (UserLoginAlreadyUsedException e) {
+ addFieldError("user.login", _("pollen.error.user.login.already.used"));
+ } catch (UserEmailAlreadyUsedException e) {
+ addFieldError("user.email", _("pollen.error.user.email.already.used"));
+ }
+
+ // if error go back to input
+
+ // reset password
+ user.setPassword(null);
+ password2 = null;
+
+ return INPUT;
+ }
+}
Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/RegisterUser.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/ShowUser.java (from rev 3105, branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/ShowUser.java)
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/ShowUser.java (rev 0)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/ShowUser.java 2012-01-23 22:31:35 UTC (rev 3110)
@@ -0,0 +1,47 @@
+/*
+ * #%L
+ * Pollen :: UI (strust2)
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2012 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%
+ */
+package org.chorem.pollen.ui.actions.user;
+
+import org.chorem.pollen.entity.UserAccount;
+import org.chorem.pollen.ui.actions.PollenActionSupport;
+
+/**
+ * Show user account.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.0
+ */
+public class ShowUser extends PollenActionSupport {
+
+ private static final long serialVersionUID = 1L;
+
+ public String getPageLogo() {
+ return "Creation";
+ }
+
+ public UserAccount getUser() {
+ return getPollenSession().getUserAccount();
+ }
+
+}
Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/ShowUser.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/UpdateUser.java (from rev 3105, branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/UpdateUser.java)
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/UpdateUser.java (rev 0)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/UpdateUser.java 2012-01-23 22:31:35 UTC (rev 3110)
@@ -0,0 +1,114 @@
+/*
+ * #%L
+ * Pollen :: UI (strust2)
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2012 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%
+ */
+package org.chorem.pollen.ui.actions.user;
+
+import org.chorem.pollen.entity.UserAccount;
+import org.chorem.pollen.services.exceptions.UserEmailAlreadyUsedException;
+import org.chorem.pollen.services.exceptions.UserInvalidPasswordException;
+import org.chorem.pollen.services.UserService;
+import org.chorem.pollen.ui.actions.PollenActionSupport;
+
+/**
+ * Update a user.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.0
+ */
+public class UpdateUser extends PollenActionSupport {
+
+ private static final long serialVersionUID = 1L;
+
+ protected UserAccount user;
+
+ protected String newPassword;
+
+ protected String newPassword2;
+
+ public String getPageLogo() {
+ return "Creation";
+ }
+
+ public UserAccount getUser() {
+ if (user == null) {
+ UserService service = newService(UserService.class);
+ user = service.getNewUser();
+ }
+ return user;
+ }
+
+ public String getNewPassword() {
+ return newPassword;
+ }
+
+ public void setNewPassword(String newPassword) {
+ this.newPassword = newPassword;
+ }
+
+ public String getNewPassword2() {
+ return newPassword2;
+ }
+
+ public void setNewPassword2(String newPassword2) {
+ this.newPassword2 = newPassword2;
+ }
+
+ public String input() throws Exception {
+ UserAccount userAccount = getPollenSession().getUserAccount();
+ UserService userService = newService(UserService.class);
+ user = userService.getEntityById(UserAccount.class, userAccount.getTopiaId());
+ return INPUT;
+ }
+
+ @Override
+ public String execute() throws Exception {
+
+ // let's push back admin property to user to save
+ user.setAdmin(getPollenSession().getUserAccount().isAdmin());
+
+ UserService service = newService(UserService.class);
+
+ try {
+ UserAccount updatedUser =
+ service.updateUser(user, newPassword, false);
+ getTransaction().commitTransaction();
+
+ // push back user to session
+ getPollenSession().setUserAccount(updatedUser);
+ return SUCCESS;
+ } catch (UserEmailAlreadyUsedException e) {
+ addFieldError("user.email", _("pollen.error.user.email.already.used"));
+ } catch (UserInvalidPasswordException e) {
+ addFieldError("user.password", _("pollen.error.user.invalid.password"));
+ }
+
+ // if error go back to input
+
+ // reset password
+ user.setPassword(null);
+ newPassword = newPassword2 = null;
+
+ return INPUT;
+ }
+
+}
Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/UpdateUser.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/config/struts-admin.xml
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/config/struts-admin.xml 2012-01-23 22:29:31 UTC (rev 3109)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/config/struts-admin.xml 2012-01-23 22:31:35 UTC (rev 3110)
@@ -37,39 +37,39 @@
<!-- manage users -->
<action name="usersList" method="input"
class="org.chorem.pollen.ui.actions.admin.ManageUsers">
- <interceptor-ref name="pollenBasicAdminStack"/>
- <result name="input">/WEB-INF/jsp/usersList.jsp</result>
+ <!--<interceptor-ref name="pollenBasicAdminStack"/>-->
+ <result name="input">/WEB-INF/jsp/admin/usersList.jsp</result>
</action>
<!-- create user -->
- <action name="createUser"
- class="org.chorem.pollen.ui.actions.admin.CreateUser">
+ <action name="createUser" method="createUser"
+ class="org.chorem.pollen.ui.actions.admin.ManageUsers">
<interceptor-ref name="pollenParamsPrepareParamsAdminStack"/>
- <result name="input">/WEB-INF/jsp/usersList.jsp</result>
- <result>/WEB-INF/jsp/usersList.jsp</result>
+ <result name="input">/WEB-INF/jsp/admin/usersList.jsp</result>
+ <result>/WEB-INF/jsp/admin/usersList.jsp</result>
</action>
<!-- save user -->
- <action name="updateUser"
- class="org.chorem.pollen.ui.actions.admin.UpdateUser">
+ <action name="updateUser" method="updateUser"
+ class="org.chorem.pollen.ui.actions.admin.ManageUsers">
<interceptor-ref name="pollenParamsPrepareParamsAdminStack"/>
- <result name="input">/WEB-INF/jsp/usersList.jsp</result>
- <result>/WEB-INF/jsp/usersList.jsp</result>
+ <result name="input">/WEB-INF/jsp/admin/usersList.jsp</result>
+ <result>/WEB-INF/jsp/admin/usersList.jsp</result>
</action>
<!-- delete user -->
- <action name="deleteUser"
- class="org.chorem.pollen.ui.actions.admin.DeleteUser">
+ <action name="deleteUser" method="deleteUser"
+ class="org.chorem.pollen.ui.actions.admin.ManageUsers">
<interceptor-ref name="pollenParamsPrepareParamsAdminStack"/>
- <result name="input">/WEB-INF/jsp/usersList.jsp</result>
- <result>/WEB-INF/jsp/usersList.jsp</result>
+ <result name="input">/WEB-INF/jsp/admin/usersList.jsp</result>
+ <result>/WEB-INF/jsp/admin/usersList.jsp</result>
</action>
<!-- manage polls -->
<action name="pollsList" method="input"
class="org.chorem.pollen.ui.actions.admin.ManagePolls">
- <interceptor-ref name="pollenBasicAdminStack"/>
- <result name="input">/WEB-INF/jsp/pollsList.jsp</result>
+ <!--<interceptor-ref name="pollenBasicAdminStack"/>-->
+ <result name="input">/WEB-INF/jsp/admin/pollsList.jsp</result>
</action>
</package>
Modified: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/config/struts-poll.xml
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/config/struts-poll.xml 2012-01-23 22:29:31 UTC (rev 3109)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/config/struts-poll.xml 2012-01-23 22:31:35 UTC (rev 3110)
@@ -35,35 +35,35 @@
<!-- create poll -->
<action name="createPoll"
- class="org.chorem.pollen.ui.actions.CreatePoll">
- <result name="input">/WEB-INF/jsp/createPoll.jsp</result>
+ class="org.chorem.pollen.ui.actions.poll.CreatePoll">
+ <result name="input">/WEB-INF/jsp/poll/createPoll.jsp</result>
<result>/WEB-INF/jsp/home.jsp</result>
</action>
<!-- display poll -->
<action name="displayPoll"
- class="org.chorem.pollen.ui.actions.DisplayPoll">
+ class="org.chorem.pollen.ui.actions.poll.DisplayPoll">
<result name="input">/WEB-INF/jsp/poll.jsp</result>
<result>/WEB-INF/jsp/home.jsp</result>
</action>
<!-- display poll result -->
<action name="displayPollResult"
- class="org.chorem.pollen.ui.actions.DisplayPollResult">
+ class="org.chorem.pollen.ui.actions.poll.DisplayPollResult">
<result name="input">/WEB-INF/jsp/pollResult.jsp</result>
<result>/WEB-INF/jsp/home.jsp</result>
</action>
<!-- display createds polls -->
<action name="displayCreatedPolls"
- class="org.chorem.pollen.ui.actions.DisplayCreatedPolls">
+ class="org.chorem.pollen.ui.actions.poll.DisplayCreatedPolls">
<result name="input">/WEB-INF/jsp/createdPolls.jsp</result>
<result>/WEB-INF/jsp/home.jsp</result>
</action>
<!-- display participated polls -->
<action name="displayParticipatedPolls"
- class="org.chorem.pollen.ui.actions.DisplayParticipatedPolls">
+ class="org.chorem.pollen.ui.actions.poll.DisplayParticipatedPolls">
<result name="input">/WEB-INF/jsp/participatedPolls.jsp</result>
<result>/WEB-INF/jsp/home.jsp</result>
</action>
Modified: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/config/struts-user.xml
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/config/struts-user.xml 2012-01-23 22:29:31 UTC (rev 3109)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/config/struts-user.xml 2012-01-23 22:31:35 UTC (rev 3110)
@@ -33,28 +33,28 @@
<package name="user" extends="default" namespace="/user">
<!-- login -->
- <action name="login" class="org.chorem.pollen.ui.actions.Login">
+ <action name="login" class="org.chorem.pollen.ui.actions.user.Login">
<result name="error">/WEB-INF/jsp/home.jsp</result>
<result type="redirectToHome"/>
</action>
<!-- register user -->
<action name="registerUser"
- class="org.chorem.pollen.ui.actions.RegisterUser">
- <result name="input">/WEB-INF/jsp/registerUser.jsp</result>
+ class="org.chorem.pollen.ui.actions.user.RegisterUser">
+ <result name="input">/WEB-INF/jsp/user/registerUser.jsp</result>
<result type="redirectToHome"/>
</action>
<!-- show user account -->
<action name="showUser"
- class="org.chorem.pollen.ui.actions.ShowUser">
- <result>/WEB-INF/jsp/showUser.jsp</result>
+ class="org.chorem.pollen.ui.actions.user.ShowUser">
+ <result>/WEB-INF/jsp/user/showUser.jsp</result>
</action>
<!-- modify user account -->
<action name="updateUser"
- class="org.chorem.pollen.ui.actions.UpdateUser">
- <result name="input">/WEB-INF/jsp/updateUser.jsp</result>
+ class="org.chorem.pollen.ui.actions.user.UpdateUser">
+ <result name="input">/WEB-INF/jsp/user/updateUser.jsp</result>
<result type="redirectAction">
<param name="actionName">showUser</param>
<param name="namespace">/user</param>
@@ -62,7 +62,7 @@
</action>
<!-- logout -->
- <action name="logout" class="org.chorem.pollen.ui.actions.Logout">
+ <action name="logout" class="org.chorem.pollen.ui.actions.user.Logout">
<result type="redirectToHome"/>
</action>
Modified: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-01-23 22:29:31 UTC (rev 3109)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-01-23 22:31:35 UTC (rev 3110)
@@ -32,6 +32,7 @@
pollen.fieldset.connexionInformation=Information de connexion
pollen.fieldset.login=Login
pollen.fieldset.userInformation=Informations de l'utilisateur
+pollen.fieldset.userInformation.toUpdate=User informations to update
pollen.fieldset.userInformation.toCreate=User informations to create
pollen.fieldset.userInformation.toDelete=User informations to delete
pollen.information.need.login=You must be logged to access this page. Please fill the form below.
Modified: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-01-23 22:29:31 UTC (rev 3109)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-01-23 22:31:35 UTC (rev 3110)
@@ -32,6 +32,7 @@
pollen.fieldset.connexionInformation=Information de connexion
pollen.fieldset.login=Connexion
pollen.fieldset.userInformation=Informations de l'utilisateur
+pollen.fieldset.userInformation.toUpdate=Informations de l'utilisateur à mettre à jour
pollen.fieldset.userInformation.toCreate=Informations de l'utilisateur à créer
pollen.fieldset.userInformation.toDelete=Informations de l'utilisateur à supprimer
pollen.information.need.login=Vous devez être identifié pour pouvoir accéder à cette page. Veuillez remplir le formulaire ci-dessous.
Deleted: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/admin/CreateUser-validation.xml
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/admin/CreateUser-validation.xml 2012-01-23 22:29:31 UTC (rev 3109)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/admin/CreateUser-validation.xml 2012-01-23 22:31:35 UTC (rev 3110)
@@ -1,22 +0,0 @@
-<!DOCTYPE validators PUBLIC
- "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
- "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
-<validators>
-
- <field name="createUser.login">
-
- <field-validator type="requiredstring">
- <message key="pollen.error.login.required"/>
- </field-validator>
-
- </field>
-
- <field name="createUser.email">
-
- <field-validator type="requiredstring">
- <message key="pollen.error.email.required"/>
- </field-validator>
-
- </field>
-
-</validators>
Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/admin/ManageUsers-createUser-validation.xml
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/admin/ManageUsers-createUser-validation.xml (rev 0)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/admin/ManageUsers-createUser-validation.xml 2012-01-23 22:31:35 UTC (rev 3110)
@@ -0,0 +1,22 @@
+<!DOCTYPE validators PUBLIC
+ "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
+ "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+<validators>
+
+ <field name="user.login">
+
+ <field-validator type="requiredstring">
+ <message key="pollen.error.login.required"/>
+ </field-validator>
+
+ </field>
+
+ <field name="user.email">
+
+ <field-validator type="requiredstring">
+ <message key="pollen.error.email.required"/>
+ </field-validator>
+
+ </field>
+
+</validators>
Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/admin/ManageUsers-updateUser-validation.xml
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/admin/ManageUsers-updateUser-validation.xml (rev 0)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/admin/ManageUsers-updateUser-validation.xml 2012-01-23 22:31:35 UTC (rev 3110)
@@ -0,0 +1,22 @@
+<!DOCTYPE validators PUBLIC
+ "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
+ "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+<validators>
+
+ <field name="user.login">
+
+ <field-validator type="requiredstring">
+ <message key="pollen.error.login.required"/>
+ </field-validator>
+
+ </field>
+
+ <field name="user.email">
+
+ <field-validator type="requiredstring">
+ <message key="pollen.error.email.required"/>
+ </field-validator>
+
+ </field>
+
+</validators>
Deleted: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/admin/UpdateUser-validation.xml
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/admin/UpdateUser-validation.xml 2012-01-23 22:29:31 UTC (rev 3109)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/admin/UpdateUser-validation.xml 2012-01-23 22:31:35 UTC (rev 3110)
@@ -1,22 +0,0 @@
-<!DOCTYPE validators PUBLIC
- "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
- "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
-<validators>
-
- <field name="updateUser.login">
-
- <field-validator type="requiredstring">
- <message key="pollen.error.login.required"/>
- </field-validator>
-
- </field>
-
- <field name="updateUser.email">
-
- <field-validator type="requiredstring">
- <message key="pollen.error.email.required"/>
- </field-validator>
-
- </field>
-
-</validators>
Modified: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/struts.xml
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/struts.xml 2012-01-23 22:29:31 UTC (rev 3109)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/struts.xml 2012-01-23 22:31:35 UTC (rev 3110)
@@ -126,7 +126,7 @@
class="org.chorem.pollen.ui.actions.PollenActionSupport"/>
<action name="notLoggued">
- <result>/WEB-INF/jsp/login.jsp</result>
+ <result>/WEB-INF/jsp/user/login.jsp</result>
</action>
<action name="notAdmin">
@@ -160,7 +160,6 @@
</package>
-
<include file="config/struts-json.xml"/>
<include file="config/struts-admin.xml"/>
<include file="config/struts-poll.xml"/>
Copied: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/admin/pollsList.jsp (from rev 3105, branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/pollsList.jsp)
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/admin/pollsList.jsp (rev 0)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/admin/pollsList.jsp 2012-01-23 22:31:35 UTC (rev 3110)
@@ -0,0 +1,61 @@
+<%--
+#%L
+ EchoBase :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2011 Ifremer, 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%
+--%>
+<%@page contentType="text/html" pageEncoding="UTF-8" %>
+<%@ taglib prefix="s" uri="/struts-tags" %>
+<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags" %>
+<script type="text/javascript"
+ src="<s:url value='/js/gridHelper.js' />"></script>
+
+<title><s:text name="pollen.title.pollsList"/></title>
+
+<h1 class="title${pageLogo}"><s:text name="pollen.title.pollsList"/></h1>
+
+<s:url id="loadUrl" action="getPolls" namespace="/json" escapeAmp="false"/>
+
+<%--script type="text/javascript">
+
+ jQuery(document).ready(function () {
+ $.addRowSelectTopic('users');
+ $.addClearSelectTopic('users');
+ $.addAddRowTopic('users', '${addUrl}');
+ $.addSingleRowTopic('users', 'Update', '${editUrl}', 'user.id');
+ $.addSingleRowTopic('users', 'Delete', '${delUrl}', 'user.id');
+ });
+</script--%>
+
+<sjg:grid id="users" dataType="json" href="%{loadUrl}" gridModel="users"
+ pager="true" pagerButtons="true" pagerInput="true"
+ navigator="true" rownumbers="false" autowidth="true"
+ onSelectRowTopics='users-rowSelect' editinline="true" editurl="%{loadUrl}"
+ onCompleteTopics='users-cleanSelect'
+ navigatorEdit="false" navigatorDelete="false"
+ navigatorSearch="false" navigatorRefresh="false"
+ navigatorAdd="false" viewrecords="true"
+ rowList="10,15,20,50,100" rowNum="10">
+ <sjg:gridColumn name="id" title="id" hidden="true"/>
+ <sjg:gridColumn name="login" title='%{getText("pollen.common.login")}' sortable="false" editable="true"/>
+ <sjg:gridColumn name="firstName" title='%{getText("pollen.common.firstName")}' sortable="false" editable="true"/>
+ <sjg:gridColumn name="lastName" title='%{getText("pollen.common.lastName")}' sortable="false" editable="true"/>
+ <sjg:gridColumn name="email" title='%{getText("pollen.common.email")}' sortable="false" editable="true"/>
+ <sjg:gridColumn name="admin" title='%{getText("pollen.common.admin")}' sortable="false" width="100" formatter="checkbox" editable="true" edittype="checkbox"/>
+</sjg:grid>
Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/admin/pollsList.jsp
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/admin/usersList.jsp (from rev 3107, branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/usersList.jsp)
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/admin/usersList.jsp (rev 0)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/admin/usersList.jsp 2012-01-23 22:31:35 UTC (rev 3110)
@@ -0,0 +1,195 @@
+<%--
+#%L
+ EchoBase :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2011 Ifremer, 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%
+--%>
+<%@page contentType="text/html" pageEncoding="UTF-8" %>
+<%@ taglib prefix="s" uri="/struts-tags" %>
+<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags" %>
+<script type="text/javascript"
+ src="<s:url value='/js/gridHelper.js' />"></script>
+
+<title><s:text name="pollen.title.usersList"/></title>
+
+<h1 class="title${pageLogo}"><s:text name="pollen.title.usersList"/></h1>
+
+<s:url id="loadUSers" action="getUsers" namespace="/json" escapeAmp="false"/>
+
+<s:url id="loadUser" action="getUser" namespace="/json"/>
+
+<script type="text/javascript">
+
+ jQuery(document).ready(function () {
+ if ('${action}' == 'create') {
+ $('#createForm').show();
+ }
+ if ('${action}' == 'update') {
+ $('#editForm').show();
+ }
+ if ('${action}' == 'delete') {
+ $('#deleteForm').show();
+ }
+
+ // listen row selection
+ $.addRowSelectTopic('users');
+
+ // to edit a selected row
+ $.listenRowTopic('users-editRow', function (event) {
+ if(!jQuery.struts2_jquery['users']) {
+ return;
+ }
+ var id = jQuery.struts2_jquery['users']['selectedRow'];
+ jQuery.getJSON("${loadUser}", { "userId":id }, function (result) {
+
+ var user = result.user;
+ $('#editForm [name="user.topiaId"]').val(user.id);
+ $('#editForm [name="user.login"]').val(user.login);
+ $('#editForm [name="user.email"]').val(user.email);
+ $('#editForm [name="user.firstName"]').val(user.firstName);
+ $('#editForm [name="user.lastName"]').val(user.lastName);
+ $('#editForm [name="user.admin"]').prop('checked',false);
+ $('#editForm [name="user.admin"]').prop('checked',user.admin);
+ $('#editForm').show();
+ $('#createForm').hide();
+ $('#deleteForm').hide();
+ }
+ );
+ });
+
+ // to create a new row
+ $.listenRowTopic('users-addRow', function(event) {
+ $('#createForm [name="user.login"]').val("");
+ $('#createForm [name="user.email"]').val("");
+ $('#createForm [name="user.firstName"]').val("");
+ $('#createForm [name="user.lastName"]').val("");
+ $('#createForm [name="user.admin"]').prop('checked',false);
+ $('#editForm').hide();
+ $('#deleteForm').hide();
+ $('#createForm').show();
+ });
+
+ // to delete the selected row
+ $.listenRowTopic('users-deleteRow', function(event) {
+ if(!jQuery.struts2_jquery['users']) {
+ return;
+ }
+ var id = jQuery.struts2_jquery['users']['selectedRow'];
+ jQuery.getJSON("${loadUser}", { "userId":id }, function (result) {
+
+ var user = result.user;
+ $('#deleteForm [name="user.topiaId"]').val(user.id);
+ $('#deleteForm [name="user.login"]').val(user.login);
+ $('#deleteForm [name="user.email"]').val(user.email);
+ $('#deleteForm [name="user.firstName"]').val(user.firstName);
+ $('#deleteForm [name="user.lastName"]').val(user.lastName);
+ $('#deleteForm [name="user.admin"]').prop('checked',false);
+ $('#deleteForm [name="user.admin"]').prop('checked',user.admin);
+ $('#editForm').hide();
+ $('#createForm').hide();
+ $('#deleteForm').show();
+ }
+ );
+ });
+ });
+</script>
+
+<sjg:grid id="users" dataType="json" href="%{loadUSers}" gridModel="users"
+ pager="true" pagerButtons="true" pagerInput="true"
+ navigator="true" rownumbers="false" autowidth="true"
+ onSelectRowTopics='users-rowSelect' editinline="false"
+ onCompleteTopics='users-cleanSelect'
+ navigatorEdit="false" navigatorDelete="false"
+ navigatorSearch="false" navigatorRefresh="false"
+ navigatorAdd="false" viewrecords="true"
+ rowList="10,15,20,50,100" rowNum="10"
+ navigatorExtraButtons="{
+ add: { title: '%{getText(\"pollen.action.createUser\")}', icon: 'ui-icon-plus', topic: 'users-addRow' },
+ edit: { title: '%{getText(\"pollen.action.editUser\")}', icon: 'ui-icon-pencil', topic: 'users-editRow' },
+ delete:{ title: '%{getText(\"pollen.action.deleteUser\")}', icon: 'ui-icon-trash', topic: 'users-deleteRow' }}">
+
+ <sjg:gridColumn name="id" title="id" hidden="true"/>
+ <sjg:gridColumn name="login" title='%{getText("pollen.common.login")}'
+ sortable="false"/>
+ <sjg:gridColumn name="firstName" title='%{getText("pollen.common.firstName")}'
+ sortable="false"/>
+ <sjg:gridColumn name="lastName" title='%{getText("pollen.common.lastName")}'
+ sortable="false"/>
+ <sjg:gridColumn name="email" title='%{getText("pollen.common.email")}'
+ sortable="false"/>
+ <sjg:gridColumn name="admin" title='%{getText("pollen.common.admin")}'
+ sortable="false" width="100" formatter="checkbox"
+ editable="true" />
+</sjg:grid>
+
+<br/>
+
+<s:form id='editForm' method="POST" namespace="/admin" cssClass="hidden">
+
+ <s:hidden name="action" value="update"/>
+ <s:hidden key="user.topiaId" label=""/>
+ <%--<s:hidden key="user.login" label=""/>--%>
+
+ <fieldset>
+ <legend><s:text name="pollen.fieldset.userInformation.toUpdate"/></legend>
+ <s:textfield key="user.login" label="%{getText('pollen.common.login')}" required="true" readonly="true" size="40"/>
+ <s:textfield key="user.email" label="%{getText('pollen.common.email')}" required="true" size="40"/>
+ <s:textfield key="user.firstName" label="%{getText('pollen.common.firstName')}" size="40"/>
+ <s:textfield key="user.lastName" label="%{getText('pollen.common.lastName')}" size="40"/>
+ <s:checkbox key="user.admin" label="%{getText('pollen.common.admin')}"/>
+ </fieldset>
+ <br/>
+ <s:submit action="updateUser" key="pollen.action.validate" align="center"/>
+
+</s:form>
+
+<s:form id='createForm' method="POST" namespace="/admin" cssClass="hidden">
+
+ <s:hidden name="action" value="create"/>
+ <fieldset>
+ <legend><s:text name="pollen.fieldset.userInformation.toCreate"/></legend>
+ <s:textfield key="user.login" label="%{getText('pollen.common.login')}" required="true" size="40"/>
+ <s:textfield key="user.email" label="%{getText('pollen.common.email')}" required="true" size="40"/>
+ <s:textfield key="user.firstName" label="%{getText('pollen.common.firstName')}" size="40"/>
+ <s:textfield key="user.lastName" label="%{getText('pollen.common.lastName')}" size="40"/>
+ <s:checkbox key="user.admin" label="%{getText('pollen.common.admin')}"/>
+ </fieldset>
+ <br/>
+ <s:submit action="createUser" key="pollen.action.create" align="center"/>
+</s:form>
+
+<s:form id='deleteForm' method="POST" namespace="/admin" cssClass="hidden">
+
+ <s:hidden name="action" value="delete"/>
+ <s:hidden key="user.topiaId" label=""/>
+ <%--<s:hidden key="user.login" label=""/>--%>
+
+ <fieldset>
+ <legend><s:text name="pollen.fieldset.userInformation.toDelete"/></legend>
+ <s:textfield key="user.login" label="%{getText('pollen.common.login')}" required="true" readonly="true" size="40"/>
+ <s:textfield key="user.email" label="%{getText('pollen.common.email')}" required="true" readonly="true" size="40"/>
+ <s:textfield key="user.firstName" label="%{getText('pollen.common.firstName')}" readonly="true" size="40"/>
+ <s:textfield key="user.lastName" label="%{getText('pollen.common.lastName')}" readonly="true" size="40"/>
+ <s:checkbox key="user.admin" label="%{getText('pollen.common.admin')}" disabled="true"/>
+ </fieldset>
+ <br/>
+ <s:submit action="deleteUser" key="pollen.action.delete" align="center"/>
+</s:form>
+
+
Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/admin/usersList.jsp
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/createPoll.jsp
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/createPoll.jsp 2012-01-23 22:29:31 UTC (rev 3109)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/createPoll.jsp 2012-01-23 22:31:35 UTC (rev 3110)
@@ -1,50 +0,0 @@
-<%--
- #%L
- Pollen :: UI (strust2)
-
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2009 - 2012 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%
- --%>
-<%@ page language="java" contentType="text/html" pageEncoding="utf-8" %>
-<%@ taglib prefix="s" uri="/struts-tags" %>
-
-<title><s:text name="pollen.title.createPoll"/></title>
-
-<h1 class="title${pageLogo}"><s:text name="pollen.title.createPoll"/></h1>
-
-<s:form method="POST" key="registerForm">
-
- <fieldset>
- <legend><s:text name="pollen.fieldset.connexionInformation"/></legend>
-
- <s:textfield name="user.login" key="pollen.common.login" required="true"/>
- <s:password name="user.password" key="pollen.common.password" required="true"/>
- <s:password name="password2" key="pollen.common.password2" required="true"/>
- </fieldset>
-
- <fieldset>
- <legend><s:text name="pollen.fieldset.userInformation"/></legend>
-
- <s:textfield name="user.email" key="pollen.common.email" required="true"/>
- <s:textfield name="user.firstName" key="pollen.common.firstName"/>
- <s:textfield name="user.lastName" key="pollen.common.lastName"/>
- </fieldset>
- <br/>
- <s:submit action="registerUser" key="pollen.action.register" align="center"/>
-</s:form>
Deleted: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/login.jsp
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/login.jsp 2012-01-23 22:29:31 UTC (rev 3109)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/login.jsp 2012-01-23 22:31:35 UTC (rev 3110)
@@ -1,69 +0,0 @@
-<%--
- #%L
- Pollen :: UI (strust2)
-
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2009 - 2012 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%
- --%>
-
-<%@ page language="java" contentType="text/html" pageEncoding="utf-8" %>
-<%@ taglib prefix="s" uri="/struts-tags" %>
-
-<div>
- <strong>
- <s:text name="pollen.information.need.login"/>
- </strong>
-</div>
-
-<br/>
-
-<s:form id="connection" action="login" method="POST" namespace="/user">
-
-<fieldset>
- <legend><s:text name="pollen.fieldset.login"/></legend>
-
- <s:textfield key="login" size="10" label="%{getText('pollen.common.login')}"
- required="true"/>
- <s:password key="password"
- label="%{getText('pollen.common.password')}" size="10"
- required="true"/>
-
-
-</fieldset>
- <br/>
- <s:submit id="submitform" action="login" key="pollen.action.login"
- align="center"/>
- </s:form>
-<div class="center" style="margin-bottom:20px;">
- <img src="<s:url value='/img/pollen_%{safeLanguage}.png' />"
- alt="Pollen logo"/>
-</div>
-<div class="center">
- <s:a action="createForm">
- <img src="<s:url value='/img/smallCreation_%{safeLanguage}.png' />"
- alt="poll creation"/>
- </s:a>
- <s:a action="createForm">
- <img src="<s:url value='/img/smallVote_%{safeLanguage}.png' />" alt="vote"/>
- </s:a>
- <s:a action="createForm">
- <img src="<s:url value='/img/smallVoteCounting_%{safeLanguage}.png' />"
- alt="voteCounting"/>
- </s:a>
-</div>
\ No newline at end of file
Copied: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/createPoll.jsp (from rev 3105, branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/createPoll.jsp)
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/createPoll.jsp (rev 0)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/createPoll.jsp 2012-01-23 22:31:35 UTC (rev 3110)
@@ -0,0 +1,50 @@
+<%--
+ #%L
+ Pollen :: UI (strust2)
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2009 - 2012 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%
+ --%>
+<%@ page language="java" contentType="text/html" pageEncoding="utf-8" %>
+<%@ taglib prefix="s" uri="/struts-tags" %>
+
+<title><s:text name="pollen.title.createPoll"/></title>
+
+<h1 class="title${pageLogo}"><s:text name="pollen.title.createPoll"/></h1>
+
+<s:form method="POST" key="registerForm">
+
+ <fieldset>
+ <legend><s:text name="pollen.fieldset.connexionInformation"/></legend>
+
+ <s:textfield name="user.login" key="pollen.common.login" required="true"/>
+ <s:password name="user.password" key="pollen.common.password" required="true"/>
+ <s:password name="password2" key="pollen.common.password2" required="true"/>
+ </fieldset>
+
+ <fieldset>
+ <legend><s:text name="pollen.fieldset.userInformation"/></legend>
+
+ <s:textfield name="user.email" key="pollen.common.email" required="true"/>
+ <s:textfield name="user.firstName" key="pollen.common.firstName"/>
+ <s:textfield name="user.lastName" key="pollen.common.lastName"/>
+ </fieldset>
+ <br/>
+ <s:submit action="registerUser" key="pollen.action.register" align="center"/>
+</s:form>
Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/createPoll.jsp
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/pollsList.jsp
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/pollsList.jsp 2012-01-23 22:29:31 UTC (rev 3109)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/pollsList.jsp 2012-01-23 22:31:35 UTC (rev 3110)
@@ -1,61 +0,0 @@
-<%--
-#%L
- EchoBase :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2011 Ifremer, 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%
---%>
-<%@page contentType="text/html" pageEncoding="UTF-8" %>
-<%@ taglib prefix="s" uri="/struts-tags" %>
-<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags" %>
-<script type="text/javascript"
- src="<s:url value='/js/gridHelper.js' />"></script>
-
-<title><s:text name="pollen.title.pollsList"/></title>
-
-<h1 class="title${pageLogo}"><s:text name="pollen.title.pollsList"/></h1>
-
-<s:url id="loadUrl" action="getPolls" namespace="/json" escapeAmp="false"/>
-
-<%--script type="text/javascript">
-
- jQuery(document).ready(function () {
- $.addRowSelectTopic('users');
- $.addClearSelectTopic('users');
- $.addAddRowTopic('users', '${addUrl}');
- $.addSingleRowTopic('users', 'Update', '${editUrl}', 'user.id');
- $.addSingleRowTopic('users', 'Delete', '${delUrl}', 'user.id');
- });
-</script--%>
-
-<sjg:grid id="users" dataType="json" href="%{loadUrl}" gridModel="users"
- pager="true" pagerButtons="true" pagerInput="true"
- navigator="true" rownumbers="false" autowidth="true"
- onSelectRowTopics='users-rowSelect' editinline="true" editurl="%{loadUrl}"
- onCompleteTopics='users-cleanSelect'
- navigatorEdit="false" navigatorDelete="false"
- navigatorSearch="false" navigatorRefresh="false"
- navigatorAdd="false" viewrecords="true"
- rowList="10,15,20,50,100" rowNum="10">
- <sjg:gridColumn name="id" title="id" hidden="true"/>
- <sjg:gridColumn name="login" title='%{getText("pollen.common.login")}' sortable="false" editable="true"/>
- <sjg:gridColumn name="firstName" title='%{getText("pollen.common.firstName")}' sortable="false" editable="true"/>
- <sjg:gridColumn name="lastName" title='%{getText("pollen.common.lastName")}' sortable="false" editable="true"/>
- <sjg:gridColumn name="email" title='%{getText("pollen.common.email")}' sortable="false" editable="true"/>
- <sjg:gridColumn name="admin" title='%{getText("pollen.common.admin")}' sortable="false" width="100" formatter="checkbox" editable="true" edittype="checkbox"/>
-</sjg:grid>
Deleted: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/registerUser.jsp
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/registerUser.jsp 2012-01-23 22:29:31 UTC (rev 3109)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/registerUser.jsp 2012-01-23 22:31:35 UTC (rev 3110)
@@ -1,50 +0,0 @@
-<%--
- #%L
- Pollen :: UI (strust2)
-
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2009 - 2012 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%
- --%>
-<%@ page language="java" contentType="text/html" pageEncoding="utf-8" %>
-<%@ taglib prefix="s" uri="/struts-tags" %>
-
-<title><s:text name="pollen.title.register"/></title>
-
-<h1 class="title${pageLogo}"><s:text name="pollen.title.register"/></h1>
-
-<s:form method="POST" key="registerForm">
-
- <fieldset>
- <legend><s:text name="pollen.fieldset.connexionInformation"/></legend>
-
- <s:textfield name="user.login" key="pollen.common.login" required="true"/>
- <s:password name="user.password" key="pollen.common.password" required="true"/>
- <s:password name="password2" key="pollen.common.password2" required="true"/>
- </fieldset>
-
- <fieldset>
- <legend><s:text name="pollen.fieldset.userInformation"/></legend>
-
- <s:textfield name="user.email" key="pollen.common.email" required="true"/>
- <s:textfield name="user.firstName" key="pollen.common.firstName"/>
- <s:textfield name="user.lastName" key="pollen.common.lastName"/>
- </fieldset>
- <br/>
- <s:submit action="registerUser" key="pollen.action.register" align="center"/>
-</s:form>
Deleted: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/showUser.jsp
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/showUser.jsp 2012-01-23 22:29:31 UTC (rev 3109)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/showUser.jsp 2012-01-23 22:31:35 UTC (rev 3110)
@@ -1,50 +0,0 @@
-<%--
- #%L
- Pollen :: UI (strust2)
-
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2009 - 2012 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%
- --%>
-<%@ page language="java" contentType="text/html" pageEncoding="utf-8" %>
-<%@ taglib prefix="s" uri="/struts-tags" %>
-
-<title><s:text name="pollen.title.myAccount"/></title>
-
-<h1 class="title${pageLogo}"><s:text name="pollen.title.myAccount"/></h1>
-
-<s:form method="GET">
-
- <fieldset>
- <legend><s:text name="pollen.fieldset.connexionInformation"/></legend>
-
- <s:hidden key="user.topiaId" label="" />
- <s:label name="user.login" key="pollen.common.login"/>
- </fieldset>
-
- <fieldset>
- <legend><s:text name="pollen.fieldset.userInformation"/></legend>
-
- <s:label name="user.email" key="pollen.common.email" />
- <s:label name="user.firstName" key="pollen.common.firstName" />
- <s:label name="user.lastName" key="pollen.common.lastName" />
- </fieldset>
- <br/>
- <s:submit action="updateUser" method="input"
- key="pollen.action.modify" align="center"/>
-</s:form>
Deleted: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/updateUser.jsp
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/updateUser.jsp 2012-01-23 22:29:31 UTC (rev 3109)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/updateUser.jsp 2012-01-23 22:31:35 UTC (rev 3110)
@@ -1,53 +0,0 @@
-<%--
- #%L
- Pollen :: UI (strust2)
-
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2009 - 2012 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%
- --%>
-<%@ page language="java" contentType="text/html" pageEncoding="utf-8" %>
-<%@ taglib prefix="s" uri="/struts-tags" %>
-
-<title><s:text name="pollen.title.myAccount"/></title>
-
-<h1 class="title${pageLogo}"><s:text name="pollen.title.myAccount"/></h1>
-
-<s:form method="POST">
-
- <fieldset>
- <legend><s:text name="pollen.fieldset.connexionInformation"/></legend>
-
- <s:hidden key="user.topiaId" label=""/>
- <s:textfield name="user.login" key="pollen.common.login" required="true"/>
- <s:password name="user.password" key="pollen.common.password"
- required="true"/>
- <s:password name="newPassword" key="pollen.common.newPassword"/>
- <s:password name="newPassword2" key="pollen.common.newPassword2"/>
- </fieldset>
-
- <fieldset>
- <legend><s:text name="pollen.fieldset.userInformation"/></legend>
-
- <s:textfield name="user.email" key="pollen.common.email" required="true"/>
- <s:textfield name="user.firstName" key="pollen.common.firstName"/>
- <s:textfield name="user.lastName" key="pollen.common.lastName"/>
- </fieldset>
- <br/>
- <s:submit action="updateUser" key="pollen.action.validate" align="center"/>
-</s:form>
Copied: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/login.jsp (from rev 3105, branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/login.jsp)
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/login.jsp (rev 0)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/login.jsp 2012-01-23 22:31:35 UTC (rev 3110)
@@ -0,0 +1,69 @@
+<%--
+ #%L
+ Pollen :: UI (strust2)
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2009 - 2012 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%
+ --%>
+
+<%@ page language="java" contentType="text/html" pageEncoding="utf-8" %>
+<%@ taglib prefix="s" uri="/struts-tags" %>
+
+<div>
+ <strong>
+ <s:text name="pollen.information.need.login"/>
+ </strong>
+</div>
+
+<br/>
+
+<s:form id="connection" action="login" method="POST" namespace="/user">
+
+<fieldset>
+ <legend><s:text name="pollen.fieldset.login"/></legend>
+
+ <s:textfield key="login" size="10" label="%{getText('pollen.common.login')}"
+ required="true"/>
+ <s:password key="password"
+ label="%{getText('pollen.common.password')}" size="10"
+ required="true"/>
+
+
+</fieldset>
+ <br/>
+ <s:submit id="submitform" action="login" key="pollen.action.login"
+ align="center"/>
+ </s:form>
+<div class="center" style="margin-bottom:20px;">
+ <img src="<s:url value='/img/pollen_%{safeLanguage}.png' />"
+ alt="Pollen logo"/>
+</div>
+<div class="center">
+ <s:a action="createForm">
+ <img src="<s:url value='/img/smallCreation_%{safeLanguage}.png' />"
+ alt="poll creation"/>
+ </s:a>
+ <s:a action="createForm">
+ <img src="<s:url value='/img/smallVote_%{safeLanguage}.png' />" alt="vote"/>
+ </s:a>
+ <s:a action="createForm">
+ <img src="<s:url value='/img/smallVoteCounting_%{safeLanguage}.png' />"
+ alt="voteCounting"/>
+ </s:a>
+</div>
\ No newline at end of file
Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/login.jsp
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/registerUser.jsp (from rev 3105, branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/registerUser.jsp)
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/registerUser.jsp (rev 0)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/registerUser.jsp 2012-01-23 22:31:35 UTC (rev 3110)
@@ -0,0 +1,50 @@
+<%--
+ #%L
+ Pollen :: UI (strust2)
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2009 - 2012 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%
+ --%>
+<%@ page language="java" contentType="text/html" pageEncoding="utf-8" %>
+<%@ taglib prefix="s" uri="/struts-tags" %>
+
+<title><s:text name="pollen.title.register"/></title>
+
+<h1 class="title${pageLogo}"><s:text name="pollen.title.register"/></h1>
+
+<s:form method="POST" key="registerForm">
+
+ <fieldset>
+ <legend><s:text name="pollen.fieldset.connexionInformation"/></legend>
+
+ <s:textfield name="user.login" key="pollen.common.login" required="true"/>
+ <s:password name="user.password" key="pollen.common.password" required="true"/>
+ <s:password name="password2" key="pollen.common.password2" required="true"/>
+ </fieldset>
+
+ <fieldset>
+ <legend><s:text name="pollen.fieldset.userInformation"/></legend>
+
+ <s:textfield name="user.email" key="pollen.common.email" required="true"/>
+ <s:textfield name="user.firstName" key="pollen.common.firstName"/>
+ <s:textfield name="user.lastName" key="pollen.common.lastName"/>
+ </fieldset>
+ <br/>
+ <s:submit action="registerUser" key="pollen.action.register" align="center"/>
+</s:form>
Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/registerUser.jsp
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/showUser.jsp (from rev 3105, branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/showUser.jsp)
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/showUser.jsp (rev 0)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/showUser.jsp 2012-01-23 22:31:35 UTC (rev 3110)
@@ -0,0 +1,50 @@
+<%--
+ #%L
+ Pollen :: UI (strust2)
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2009 - 2012 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%
+ --%>
+<%@ page language="java" contentType="text/html" pageEncoding="utf-8" %>
+<%@ taglib prefix="s" uri="/struts-tags" %>
+
+<title><s:text name="pollen.title.myAccount"/></title>
+
+<h1 class="title${pageLogo}"><s:text name="pollen.title.myAccount"/></h1>
+
+<s:form method="POST">
+
+ <fieldset>
+ <legend><s:text name="pollen.fieldset.connexionInformation"/></legend>
+
+ <s:hidden key="user.topiaId" label="" />
+ <s:label name="user.login" key="pollen.common.login"/>
+ </fieldset>
+
+ <fieldset>
+ <legend><s:text name="pollen.fieldset.userInformation"/></legend>
+
+ <s:label name="user.email" key="pollen.common.email" />
+ <s:label name="user.firstName" key="pollen.common.firstName" />
+ <s:label name="user.lastName" key="pollen.common.lastName" />
+ </fieldset>
+ <br/>
+ <s:submit action="updateUser" method="input"
+ key="pollen.action.modify" align="center"/>
+</s:form>
Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/showUser.jsp
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/updateUser.jsp (from rev 3105, branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/updateUser.jsp)
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/updateUser.jsp (rev 0)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/updateUser.jsp 2012-01-23 22:31:35 UTC (rev 3110)
@@ -0,0 +1,53 @@
+<%--
+ #%L
+ Pollen :: UI (strust2)
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2009 - 2012 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%
+ --%>
+<%@ page language="java" contentType="text/html" pageEncoding="utf-8" %>
+<%@ taglib prefix="s" uri="/struts-tags" %>
+
+<title><s:text name="pollen.title.myAccount"/></title>
+
+<h1 class="title${pageLogo}"><s:text name="pollen.title.myAccount"/></h1>
+
+<s:form method="POST">
+
+ <fieldset>
+ <legend><s:text name="pollen.fieldset.connexionInformation"/></legend>
+
+ <s:hidden key="user.topiaId" label=""/>
+ <s:textfield name="user.login" key="pollen.common.login" required="true"/>
+ <s:password name="user.password" key="pollen.common.password"
+ required="true"/>
+ <s:password name="newPassword" key="pollen.common.newPassword"/>
+ <s:password name="newPassword2" key="pollen.common.newPassword2"/>
+ </fieldset>
+
+ <fieldset>
+ <legend><s:text name="pollen.fieldset.userInformation"/></legend>
+
+ <s:textfield name="user.email" key="pollen.common.email" required="true"/>
+ <s:textfield name="user.firstName" key="pollen.common.firstName"/>
+ <s:textfield name="user.lastName" key="pollen.common.lastName"/>
+ </fieldset>
+ <br/>
+ <s:submit action="updateUser" key="pollen.action.validate" align="center"/>
+</s:form>
Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/updateUser.jsp
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/usersList.jsp
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/usersList.jsp 2012-01-23 22:29:31 UTC (rev 3109)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/usersList.jsp 2012-01-23 22:31:35 UTC (rev 3110)
@@ -1,194 +0,0 @@
-<%--
-#%L
- EchoBase :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2011 Ifremer, 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%
---%>
-<%@page contentType="text/html" pageEncoding="UTF-8" %>
-<%@ taglib prefix="s" uri="/struts-tags" %>
-<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags" %>
-<script type="text/javascript"
- src="<s:url value='/js/gridHelper.js' />"></script>
-
-<title><s:text name="pollen.title.usersList"/></title>
-
-<h1 class="title${pageLogo}"><s:text name="pollen.title.usersList"/></h1>
-
-<s:url id="loadUSers" action="getUsers" namespace="/json" escapeAmp="false"/>
-
-<s:url id="loadUser" action="getUser" namespace="/json"/>
-
-<script type="text/javascript">
-
- jQuery(document).ready(function () {
- if ('${createUserNotNull}' == 'true') {
- $('#createForm').show();
- }
- if ('${updateUserNotNull}' == 'true') {
- $('#editForm').show();
- }
- if ('${deleteUserNotNull}' == 'true') {
- $('#deleteForm').show();
- }
-
- // listen row selection
- $.addRowSelectTopic('users');
-
- // to edit a selected row
- $.listenRowTopic('users-editRow', function (event) {
- if(!jQuery.struts2_jquery['users']) {
- return;
- }
- var id = jQuery.struts2_jquery['users']['selectedRow'];
- jQuery.getJSON("${loadUser}", { "userId":id }, function (result) {
-
- var user = result.user;
- $('#editForm [name="updateUser.topiaId"]').val(user.id);
- $('#editForm [name="updateUser.login"]').val(user.login);
- $('#editForm [name="updateUser.email"]').val(user.email);
- $('#editForm [name="updateUser.firstName"]').val(user.firstName);
- $('#editForm [name="updateUser.lastName"]').val(user.lastName);
- $('#editForm [name="updateUser.admin"]').prop('checked',false);
- $('#editForm [name="updateUser.admin"]').prop('checked',user.admin);
- $('#editForm').show();
- $('#createForm').hide();
- $('#deleteForm').hide();
- }
- );
- });
-
- // to create a new row
- $.listenRowTopic('users-addRow', function(event) {
- $('#createForm [name="createUser.login"]').val("");
- $('#createForm [name="createUser.email"]').val("");
- $('#createForm [name="createUser.firstName"]').val("");
- $('#createForm [name="createUser.lastName"]').val("");
- $('#createForm [name="createUser.admin"]').prop('checked',false);
- $('#editForm').hide();
- $('#deleteForm').hide();
- $('#createForm').show();
- });
-
- // to delete the selected row
- $.listenRowTopic('users-deleteRow', function(event) {
- if(!jQuery.struts2_jquery['users']) {
- return;
- }
- var id = jQuery.struts2_jquery['users']['selectedRow'];
- jQuery.getJSON("${loadUser}", { "userId":id }, function (result) {
-
- var user = result.user;
- $('#deleteForm [name="deleteUser.topiaId"]').val(user.id);
- $('#deleteForm [name="deleteUser.login"]').val(user.login);
- $('#deleteForm [name="deleteUser.email"]').val(user.email);
- $('#deleteForm [name="deleteUser.firstName"]').val(user.firstName);
- $('#deleteForm [name="deleteUser.lastName"]').val(user.lastName);
- $('#deleteForm [name="deleteUser.admin"]').prop('checked',false);
- $('#deleteForm [name="deleteUser.admin"]').prop('checked',user.admin);
- $('#editForm').hide();
- $('#createForm').hide();
- $('#deleteForm').show();
- }
- );
- });
- });
-</script>
-
-<sjg:grid id="users" dataType="json" href="%{loadUSers}" gridModel="users"
- pager="true" pagerButtons="true" pagerInput="true"
- navigator="true" rownumbers="false" autowidth="true"
- onSelectRowTopics='users-rowSelect' editinline="false"
- onCompleteTopics='users-cleanSelect'
- navigatorEdit="false" navigatorDelete="false"
- navigatorSearch="false" navigatorRefresh="false"
- navigatorAdd="false" viewrecords="true"
- rowList="10,15,20,50,100" rowNum="10"
- navigatorExtraButtons="{
- add: { title: '%{getText(\"pollen.action.createUser\")}', icon: 'ui-icon-plus', topic: 'users-addRow' },
- edit: { title: '%{getText(\"pollen.action.editUser\")}', icon: 'ui-icon-pencil', topic: 'users-editRow' },
- delete:{ title: '%{getText(\"pollen.action.deleteUser\")}', icon: 'ui-icon-trash', topic: 'users-deleteRow' }}">
-
- <sjg:gridColumn name="id" title="id" hidden="true"/>
- <sjg:gridColumn name="login" title='%{getText("pollen.common.login")}'
- sortable="false"/>
- <sjg:gridColumn name="firstName" title='%{getText("pollen.common.firstName")}'
- sortable="false"/>
- <sjg:gridColumn name="lastName" title='%{getText("pollen.common.lastName")}'
- sortable="false"/>
- <sjg:gridColumn name="email" title='%{getText("pollen.common.email")}'
- sortable="false"/>
- <sjg:gridColumn name="admin" title='%{getText("pollen.common.admin")}'
- sortable="false" width="100" formatter="checkbox"
- editable="true" />
-</sjg:grid>
-
-<br/>
-
-<s:form id='editForm' method="POST" namespace="/admin" cssClass="hidden">
-
- <s:hidden key="updateUser.topiaId" label=""/>
- <s:hidden key="updateUser.login" label=""/>
-
- <fieldset>
- <legend><s:text name="pollen.fieldset.userInformation"/></legend>
- <s:textfield key="updateUser.email" label="%{getText('pollen.common.email')}"
- required="true"/>
- <s:textfield key="updateUser.firstName"
- label="%{getText('pollen.common.firstName')}"/>
- <s:textfield key="updateUser.lastName"
- label="%{getText('pollen.common.lastName')}"/>
- <s:checkbox key="updateUser.admin" label="%{getText('pollen.common.admin')}"/>
- </fieldset>
- <br/>
- <s:submit action="updateUser" key="pollen.action.validate" align="center"/>
-
-</s:form>
-
-<s:form id='createForm' method="POST" namespace="/admin" cssClass="hidden">
-
- <fieldset>
- <legend><s:text name="pollen.fieldset.userInformation.toCreate"/></legend>
- <s:textfield key="createUser.login" label="%{getText('pollen.common.login')}" required="true"/>
- <s:textfield key="createUser.email" label="%{getText('pollen.common.email')}" required="true"/>
- <s:textfield key="createUser.firstName" label="%{getText('pollen.common.firstName')}"/>
- <s:textfield key="createUser.lastName" label="%{getText('pollen.common.lastName')}"/>
- <s:checkbox key="createUser.admin" label="%{getText('pollen.common.admin')}"/>
- </fieldset>
- <br/>
- <s:submit action="createUser" key="pollen.action.create" align="center"/>
-</s:form>
-
-<s:form id='deleteForm' method="POST" namespace="/admin" cssClass="hidden">
-
- <s:hidden key="deleteUser.topiaId" label=""/>
- <s:hidden key="deleteUser.login" label=""/>
-
- <fieldset>
- <legend><s:text name="pollen.fieldset.userInformation.toDelete"/></legend>
- <s:textfield key="deleteUser.login" label="%{getText('pollen.common.login')}" required="true" disabled="true"/>
- <s:textfield key="deleteUser.email" label="%{getText('pollen.common.email')}" required="true" disabled="true"/>
- <s:textfield key="deleteUser.firstName" label="%{getText('pollen.common.firstName')}" disabled="true"/>
- <s:textfield key="deleteUser.lastName" label="%{getText('pollen.common.lastName')}" disabled="true"/>
- <s:checkbox key="deleteUser.admin" label="%{getText('pollen.common.admin')}" disabled="true"/>
- </fieldset>
- <br/>
- <s:submit action="deleteUser" key="pollen.action.delete" align="center"/>
-</s:form>
-
-
1
0
r3109 - in branches/pollen-2.0-beta-1/pollen-services/src: main/java/org/chorem/pollen main/java/org/chorem/pollen/mail main/java/org/chorem/pollen/service/legacy main/java/org/chorem/pollen/services main/java/org/chorem/pollen/services/exceptions test/java/org/chorem/pollen/service/legacy test/java/org/chorem/pollen/services
by tchemit@users.chorem.org 23 Jan '12
by tchemit@users.chorem.org 23 Jan '12
23 Jan '12
Author: tchemit
Date: 2012-01-23 23:29:31 +0100 (Mon, 23 Jan 2012)
New Revision: 3109
Url: http://chorem.org/repositories/revision/pollen/3109
Log:
- introduce exceptions package
- copy all code from legacy services to new services
- depreciates all old stuff
Added:
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/FavoriteListAlreadyExistException.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/ParticipantAlreadyFoundInListException.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/ParticipantExistWithoutMailException.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollAlreadyClosedException.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollAlreadyExistException.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollNotFoundException.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/UserEmailAlreadyUsedException.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/UserInvalidPasswordException.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/UserLoginAlreadyUsedException.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/UserNotFoundException.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/VoteDoubloonException.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/VoteNotAllowedException.java
Removed:
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserEmailAlreadyUsedException.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserInvalidPasswordException.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserLoginAlreadyUsedException.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserNotFoundException.java
Modified:
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/PollenContextImpl.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/mail/BackgroundWorkerImpl.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/mail/PreventRuleManager.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceEmail.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceEmailAbstract.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceEmailImpl.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceFavorite.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceFavoriteAbstract.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceFavoriteImpl.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServicePoll.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServicePollAbstract.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServicePollImpl.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceUserAbstract.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceUserImpl.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceVote.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceVoteAbstract.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceVoteImpl.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/FavoriteService.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/PollService.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserService.java
branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/VoteService.java
branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/service/legacy/AbstractServiceTest.java
branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/service/legacy/ServiceFavoriteImplTest.java
branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/service/legacy/ServicePollImplTest.java
branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/service/legacy/ServiceUserImplTest.java
branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/service/legacy/ServiceVoteImplTest.java
branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/FakeServiceContext.java
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/PollenContextImpl.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/PollenContextImpl.java 2012-01-23 22:27:46 UTC (rev 3108)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/PollenContextImpl.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -56,6 +56,7 @@
* Mise a jour: $Date$
* par : $Author$
*/
+@Deprecated
public class PollenContextImpl implements PollenContext {
/** log. */
@@ -74,7 +75,7 @@
/**
* Default configuration file will be loaded using
- * {@link org.nuiton.util.ApplicationConfig }.
+ * {@link ApplicationConfig }.
* Then the other configuration initialization will be done in
* {@link #loadConfiguration(ApplicationConfig)} method.
*/
@@ -82,18 +83,18 @@
try {
if (log.isInfoEnabled()) {
log.info("load default configuration from " +
- PollenContextImpl.DEFAULT_FILENAME);
+ DEFAULT_FILENAME);
}
ApplicationConfig conf = new ApplicationConfig();
- conf.setConfigFileName(PollenContextImpl.DEFAULT_FILENAME);
- conf.parse(new String[]{});
+ conf.setConfigFileName(DEFAULT_FILENAME);
+ conf.parse();
conf.printConfig();
loadConfiguration(conf);
} catch (ArgumentsParserException eee) {
treateError(eee, n_("pollen.error.context.parse"),
- PollenContextImpl.DEFAULT_FILENAME);
+ DEFAULT_FILENAME);
}
}
@@ -234,7 +235,6 @@
*
* @param key of the property
* @return value of this property
- * @throws PollenBusinessException
*/
public String getProperty(String key) {
return getConfiguration().getOption(key);
@@ -244,7 +244,6 @@
* Get all properties from the configuration
*
* @return the Properties of the application
- * @throws PollenBusinessException
*/
public Properties getProperties() {
return getConfiguration().getOptions();
@@ -267,8 +266,6 @@
* Get the Topia rootContext.
*
* @return the main TopiaContext needed to begin new transaction
- * @throws PollenException
- * @throws PollenBusinessException
*/
public TopiaContext getTopiaRootContext() {
try {
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/mail/BackgroundWorkerImpl.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/mail/BackgroundWorkerImpl.java 2012-01-23 22:27:46 UTC (rev 3108)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/mail/BackgroundWorkerImpl.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -143,6 +143,7 @@
* Envoi du mail de notification.
*
* @param poll sondage concerné
+ * @param timeValue
*/
private void sendMailNotification(Poll poll, Long timeValue) {
// FIXME : create ServiceMail
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/mail/PreventRuleManager.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/mail/PreventRuleManager.java 2012-01-23 22:27:46 UTC (rev 3108)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/mail/PreventRuleManager.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -81,6 +81,7 @@
/**
* Exécution de la méthode définie par la règle. La méthode s'exécute sans
* prise en compte de la sensibilité de la règle.
+ * @return
*/
public boolean execute() {
return execute(null, null, null);
@@ -91,6 +92,7 @@
* valeur correspond à la sensibilité de la règle.
*
* @param value valeur conditionnant l'exécution de la règle.
+ * @return
*/
public boolean execute(Integer value) {
return execute(null, value, null);
@@ -101,6 +103,7 @@
* portée est égale à la portée de la règle.
*
* @param scope portée de la règle.
+ * @return
*/
public boolean execute(String scope) {
return execute(scope, null, null);
@@ -113,6 +116,7 @@
*
* @param scope portée de la règle.
* @param value valeur conditionnant l'exécution de la règle.
+ * @return
*/
public boolean execute(String scope, Integer value) {
return execute(scope, value, null);
@@ -176,6 +180,8 @@
* Action qui ne fait rien.
*
* TODO set this method to protected
+ * @param data
+ * @param data
*/
public static void nullAction(Object data) {
// ne fait rien
@@ -185,6 +191,8 @@
* Action qui écrit sur la sortie standard.
*
* TODO set this method to protected
+ * @param data
+ * @param data
*/
public static void printAction(Object data) {
String message = "";
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceEmail.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceEmail.java 2012-01-23 22:27:46 UTC (rev 3108)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceEmail.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -28,6 +28,7 @@
import org.chorem.pollen.bean.PollenEmail;
import org.chorem.pollen.entity.UserAccount;
+@Deprecated
public interface ServiceEmail {
PollenEmail createEmail();
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceEmailAbstract.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceEmailAbstract.java 2012-01-23 22:27:46 UTC (rev 3108)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceEmailAbstract.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -33,6 +33,7 @@
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
+@Deprecated
public abstract class ServiceEmailAbstract implements ServiceEmail {
protected abstract TopiaContext beginTransaction() throws TopiaException;
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceEmailImpl.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceEmailImpl.java 2012-01-23 22:27:46 UTC (rev 3108)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceEmailImpl.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -49,6 +49,7 @@
* Mise a jour: $Date$
* par : $Author$
*/
+@Deprecated
public class ServiceEmailImpl extends ServiceEmailAbstract {
private static final Log log = LogFactory.getLog(ServiceEmailImpl.class);
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceFavorite.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceFavorite.java 2012-01-23 22:27:46 UTC (rev 3108)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceFavorite.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -32,6 +32,7 @@
import org.chorem.pollen.entity.UserAccount;
import org.nuiton.topia.framework.EntityFilter;
+@Deprecated
public interface ServiceFavorite {
void createFavoriteParticipant(FavoriteParticipant participant) throws PollenException, PollenBusinessException;
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceFavoriteAbstract.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceFavoriteAbstract.java 2012-01-23 22:27:46 UTC (rev 3108)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceFavoriteAbstract.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -35,6 +35,7 @@
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.framework.EntityFilter;
+@Deprecated
public abstract class ServiceFavoriteAbstract implements ServiceFavorite {
protected abstract TopiaContext beginTransaction() throws TopiaException;
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceFavoriteImpl.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceFavoriteImpl.java 2012-01-23 22:27:46 UTC (rev 3108)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceFavoriteImpl.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -57,6 +57,7 @@
* @author fdesbois $Id: ServiceFavoriteImpl.java 2996 2010-05-14 12:06:15Z
* fdesbois $
*/
+@Deprecated
public class ServiceFavoriteImpl extends ServiceFavoriteAbstract {
private Log log = LogFactory.getLog(ServiceUserImpl.class);
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServicePoll.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServicePoll.java 2012-01-23 22:27:46 UTC (rev 3108)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServicePoll.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -37,6 +37,7 @@
import org.chorem.pollen.entity.UserAccount;
import org.nuiton.topia.framework.EntityFilter;
+@Deprecated
public interface ServicePoll {
/**
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServicePollAbstract.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServicePollAbstract.java 2012-01-23 22:27:46 UTC (rev 3108)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServicePollAbstract.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -41,6 +41,7 @@
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.framework.EntityFilter;
+@Deprecated
public abstract class ServicePollAbstract implements ServicePoll {
protected abstract TopiaContext beginTransaction() throws TopiaException;
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServicePollImpl.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServicePollImpl.java 2012-01-23 22:27:46 UTC (rev 3108)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServicePollImpl.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -72,6 +72,7 @@
* @author fdesbois
* $Id$
*/
+@Deprecated
public class ServicePollImpl extends ServicePollAbstract {
private static final Log log = LogFactory.getLog(ServicePollImpl.class);
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceUserAbstract.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceUserAbstract.java 2012-01-23 22:27:46 UTC (rev 3108)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceUserAbstract.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -34,6 +34,7 @@
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.framework.EntityFilter;
+@Deprecated
public abstract class ServiceUserAbstract implements ServiceUser {
protected abstract TopiaContext beginTransaction() throws TopiaException;
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceUserImpl.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceUserImpl.java 2012-01-23 22:27:46 UTC (rev 3108)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceUserImpl.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -58,6 +58,7 @@
* Mise a jour: $Date$
* par : $Author$
*/
+@Deprecated
public class ServiceUserImpl extends ServiceUserAbstract {
private Log log = LogFactory.getLog(ServiceUserImpl.class);
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceVote.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceVote.java 2012-01-23 22:27:46 UTC (rev 3108)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceVote.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -33,6 +33,7 @@
import org.chorem.pollen.entity.Vote;
import org.nuiton.topia.framework.EntityFilter;
+@Deprecated
public interface ServiceVote {
boolean canVote(Poll poll, PollAccount participant) throws PollenException;
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceVoteAbstract.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceVoteAbstract.java 2012-01-23 22:27:46 UTC (rev 3108)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceVoteAbstract.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -36,6 +36,7 @@
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.framework.EntityFilter;
+@Deprecated
public abstract class ServiceVoteAbstract implements ServiceVote {
protected abstract TopiaContext beginTransaction() throws TopiaException;
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceVoteImpl.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceVoteImpl.java 2012-01-23 22:27:46 UTC (rev 3108)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceVoteImpl.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -56,6 +56,7 @@
* @author fdesbois <fdesbois(a)codelutin.com>
* @version $Id$
*/
+@Deprecated
public class ServiceVoteImpl extends ServiceVoteAbstract {
private static final Log log = LogFactory.getLog(ServiceVoteImpl.class);
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/FavoriteService.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/FavoriteService.java 2012-01-23 22:27:46 UTC (rev 3108)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/FavoriteService.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -23,42 +23,77 @@
*/
package org.chorem.pollen.services;
-import org.chorem.pollen.PollenBusinessException;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.pollen.PollenDAOHelper;
+import org.chorem.pollen.PollenQueryHelper;
import org.chorem.pollen.PollenTechnicalException;
import org.chorem.pollen.entity.FavoriteList;
+import org.chorem.pollen.entity.FavoriteListDAO;
+import org.chorem.pollen.entity.FavoriteListImpl;
import org.chorem.pollen.entity.FavoriteParticipant;
+import org.chorem.pollen.entity.FavoriteParticipantDAO;
+import org.chorem.pollen.entity.FavoriteParticipantImpl;
import org.chorem.pollen.entity.UserAccount;
-import org.chorem.pollen.service.legacy.ServiceFavoriteImpl;
+import org.chorem.pollen.services.exceptions.FavoriteListAlreadyExistException;
+import org.chorem.pollen.services.exceptions.ParticipantAlreadyFoundInListException;
+import org.chorem.pollen.services.exceptions.ParticipantExistWithoutMailException;
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.framework.EntityFilter;
+import org.nuiton.topia.framework.TopiaQuery;
+import org.nuiton.topia.persistence.TopiaEntity;
import java.util.List;
import java.util.Map;
public class FavoriteService extends PollenServiceSupport {
- public void createFavoriteParticipant(FavoriteParticipant participant) throws PollenBusinessException {
- ServiceFavoriteImpl service = new ServiceFavoriteImpl();
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(FavoriteService.class);
+
+ public void createFavoriteParticipant(FavoriteParticipant participant) throws ParticipantExistWithoutMailException, ParticipantAlreadyFoundInListException {
try {
- service.executeCreateFavoriteParticipant(getTransaction(), participant);
+ FavoriteParticipantDAO dao =
+ PollenDAOHelper.getFavoriteParticipantDAO(getTransaction());
+
+ checkFavoriteParticipant(dao, participant);
+
+ // Create newParticipant with naturalId
+ FavoriteParticipant result =
+ dao.create(participant.getName(),
+ participant.getEmail(),
+ participant.getFavoriteList());
+
+ // Set other field
+ result.setWeight(participant.getWeight());
} catch (TopiaException e) {
throw new PollenTechnicalException(e);
}
}
public void deleteFavoriteParticipant(String id) {
- ServiceFavoriteImpl service = new ServiceFavoriteImpl();
try {
- service.executeDeleteFavoriteParticipant(getTransaction(), id);
+ FavoriteParticipantDAO dao =
+ PollenDAOHelper.getFavoriteParticipantDAO(getTransaction());
+
+ FavoriteParticipant participantLoaded = dao.findByTopiaId(id);
+ dao.delete(participantLoaded);
} catch (TopiaException e) {
throw new PollenTechnicalException(e);
}
}
public FavoriteParticipant getFavoriteParticipant(String id) {
- ServiceFavoriteImpl service = new ServiceFavoriteImpl();
try {
- FavoriteParticipant result = service.executeGetFavoriteParticipant(getTransaction(), id);
+ FavoriteParticipantDAO dao =
+ PollenDAOHelper.getFavoriteParticipantDAO(getTransaction());
+
+ FavoriteParticipant result = dao.findByTopiaId(id);
+ //No more needed
+// // Load parent list
+// result.getFavoriteList();
+
return result;
} catch (TopiaException e) {
throw new PollenTechnicalException(e);
@@ -66,19 +101,37 @@
}
public Map<String, FavoriteParticipant> getFavoriteParticipants(EntityFilter filter) {
- ServiceFavoriteImpl service = new ServiceFavoriteImpl();
try {
- Map<String, FavoriteParticipant> result = service.executeGetFavoriteParticipants(getTransaction(), filter);
- return result;
+ FavoriteParticipantDAO dao =
+ PollenDAOHelper.getFavoriteParticipantDAO(getTransaction());
+
+ PollenQueryHelper.FavoriteParticipantProperty participantProperty =
+ PollenQueryHelper.newFavoriteParticipantProperty();
+
+ TopiaQuery query = dao.createQueryFindAllByFavoriteList(filter);
+
+ if (log.isDebugEnabled()) {
+ log.debug("Query : " + query);
+ }
+
+ query.addLoad(participantProperty.favoriteList());
+
+ Map<String, FavoriteParticipant> results =
+ dao.findAllMappedByQuery(query);
+
+ return results;
} catch (TopiaException e) {
throw new PollenTechnicalException(e);
}
}
public List<FavoriteList> getFavoriteLists(UserAccount user) {
- ServiceFavoriteImpl service = new ServiceFavoriteImpl();
try {
- List<FavoriteList> result = service.executeGetFavoriteLists(getTransaction(), user);
+ FavoriteListDAO dao =
+ PollenDAOHelper.getFavoriteListDAO(getTransaction());
+
+ List<FavoriteList> result = dao.findAllByUserAccount(user);
+
return result;
} catch (TopiaException e) {
throw new PollenTechnicalException(e);
@@ -86,27 +139,44 @@
}
public void deleteFavoriteList(FavoriteList list) {
- ServiceFavoriteImpl service = new ServiceFavoriteImpl();
try {
- service.executeDeleteFavoriteList(getTransaction(), list);
+ FavoriteListDAO dao =
+ PollenDAOHelper.getFavoriteListDAO(getTransaction());
+
+ FavoriteList listLoaded = dao.findByTopiaId(list.getId());
+ dao.delete(listLoaded);
} catch (TopiaException e) {
throw new PollenTechnicalException(e);
}
}
- public void createFavoriteList(FavoriteList list) throws PollenBusinessException {
- ServiceFavoriteImpl service = new ServiceFavoriteImpl();
+ public void createFavoriteList(FavoriteList list) throws FavoriteListAlreadyExistException {
try {
- service.executeCreateFavoriteList(getTransaction(), list);
+ FavoriteListDAO dao =
+ PollenDAOHelper.getFavoriteListDAO(getTransaction());
+
+ // check favoriteList name exist for user
+ UserAccount user = list.getUserAccount();
+
+ // existing list found
+ if (dao.existByNaturalId(list.getName(), user)) {
+ throw new FavoriteListAlreadyExistException();
+ }
+
+ dao.create(list.getName(), list.getUserAccount());
} catch (TopiaException e) {
throw new PollenTechnicalException(e);
}
}
public int getNbFavoriteParticipants(EntityFilter filter) {
- ServiceFavoriteImpl service = new ServiceFavoriteImpl();
try {
- int result = service.executeGetNbFavoriteParticipants(getTransaction(), filter);
+ FavoriteParticipantDAO dao =
+ PollenDAOHelper.getFavoriteParticipantDAO(getTransaction());
+
+ TopiaQuery query = dao.createQueryFindAllByFavoriteList(filter);
+
+ int result = dao.countByQuery(query);
return result;
} catch (TopiaException e) {
throw new PollenTechnicalException(e);
@@ -114,23 +184,75 @@
}
public FavoriteParticipant getNewFavoriteParticipant(FavoriteList list) {
- ServiceFavoriteImpl service = new ServiceFavoriteImpl();
- FavoriteParticipant result = service.executeGetNewFavoriteParticipant(list);
+ FavoriteParticipant result = new FavoriteParticipantImpl();
+ result.setFavoriteList(list);
+ result.setWeight(1.);
return result;
}
public FavoriteList getNewFavoriteList(UserAccount user) {
- ServiceFavoriteImpl service = new ServiceFavoriteImpl();
- FavoriteList result = service.executeGetNewFavoriteList(user);
+ FavoriteList result = new FavoriteListImpl();
+ result.setUserAccount(user);
return result;
}
- public void updateFavoriteParticipant(FavoriteParticipant participant) throws PollenBusinessException {
- ServiceFavoriteImpl service = new ServiceFavoriteImpl();
+ public void updateFavoriteParticipant(FavoriteParticipant participant) throws ParticipantExistWithoutMailException, ParticipantAlreadyFoundInListException {
try {
- service.executeUpdateFavoriteParticipant(getTransaction(), participant);
+ FavoriteParticipantDAO dao =
+ PollenDAOHelper.getFavoriteParticipantDAO(getTransaction());
+
+ checkFavoriteParticipant(dao, participant);
+
+ FavoriteParticipant participantLoaded =
+ dao.findByTopiaId(participant.getId());
+
+ // Set all fields except favoriteList that can't be changed
+ participantLoaded.setName(participant.getName());
+ participantLoaded.setEmail(participant.getEmail());
+ participantLoaded.setWeight(participant.getWeight());
+
+ dao.update(participantLoaded);
} catch (TopiaException e) {
throw new PollenTechnicalException(e);
}
}
+
+ /**
+ * Check if the {@code participant} doesn't already exists with same email,
+ * name and favoriteList.
+ *
+ * @param dao used to verify the existing participant
+ * @param participant FavoriteParticipant to check
+ * @throws TopiaException for technical errors from ToPIA
+ * @throws ParticipantAlreadyFoundInListException
+ * if a participant already exist in list
+ * @throws ParticipantExistWithoutMailException
+ * if a participan was found without email
+ */
+ protected void checkFavoriteParticipant(FavoriteParticipantDAO dao,
+ FavoriteParticipant participant)
+ throws TopiaException, ParticipantExistWithoutMailException, ParticipantAlreadyFoundInListException {
+
+ FavoriteList list = participant.getFavoriteList();
+
+ TopiaQuery query = dao.createQuery().
+ addEquals(FavoriteParticipant.PROPERTY_FAVORITE_LIST, list).
+ addEquals(FavoriteParticipant.PROPERTY_NAME, participant.getName()).
+ addEquals(FavoriteParticipant.PROPERTY_EMAIL, participant.getEmail());
+
+ // Check only on entities different from the one in argument
+ if (StringUtils.isNotEmpty(participant.getId())) {
+ query.addWhere(TopiaEntity.TOPIA_ID, TopiaQuery.Op.NEQ, participant.getId());
+ }
+
+ // existing participant found
+ if (dao.existByQuery(query)) {
+ // The error type (message) depends on email nullity
+ if (participant.getEmail() == null) {
+ throw new ParticipantExistWithoutMailException();
+ } else {
+ throw new ParticipantAlreadyFoundInListException();
+ }
+ }
+ }
}
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/PollService.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/PollService.java 2012-01-23 22:27:46 UTC (rev 3108)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/PollService.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -24,28 +24,54 @@
package org.chorem.pollen.services;
import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
-import org.chorem.pollen.PollenBusinessException;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.pollen.PollenBinderHelper;
+import org.chorem.pollen.PollenDAOHelper;
import org.chorem.pollen.PollenException;
+import org.chorem.pollen.PollenQueryHelper;
import org.chorem.pollen.PollenTechnicalException;
import org.chorem.pollen.bean.UserPoll;
+import org.chorem.pollen.common.ChoiceType;
+import org.chorem.pollen.common.PollType;
+import org.chorem.pollen.common.VoteCountingType;
import org.chorem.pollen.entity.Choice;
+import org.chorem.pollen.entity.ChoiceDAO;
+import org.chorem.pollen.entity.ChoiceImpl;
import org.chorem.pollen.entity.Comment;
+import org.chorem.pollen.entity.CommentDAO;
+import org.chorem.pollen.entity.CommentImpl;
import org.chorem.pollen.entity.Participant;
import org.chorem.pollen.entity.ParticipantList;
import org.chorem.pollen.entity.Poll;
import org.chorem.pollen.entity.PollAccount;
+import org.chorem.pollen.entity.PollAccountDAO;
+import org.chorem.pollen.entity.PollAccountImpl;
+import org.chorem.pollen.entity.PollDAO;
+import org.chorem.pollen.entity.PollImpl;
import org.chorem.pollen.entity.UserAccount;
-import org.chorem.pollen.service.legacy.ServicePollImpl;
+import org.chorem.pollen.services.exceptions.PollAlreadyClosedException;
+import org.chorem.pollen.services.exceptions.PollAlreadyExistException;
+import org.chorem.pollen.services.exceptions.PollNotFoundException;
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.framework.EntityFilter;
+import org.nuiton.topia.framework.TopiaFilter;
+import org.nuiton.topia.framework.TopiaQuery;
+import org.nuiton.topia.persistence.util.TopiaEntityBinder;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
public class PollService extends PollenServiceSupport {
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(PollService.class);
+
/**
* Build a new Poll instance with given {@code user} as administrator
*
@@ -54,8 +80,23 @@
* @throws PollenException
*/
public Poll getNewPoll(UserAccount user) {
- ServicePollImpl service = new ServicePollImpl();
- Poll result = service.executeGetNewPoll(user);
+ Poll result = new PollImpl();
+ result.setChoiceType(ChoiceType.TEXT);
+ result.setVoteCounting(VoteCountingType.NORMAL);
+ result.setType(PollType.FREE);
+ // Initialize creator as an admin for the poll
+ PollAccount creator = new PollAccountImpl();
+ creator.setAdmin(true);
+ if (user != null) {
+ // Link the creator with the user
+ creator.setName(user.getDisplayName());
+ creator.setEmail(user.getEmail());
+ creator.setUserAccount(user);
+ }
+ result.setCreator(creator);
+ // Generate Uid to have a unique poll. Will avoid multi-submit, existing
+ // poll will be check by its uid.
+ result.setUid(serviceContext.createPollenUrlId());
return result;
}
@@ -67,25 +108,135 @@
* @throws PollenException
*/
public Poll getNewPoll(Poll poll) {
- ServicePollImpl service = new ServicePollImpl();
- Poll result = service.executeGetNewPoll(poll);
+ Poll result = new PollImpl();
+ TopiaEntityBinder<Poll> binder = PollenBinderHelper.getSimpleTopiaBinder(Poll.class);
+ //TODO-fdesbois-2010-07-13 : add test and check if exluding only those properties is realistic
+ binder.copyExcluding(poll, result,
+ Poll.PROPERTY_UID,
+ Poll.PROPERTY_CLOSED,
+ Poll.PROPERTY_RESULT,
+ Poll.PROPERTY_POLL_ACCOUNT
+ );
+ // Copy of participants only for no free poll
+ if (poll.getType().isRestrictedOrGroup()) {
+ result.setPollAccount(poll.getPollAccount());
+ }
return result;
}
- public Poll createPoll(Poll poll, Collection<ParticipantList> lists) throws PollenBusinessException {
- ServicePollImpl service = new ServicePollImpl();
+ public Poll createPoll(Poll poll,
+ Collection<ParticipantList> lists) throws PollAlreadyExistException {
try {
- Poll result = service.executeCreatePoll(getTransaction(), Lists.newArrayList(), poll, lists);
- return result;
+ PollDAO dao = PollenDAOHelper.getPollDAO(getTransaction());
+
+ if (dao.existByNaturalId(poll.getUid())) {
+ throw new PollAlreadyExistException();
+ }
+
+ // Create newPoll and copy simple properties from poll source
+ Poll newPoll = createBasicPoll(poll);
+
+ // Create accounts only for non free poll
+ if (!newPoll.getType().isFree()) {
+ // Create accounts depends on pollType and lists argument
+ List<PollAccount> accounts =
+ createPollAccounts(newPoll.getType(), lists);
+ newPoll.setPollAccount(accounts);
+ }
+
+ // Create newPoll choices
+ List<Choice> choices = createPollChoices(poll.getChoice());
+
+ newPoll.setChoice(choices);
+
+ dao.update(newPoll);
+
+ return newPoll;
} catch (TopiaException e) {
throw new PollenTechnicalException(e);
}
}
- public Poll updatePoll(Poll poll) {
- ServicePollImpl service = new ServicePollImpl();
+ public Poll updatePoll(Poll poll) throws PollAlreadyClosedException {
try {
- Poll result = service.executeUpdatePoll(getTransaction(), poll);
+ PollDAO dao = PollenDAOHelper.getPollDAO(getTransaction());
+
+ // Updating a Poll :
+ // - TITLE
+ // - DESCRIPTION
+ // - BEGIN/END DATE
+ // - CHOICE_ADD_ALLOWED
+ // - BEGIN/END ADD CHOICE DATE
+ // - MAX_CHOICE_NB
+ // - CONTINUOUS_RESULTS
+ // - PUBLIC_RESULTS
+ // - ANONYMOUS_VOTE_ALLOWED
+
+ // Anonymous change is not supported (need to manage accounts)
+ // PollType change is not supported (need to manage accounts)
+ // VoteCounting change is not supported (need to manage existing votes)
+
+ // Comments, Results, Choices and Accounts will not be updated here
+
+ // Update only for not started poll :
+ // - VOTE_COUNTING
+ // - CHOICE_TYPE
+ // - CHOICES
+
+ Poll pollToUpdate = dao.findByTopiaId(poll.getTopiaId());
+
+ // Can't update a closed poll
+ if (pollToUpdate.isClosed()) {
+ throw new PollAlreadyClosedException();
+ }
+
+ TopiaEntityBinder<Poll> binder = PollenBinderHelper.getSimpleTopiaBinder(Poll.class);
+
+ // Idea, if we can use Embeddable object for Hibernate, Options will be a good use case
+ binder.copy(poll, pollToUpdate,
+ Poll.PROPERTY_TITLE,
+ Poll.PROPERTY_DESCRIPTION,
+ Poll.PROPERTY_BEGIN_DATE,
+ Poll.PROPERTY_END_DATE,
+ Poll.PROPERTY_ANONYMOUS_VOTE_ALLOWED,
+ Poll.PROPERTY_CHOICE_ADD_ALLOWED,
+ Poll.PROPERTY_BEGIN_CHOICE_DATE,
+ Poll.PROPERTY_END_CHOICE_DATE,
+ Poll.PROPERTY_CONTINUOUS_RESULTS,
+ Poll.PROPERTY_PUBLIC_RESULTS,
+ Poll.PROPERTY_MAX_CHOICE_NB
+ );
+
+ // if not started
+ if (!pollToUpdate.isStarted()) {
+
+ log.debug("Poll is not started, update voteCounting and choices");
+
+ // Update voteCounting is simple when poll have no vote
+ pollToUpdate.setVoteCounting(poll.getVoteCounting());
+
+ // Override choices if type has changed, otherwise the choice entity will automatically be updated
+ if (!pollToUpdate.getChoiceType().equals(poll.getChoiceType())) {
+ pollToUpdate.setChoiceType(poll.getChoiceType());
+
+ ChoiceDAO choiceDAO = PollenDAOHelper.getChoiceDAO(getTransaction());
+ // Clear previous choices, will properly delete orphans
+ pollToUpdate.getChoice().clear();
+ // Create new choices and add them to the poll
+ for (Choice choice : poll.getChoice()) {
+ Choice newChoice = pollToUpdate.addNewChoice(choice.getName(), choice.getDescription());
+ choiceDAO.create(newChoice);
+ }
+ }
+ }
+
+ // If continuous results is now activated, execute a voteCounting
+ if (!pollToUpdate.isContinuousResults() &&
+ poll.isContinuousResults()) {
+ // TODO-fdesbois-2011-07-13 : execute vote counting
+ }
+
+ Poll result = dao.update(pollToUpdate);
return result;
} catch (TopiaException e) {
throw new PollenTechnicalException(e);
@@ -93,70 +244,137 @@
}
public void deletePoll(Poll poll) {
- ServicePollImpl service = new ServicePollImpl();
try {
- service.executeDeletePoll(getTransaction(), poll);
+ PollDAO dao = PollenDAOHelper.getPollDAO(getTransaction());
+ dao.delete(poll);
} catch (TopiaException e) {
throw new PollenTechnicalException(e);
}
}
public boolean deleteChoice(Choice choice) {
- ServicePollImpl service = new ServicePollImpl();
try {
- boolean result = service.executeDeleteChoice(getTransaction(), choice);
- return result;
+ ChoiceDAO dao = PollenDAOHelper.getChoiceDAO(getTransaction());
+ dao.delete(choice);
+ //FIXME tchemit-20120123 Why return true ?
+ return true;
} catch (TopiaException e) {
throw new PollenTechnicalException(e);
}
}
+ //FIXME tchemit-20120123 Replace the filter by a simple PagerBean
public List<UserPoll> getPolls(EntityFilter filter) {
- ServicePollImpl service = new ServicePollImpl();
try {
- List<UserPoll> result = service.executeGetPolls(getTransaction(), filter);
- return result;
+ PollDAO dao = PollenDAOHelper.getPollDAO(getTransaction());
+
+ PollenQueryHelper.PollAccountProperty participantProperty =
+ PollenQueryHelper.newPollAccountChildProperty();
+
+ // Filter can be apply on userAccount as reference
+ TopiaQuery query = dao.createQueryFindAllByUser(filter);
+
+ query.addSelect(participantProperty.$alias());
+
+ log.debug("Query : " + query);
+
+ List<UserPoll> results = retrieveUserPolls(query);
+
+ return results;
} catch (TopiaException e) {
throw new PollenTechnicalException(e);
}
}
+ //FIXME tchemit-20120123 Replace the filter by a simple PagerBean
public List<Comment> getComments(EntityFilter filter) {
- ServicePollImpl service = new ServicePollImpl();
try {
- List<Comment> result = service.executeGetComments(getTransaction(), filter);
- return result;
+ CommentDAO dao = PollenDAOHelper.getCommentDAO(getTransaction());
+
+// String pollAlias = PollenQueryHelper.ALIAS_POLL;
+// String pollCommentProperty =
+// TopiaQuery.getProperty(pollAlias, Poll.PROPERTY_COMMENT);
+// String commentAlias = PollenQueryHelper.ALIAS_COMMENT;
+
+ PollenQueryHelper.PollProperty pollProperty =
+ PollenQueryHelper.newPollProperty();
+ PollenQueryHelper.CommentProperty commentProperty =
+ PollenQueryHelper.newCommentProperty();
+
+ filter.checkReference(Poll.class, true);
+ filter.setReferenceProperty(pollProperty.$alias());
+
+ TopiaQuery query = PollenQueryHelper.createQuery(pollProperty).
+ setSelect(commentProperty.$alias()).
+ addJoin(pollProperty.comment(), commentProperty.$alias(), false).
+ addFilter(filter);
+
+ List<Comment> comments = dao.findAllByQuery(query);
+ return comments;
} catch (TopiaException e) {
throw new PollenTechnicalException(e);
}
}
public ParticipantList getNewPollList() {
- ServicePollImpl service = new ServicePollImpl();
- ParticipantList result = service.executeGetNewPollList();
+ PollAccount result = new PollAccountImpl();
+ result.setList(true);
+ result.setChild(new ArrayList<PollAccount>());
return result;
}
public Participant getNewPollParticipant() {
- ServicePollImpl service = new ServicePollImpl();
- Participant result = service.executeGetNewPollParticipant();
+ PollAccount result = new PollAccountImpl();
+ result.setWeight(1.);
return result;
}
- public Poll getPoll(String pollUid, String... properties) throws PollenBusinessException {
- ServicePollImpl service = new ServicePollImpl();
+ //FIXME tchemit-20120123 Remove the fetch system we don't need it with our transaction management
+ public Poll getPoll(String pollUid, String... properties) throws PollNotFoundException {
try {
- Poll result = service.executeGetPoll(getTransaction(), pollUid, properties);
+ // Property is used to control the alias and dependencies inside the query
+ PollenQueryHelper.PollProperty pollProperty =
+ PollenQueryHelper.newPollProperty();
+
+ // Need to control the alias for fetching, add it to each property
+ String[] fetchProperties = new String[properties.length];
+ for (int i = 0; i < properties.length; i++) {
+ // This will clean properties for fetching
+ fetchProperties[i] = pollProperty.$property(properties[i]);
+ }
+
+ // Create the query using default alias for Poll
+ TopiaQuery query = PollenQueryHelper.createQuery(pollProperty).
+ addFetch(fetchProperties).
+ addEquals(pollProperty.uid(), pollUid);
+
+ PollDAO dao = PollenDAOHelper.getPollDAO(getTransaction());
+ Poll result = dao.findByQuery(query);
+ if (result == null) {
+ throw new PollNotFoundException();
+ }
return result;
} catch (TopiaException e) {
throw new PollenTechnicalException(e);
}
}
+ //FIXME tchemit-20120123 Should check userAccount and pollUid exist ?
public boolean canAdminPoll(String accountUid, String pollUid) {
- ServicePollImpl service = new ServicePollImpl();
try {
- boolean result = service.executeCanAdminPoll(getTransaction(), accountUid, pollUid);
+ PollenQueryHelper.PollProperty pollProperty =
+ PollenQueryHelper.newPollProperty();
+
+ TopiaQuery query = PollenQueryHelper.createQuery(pollProperty).
+ addEquals(pollProperty.uid(), pollUid).
+ addEquals(pollProperty.creatorProperty().uid(), accountUid);
+
+
+ // Note a boolean admin exist in PollAccount, maybe
+ // find the account in lists
+
+ PollDAO dao = PollenDAOHelper.getPollDAO(getTransaction());
+ boolean result = dao.existByQuery(query);
return result;
} catch (TopiaException e) {
throw new PollenTechnicalException(e);
@@ -164,19 +382,26 @@
}
public int getNbTotalPolls() {
- ServicePollImpl service = new ServicePollImpl();
try {
- int result = service.executeGetNbTotalPolls(getTransaction());
- return result;
+ PollDAO dao = PollenDAOHelper.getPollDAO(getTransaction());
+ Long result = dao.count();
+ return result.intValue();
} catch (TopiaException e) {
throw new PollenTechnicalException(e);
}
}
+ //FIXME tchemit-20120123 Remove this from dao, remove EntityFilter...
public int getNbPollsByUser(UserAccount user) {
- ServicePollImpl service = new ServicePollImpl();
try {
- int result = service.executeGetNbPollsByUser(getTransaction(), user);
+ PollDAO dao = PollenDAOHelper.getPollDAO(getTransaction());
+
+ EntityFilter filter = new TopiaFilter();
+ filter.setReference(user);
+ TopiaQuery query = dao.createQueryFindAllByUser(filter);
+
+ int result = dao.countByQuery(query);
+
return result;
} catch (TopiaException e) {
throw new PollenTechnicalException(e);
@@ -184,9 +409,21 @@
}
public List<Poll> getRunningPolls() {
- ServicePollImpl service = new ServicePollImpl();
try {
- List<Poll> result = service.executeGetRunningPolls(getTransaction());
+ PollDAO dao = PollenDAOHelper.getPollDAO(getTransaction());
+
+ // isRunning : isStarted() && !isFinished() && !isClosed()
+
+ Date now = serviceContext.getCurrentTime();
+
+ TopiaQuery query = dao.createQuery().
+ addWhere(Poll.PROPERTY_BEGIN_DATE, TopiaQuery.Op.LE, now).
+ addWhere(Poll.PROPERTY_END_DATE, TopiaQuery.Op.GE, now).
+ addEquals(Poll.PROPERTY_CLOSED, Boolean.FALSE).
+ addOrderDesc(Poll.TOPIA_CREATE_DATE);
+
+ List<Poll> result = dao.findAllByQuery(query);
+
return result;
} catch (TopiaException e) {
throw new PollenTechnicalException(e);
@@ -194,9 +431,12 @@
}
public int getNbComments(Poll poll) {
- ServicePollImpl service = new ServicePollImpl();
try {
- int result = service.executeGetNbComments(getTransaction(), poll);
+ PollDAO dao = PollenDAOHelper.getPollDAO(getTransaction());
+
+ Poll pollFound = dao.findByTopiaId(poll.getTopiaId());
+
+ int result = pollFound.sizeComment();
return result;
} catch (TopiaException e) {
throw new PollenTechnicalException(e);
@@ -204,51 +444,85 @@
}
public Comment createComment(Poll poll, Comment comment) {
- ServicePollImpl service = new ServicePollImpl();
try {
- Comment result = service.executeCreateComment(getTransaction(), poll, comment);
- return result;
+ CommentDAO dao = PollenDAOHelper.getCommentDAO(getTransaction());
+
+ Comment commentCreated = dao.create(
+ Comment.PROPERTY_AUTHOR, comment.getAuthor(),
+ Comment.PROPERTY_COMMENT_DATE, serviceContext.getCurrentTime(),
+ Comment.PROPERTY_TEXT, comment.getText()
+ );
+
+ PollDAO pollDAO = PollenDAOHelper.getPollDAO(getTransaction());
+
+ Poll pollToUpdate = pollDAO.findByTopiaId(poll.getTopiaId());
+
+ pollToUpdate.addComment(commentCreated);
+
+ pollDAO.update(pollToUpdate);
+ return commentCreated;
} catch (TopiaException e) {
throw new PollenTechnicalException(e);
}
}
+ //FIXME tchemit-20120123 Why returning true ?
public boolean deleteComment(Comment comment) {
- ServicePollImpl service = new ServicePollImpl();
try {
- boolean result = service.executeDeleteComment(getTransaction(), comment);
- return result;
+ CommentDAO dao = PollenDAOHelper.getCommentDAO(getTransaction());
+ dao.delete(comment);
+ return true;
} catch (TopiaException e) {
throw new PollenTechnicalException(e);
}
}
public Comment getNewComment(PollAccount account) {
- ServicePollImpl service = new ServicePollImpl();
- Comment result = service.executeGetNewComment(account);
+ Comment result = new CommentImpl();
+ if (account != null) {
+ result.setAuthor(account.getName());
+ }
return result;
}
public Choice createChoice(Poll poll, Choice choice) {
- ServicePollImpl service = new ServicePollImpl();
try {
- Choice result = service.executeCreateChoice(getTransaction(), poll, choice);
- return result;
+ ChoiceDAO dao = PollenDAOHelper.getChoiceDAO(getTransaction());
+
+ Choice choiceCreated = dao.create(
+ Choice.PROPERTY_NAME, choice.getName(),
+ Choice.PROPERTY_DESCRIPTION, choice.getDescription(),
+ Choice.PROPERTY_TYPE, choice.getType()
+ );
+
+ PollDAO pollDAO = PollenDAOHelper.getPollDAO(getTransaction());
+
+ Poll pollToUpdate = pollDAO.findByTopiaId(poll.getTopiaId());
+
+ pollToUpdate.addChoice(choiceCreated);
+
+ pollDAO.update(pollToUpdate);
+
+ return choiceCreated;
} catch (TopiaException e) {
throw new PollenTechnicalException(e);
}
}
public Choice getNewChoice(Poll poll) {
- ServicePollImpl service = new ServicePollImpl();
- Choice result = service.executeGetNewChoice(poll);
+ Choice result = new ChoiceImpl();
+ result.setType(poll.getChoiceType());
return result;
}
public void setPollClosed(Poll poll, boolean closed) throws Exception {
- ServicePollImpl service = new ServicePollImpl();
try {
- service.executeSetPollClosed(getTransaction(), poll, closed);
+ PollDAO dao = PollenDAOHelper.getPollDAO(getTransaction());
+
+ Poll pollToUpdate = dao.findByTopiaId(poll.getTopiaId());
+ pollToUpdate.setClosed(closed);
+
+ dao.update(pollToUpdate);
} catch (TopiaException e) {
throw new PollenTechnicalException(e);
}
@@ -256,9 +530,37 @@
public Poll createBasicPoll(Poll source)
throws TopiaException {
- ServicePollImpl service = new ServicePollImpl();
try {
- Poll result = service.createBasicPoll(getTransaction(), source);
+ PollDAO dao = PollenDAOHelper.getPollDAO(getTransaction());
+
+ PollAccountDAO accountDAO =
+ PollenDAOHelper.getPollAccountDAO(getTransaction());
+
+ // Create newPoll and copy simple properties from poll source
+ Poll result = dao.create(source.getUid());
+
+ // Copy all properties instead of Uid (already set at creation),
+ // Closed (not used in this case) and Creator (managed separately)
+ PollenBinderHelper.getSimpleTopiaBinder(Poll.class).
+ copyExcluding(source, result,
+ Poll.PROPERTY_UID,
+ Poll.PROPERTY_CLOSED,
+ Poll.PROPERTY_CREATOR);
+
+ // Create creator and set him to the poll
+ PollAccount creator = accountDAO.create(
+ serviceContext.createPollenUrlId());
+
+ PollenBinderHelper.getSimpleTopiaBinder(PollAccount.class).
+ copy(source.getCreator(), creator,
+ PollAccount.PROPERTY_NAME,
+ PollAccount.PROPERTY_EMAIL,
+// PollAccount.WEIGHT,
+ PollAccount.PROPERTY_ADMIN,
+ PollAccount.PROPERTY_USER_ACCOUNT);
+ accountDAO.update(creator);
+
+ result.setCreator(creator);
return result;
} catch (TopiaException e) {
throw new PollenTechnicalException(e);
@@ -295,6 +597,120 @@
Preconditions.checkArgument(poll.getEndChoiceDate().after(poll.getBeginChoiceDate()));
}
}
+ }
+ protected List<PollAccount> createPollAccounts(PollType type,
+ Collection<ParticipantList> lists)
+ throws TopiaException, IllegalArgumentException {
+
+ List<PollAccount> results = new ArrayList<PollAccount>();
+
+ PollAccountDAO accountDAO =
+ PollenDAOHelper.getPollAccountDAO(getTransaction());
+
+ switch (type) {
+ case RESTRICTED:
+ if (CollectionUtils.isEmpty(lists)) {
+ throw new IllegalArgumentException("lists can't be empty" +
+ " for restricted poll");
+ }
+ // Create accounts only on first participant list
+ results = createPersonAccounts(accountDAO,
+ lists.iterator().next());
+ break;
+ case GROUP:
+ if (CollectionUtils.isEmpty(lists)) {
+ throw new IllegalArgumentException("lists can't be empty" +
+ " for group poll");
+ }
+
+ for (ParticipantList list : lists) {
+ // Create the accountList
+ PollAccount accountList = accountDAO.create(
+ serviceContext.createPollenUrlId());
+ accountList.setList(true);
+ accountList.setName(list.getName());
+
+ // Create account children
+ List<PollAccount> accounts =
+ createPersonAccounts(accountDAO, list);
+ accountList.setChild(accounts);
+
+ // Add the accountList to the results
+ results.add(accountList);
+ }
+ }
+ return results;
}
+
+ protected List<PollAccount> createPersonAccounts(PollAccountDAO dao,
+ ParticipantList list)
+ throws TopiaException {
+
+ List<PollAccount> results = new ArrayList<PollAccount>();
+
+ for (Participant participant : list.getParticipants()) {
+ String accountUid = serviceContext.createPollenUrlId();
+ PollAccount account = dao.create(accountUid);
+ account.setName(participant.getName());
+ account.setEmail(participant.getEmail());
+ account.setWeight(participant.getWeight());
+ dao.update(account);
+ results.add(account);
+ }
+ return results;
+ }
+
+ protected List<Choice> createPollChoices(List<Choice> source)
+ throws TopiaException {
+
+ ChoiceDAO dao = PollenDAOHelper.getChoiceDAO(getTransaction());
+
+ List<Choice> results = new ArrayList<Choice>();
+
+ for (Choice choice : source) {
+ Choice newChoice = dao.create();
+ PollenBinderHelper.getSimpleTopiaBinder(Choice.class).
+ copy(choice, newChoice);
+ results.add(newChoice);
+ }
+ return results;
+ }
+
+ //FIXME tchemit-20120123 : help me to destroy this :(
+ protected List<UserPoll> retrieveUserPolls(TopiaQuery query)
+ throws TopiaException {
+
+ List<UserPoll> results = new ArrayList<UserPoll>();
+
+ Map<String, UserPoll> pollsCache =
+ new HashMap<String, UserPoll>();
+
+
+ List<Object[]> queryResults = getTransaction().findByQuery(query);
+ for (Object[] row : queryResults) {
+ Poll poll = (Poll) row[0];
+ PollAccount account = (PollAccount) row[1];
+ if (log.isDebugEnabled()) {
+ log.debug("account : " + account.getUid() + " : " +
+ account.getName() +
+ " list(" + account.isList() + ")" +
+ " admin(" + account.isAdmin() + ")" +
+ " for poll " + poll.getTitle());
+ }
+
+ UserPoll userPoll = pollsCache.get(poll.getTopiaId());
+
+ if (userPoll == null) {
+ userPoll = new UserPoll();
+ userPoll.setPoll(poll);
+ results.add(userPoll);
+ pollsCache.put(poll.getTopiaId(), userPoll);
+ }
+
+ userPoll.addAccount(account);
+ }
+
+ return results;
+ }
}
Deleted: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserEmailAlreadyUsedException.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserEmailAlreadyUsedException.java 2012-01-23 22:27:46 UTC (rev 3108)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserEmailAlreadyUsedException.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -1,36 +0,0 @@
-/*
- * #%L
- * Pollen :: Services
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2009 - 2012 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%
- */
-package org.chorem.pollen.services;
-
-/**
- * TODO
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.0
- */
-public class UserEmailAlreadyUsedException extends Exception {
-
- private static final long serialVersionUID = 1L;
-
-}
Deleted: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserInvalidPasswordException.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserInvalidPasswordException.java 2012-01-23 22:27:46 UTC (rev 3108)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserInvalidPasswordException.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -1,36 +0,0 @@
-/*
- * #%L
- * Pollen :: Services
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2009 - 2012 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%
- */
-package org.chorem.pollen.services;
-
-/**
- * TODO
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.0
- */
-public class UserInvalidPasswordException extends Exception {
-
- private static final long serialVersionUID = 1L;
-
-}
Deleted: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserLoginAlreadyUsedException.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserLoginAlreadyUsedException.java 2012-01-23 22:27:46 UTC (rev 3108)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserLoginAlreadyUsedException.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -1,36 +0,0 @@
-/*
- * #%L
- * Pollen :: Services
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2009 - 2012 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%
- */
-package org.chorem.pollen.services;
-
-/**
- * TODO
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.0
- */
-public class UserLoginAlreadyUsedException extends Exception {
-
- private static final long serialVersionUID = 1L;
-
-}
Deleted: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserNotFoundException.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserNotFoundException.java 2012-01-23 22:27:46 UTC (rev 3108)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserNotFoundException.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -1,36 +0,0 @@
-/*
- * #%L
- * Pollen :: Services
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2009 - 2012 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%
- */
-package org.chorem.pollen.services;
-
-/**
- * TODO
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.0
- */
-public class UserNotFoundException extends Exception {
-
- private static final long serialVersionUID = 1L;
-
-}
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserService.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserService.java 2012-01-23 22:27:46 UTC (rev 3108)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserService.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -23,22 +23,22 @@
*/
package org.chorem.pollen.services;
-import com.google.common.collect.Maps;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.pollen.PollenBinderHelper;
import org.chorem.pollen.PollenDAOHelper;
-import org.chorem.pollen.PollenException;
-import org.chorem.pollen.PollenFunctions;
import org.chorem.pollen.PollenTechnicalException;
import org.chorem.pollen.bean.PollenEmail;
import org.chorem.pollen.entity.UserAccount;
import org.chorem.pollen.entity.UserAccountDAO;
import org.chorem.pollen.entity.UserAccountImpl;
+import org.chorem.pollen.services.exceptions.UserEmailAlreadyUsedException;
+import org.chorem.pollen.services.exceptions.UserInvalidPasswordException;
+import org.chorem.pollen.services.exceptions.UserLoginAlreadyUsedException;
+import org.chorem.pollen.services.exceptions.UserNotFoundException;
import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.framework.EntityFilter;
import org.nuiton.topia.framework.TopiaQuery;
import org.nuiton.topia.persistence.util.TopiaEntityBinder;
import org.nuiton.util.PagerUtil;
@@ -48,7 +48,6 @@
import java.net.URL;
import java.util.List;
import java.util.Locale;
-import java.util.Map;
import static org.nuiton.i18n.I18n._;
import static org.nuiton.i18n.I18n.l_;
@@ -148,17 +147,20 @@
UserAccount userToUpdate = dao.findByTopiaId(user.getTopiaId());
// Do not manage password for an admin update
- // neither if password was not asked to change
- if (!byAdmin && StringUtils.isNotEmpty(newPassword)) {
+ if (!byAdmin) {
- // Check the password
+ // Check original password
String encodedPassword = encodePassword(user.getPassword());
if (!encodedPassword.equals(userToUpdate.getPassword())) {
throw new UserInvalidPasswordException();
}
- String newEncodedPassword = encodePassword(newPassword);
- userToUpdate.setPassword(newEncodedPassword);
+ if (StringUtils.isNotEmpty(newPassword)) {
+
+ // encode new password and store it in user account
+ String newEncodedPassword = encodePassword(newPassword);
+ userToUpdate.setPassword(newEncodedPassword);
+ }
}
// In case of email change, check if an other user has not already
@@ -183,7 +185,7 @@
}
}
- public UserAccount getNewUser() throws PollenException {
+ public UserAccount getNewUser() {
UserAccount result = new UserAccountImpl();
return result;
}
@@ -216,22 +218,6 @@
}
}
- public Map<String, UserAccount> getUsers(EntityFilter filter) {
-
- try {
- UserAccountDAO dao = PollenDAOHelper.getUserAccountDAO(getTransaction());
-
- TopiaQuery query = dao.createQuery().addFilter(filter);
-
- List<UserAccount> users = dao.findAllByQuery(query);
- Map<String, UserAccount> result =
- Maps.uniqueIndex(users, PollenFunctions.USER_BY_LOGIN);
- return result;
- } catch (TopiaException e) {
- throw new PollenTechnicalException(e);
- }
- }
-
public int getNbUsers() {
try {
UserAccountDAO dao = PollenDAOHelper.getUserAccountDAO(getTransaction());
@@ -242,10 +228,6 @@
}
}
- public String encodePassword(String password) {
- return StringUtil.encodeMD5(password);
- }
-
public void createDefaultUsers() {
UserAccount user = getNewUser();
user.setAdmin(true);
@@ -254,7 +236,7 @@
user.setEmail(getConfiguration().getAdminEmail());
user.setNewPassword(getConfiguration().getAdminPassword());
try {
- createUser(user,false, null);
+ createUser(user, false, null);
if (log.isInfoEnabled()) {
log.info(_("pollen.info.admin.created", login));
}
@@ -266,6 +248,10 @@
}
}
+ protected String encodePassword(String password) {
+ return StringUtil.encodeMD5(password);
+ }
+
/**
* Copy {@code source} user account to {@code destination} one.
* The email is lower cased in the {@code destination} user account.
@@ -285,12 +271,5 @@
// Don't keep case for email
destination.setEmail(StringUtils.lowerCase(source.getEmail()));
-
-// // Manage new password if needed
-// String password = source.getNewPassword();
-// if (StringUtils.isNotEmpty(password)) {
-//// destination.setPassword(context.encodePassword(password));
-// destination.setPassword(encodePassword(password));
-// }
}
}
Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/VoteService.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/VoteService.java 2012-01-23 22:27:46 UTC (rev 3108)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/VoteService.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -23,26 +23,80 @@
*/
package org.chorem.pollen.services;
-import org.chorem.pollen.PollenBusinessException;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.pollen.PollenBinderHelper;
+import org.chorem.pollen.PollenDAOHelper;
import org.chorem.pollen.PollenException;
+import org.chorem.pollen.PollenQueryHelper;
import org.chorem.pollen.PollenTechnicalException;
import org.chorem.pollen.entity.Choice;
import org.chorem.pollen.entity.Poll;
import org.chorem.pollen.entity.PollAccount;
+import org.chorem.pollen.entity.PollAccountDAO;
+import org.chorem.pollen.entity.PollAccountImpl;
+import org.chorem.pollen.entity.PollDAO;
import org.chorem.pollen.entity.UserAccount;
import org.chorem.pollen.entity.Vote;
-import org.chorem.pollen.service.legacy.ServiceVoteImpl;
+import org.chorem.pollen.entity.VoteDAO;
+import org.chorem.pollen.entity.VoteImpl;
+import org.chorem.pollen.services.exceptions.VoteDoubloonException;
+import org.chorem.pollen.services.exceptions.VoteNotAllowedException;
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.framework.EntityFilter;
+import org.nuiton.topia.framework.TopiaFilter;
+import org.nuiton.topia.framework.TopiaQuery;
+import org.nuiton.topia.persistence.util.TopiaEntityBinder;
import java.util.List;
public class VoteService extends PollenServiceSupport {
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(VoteService.class);
+
public boolean canVote(Poll poll, PollAccount participant) {
- ServiceVoteImpl service = new ServiceVoteImpl();
try {
- boolean result = service.executeCanVote(getTransaction(), poll, participant);
+ if (log.isDebugEnabled()) {
+ log.debug("Poll started : " + poll.isStarted());
+ log.debug("Poll finished : " + poll.isFinished());
+ log.debug("Poll closed : " + poll.isClosed());
+ }
+ boolean result = true;
+ if (!poll.isRunning()) {
+ if (log.isInfoEnabled()) {
+ log.info("Poll is no longer running... Participant can't vote");
+ }
+ result = false;
+ // Creator can't vote
+ } else if (poll.getCreator().equals(participant)) {
+ return false;
+ } else if (poll.getType().isRestrictedOrGroup()) {
+ if (log.isInfoEnabled()) {
+ log.info("Poll is restricted... Participant need to be identified");
+ }
+
+ PollAccountDAO dao =
+ PollenDAOHelper.getPollAccountDAO(getTransaction());
+
+ TopiaQuery query = dao.createQueryFindAllParticipantsByPoll(poll);
+
+ String participantAlias = PollenQueryHelper.ALIAS_POLL_ACCOUNT_CHILD;
+
+ String pollCreatorProperty =
+ TopiaQuery.getProperty(PollenQueryHelper.ALIAS_POLL,
+ Poll.PROPERTY_CREATOR);
+
+ query.addEquals(participantAlias, participant).
+ addWhere(pollCreatorProperty, TopiaQuery.Op.NEQ, participant);
+
+ if (log.isDebugEnabled()) {
+ log.debug("Query : " + query);
+ }
+
+ result = dao.existByQuery(query);
+ }
return result;
} catch (TopiaException e) {
throw new PollenTechnicalException(e);
@@ -50,15 +104,29 @@
}
public PollAccount getNewPollAccount(UserAccount user) {
- ServiceVoteImpl service = new ServiceVoteImpl();
- PollAccount result = service.executeGetNewPollAccount(user);
+ PollAccount result = new PollAccountImpl();
+ if (user != null) {
+ result.setName(user.getDisplayName());
+ result.setEmail(user.getEmail());
+ result.setUserAccount(user);
+ }
return result;
}
public PollAccount getPollAccount(String accountUid) {
- ServiceVoteImpl service = new ServiceVoteImpl();
try {
- PollAccount result = service.executeGetPollAccount(getTransaction(), accountUid);
+ PollenQueryHelper.PollAccountProperty accountProperty =
+ PollenQueryHelper.newPollAccountProperty();
+
+ TopiaQuery query = PollenQueryHelper.createQuery(accountProperty).
+ addEquals(accountProperty.uid(), accountUid).
+ // Need fetching account votes to edit them
+ addFetch(accountProperty.choiceVote());
+
+ PollAccount result =
+ PollenDAOHelper.getPollAccountDAO(getTransaction()).
+ findByQuery(query);
+
return result;
} catch (TopiaException e) {
throw new PollenTechnicalException(e);
@@ -66,28 +134,80 @@
}
public List<PollAccount> getVotes(EntityFilter filter) {
- ServiceVoteImpl service = new ServiceVoteImpl();
try {
- List<PollAccount> result = service.executeGetVotes(getTransaction(), filter);
- return result;
+ PollAccountDAO dao = PollenDAOHelper.getPollAccountDAO(getTransaction());
+
+// String participantChoiceProperty =
+// TopiaQuery.getProperty(PollenQueryHelper.ALIAS_POLL_ACCOUNT,
+// PollAccount.PROPERTY_CHOICE_VOTE,
+// Vote.PROPERTY_CHOICE);
+//
+// TopiaQuery query = dao.createQueryFindAllByPoll(filter).
+// addDistinct().
+// addFetch(participantChoiceProperty);
+
+ PollenQueryHelper.PollAccountProperty accountProperty =
+ PollenQueryHelper.newPollAccountProperty();
+
+ TopiaQuery query = dao.createQueryFindAllByPoll(filter).
+ addDistinct().
+ addFetch(accountProperty.choiceVoteProperty().choice());
+
+ List<PollAccount> results = dao.findAllByQuery(query);
+
+ if (log.isDebugEnabled()) {
+ log.debug("Query : " + query);
+ }
+
+ return results;
} catch (TopiaException e) {
throw new PollenTechnicalException(e);
}
}
public void deleteVote(Poll poll, PollAccount participant) {
- ServiceVoteImpl service = new ServiceVoteImpl();
try {
- service.executeDeleteVote(getTransaction(), poll, participant);
+ // For free poll, delete the participant
+ // For other types, delete all votes and set voteDate to null
+
+ PollAccountDAO dao =
+ PollenDAOHelper.getPollAccountDAO(getTransaction());
+
+ if (poll.getType().isFree()) {
+
+ PollAccount participantToDelete =
+ dao.findByTopiaId(participant.getTopiaId());
+
+ dao.delete(participantToDelete);
+
+ } else if (poll.getType().isRestrictedOrGroup()) {
+
+ PollAccount participantToUpdate =
+ dao.findByTopiaId(participant.getTopiaId());
+
+ // Remove all votes deleted by cascade
+ participantToUpdate.clearChoiceVote();
+ // Reset date, the participant is considered like he has not alerady
+ // voted
+ participantToUpdate.setVoteDate(null);
+
+ dao.update(participantToUpdate);
+ }
} catch (TopiaException e) {
throw new PollenTechnicalException(e);
}
}
public int getNbVotes(Poll poll) throws PollenException {
- ServiceVoteImpl service = new ServiceVoteImpl();
try {
- int result = service.executeGetNbVotes(getTransaction(), poll);
+ PollAccountDAO dao =
+ PollenDAOHelper.getPollAccountDAO(getTransaction());
+
+ EntityFilter filter = new TopiaFilter();
+ filter.setReference(poll);
+ TopiaQuery query = dao.createQueryFindAllByPoll(filter);
+
+ int result = dao.countByQuery(query);
return result;
} catch (TopiaException e) {
throw new PollenTechnicalException(e);
@@ -95,29 +215,209 @@
}
public Vote getNewVote(Choice choice) {
- ServiceVoteImpl service = new ServiceVoteImpl();
- Vote result = service.executeGetNewVote(choice);
+ Vote result = new VoteImpl();
+ result.setChoice(choice);
return result;
}
- public PollAccount saveVote(Poll poll, PollAccount participant) throws PollenBusinessException {
- ServiceVoteImpl service = new ServiceVoteImpl();
+ public PollAccount saveVote(Poll poll, PollAccount participant) throws VoteNotAllowedException, VoteDoubloonException {
try {
- PollAccount result = service.executeSaveVote(getTransaction(), poll, participant);
+ // 1- executeCanVote(transaction, poll, participant);
+ // 2- generate uid if needed
+ // 3- update or create participant
+ // 4- add participant in the poll if needed
+ // 5- save only votes with voteValue != 0 : update/create/delete
+ // 6- execute calcul for continuousResults poll
+
+ // NEED test :
+ // need existing poll with choices
+ // getNewPollAccount
+ // set some votes for poll choices
+ // saveVote
+
+ PollAccount result;
+ if (canVote(poll, participant)) {
+
+ PollAccountDAO dao = PollenDAOHelper.getPollAccountDAO(getTransaction());
+
+ checkParticipantDoubloons(dao, poll, participant);
+
+ PollAccount participantToSave =
+ dao.findByTopiaId(participant.getTopiaId());
+
+ // canVote method check the existence of participant for a
+ // restricted poll, so the create case is only for FREE poll.
+ if (participantToSave == null) {
+ if (log.isInfoEnabled()) {
+ log.info("Create new participant for FREE poll");
+ }
+ participantToSave = createNewParticipant(poll);
+ }
+
+ // Copy data (care about anonymous case)
+ copyPollAccount(participant, participantToSave);
+
+ // Update vote date
+ participantToSave.setVoteDate(serviceContext.getCurrentTime());
+
+ if (log.isDebugEnabled()) {
+ log.debug("Vote " + participantToSave.getName() +
+ " updated : " + participantToSave.getVoteDate());
+ }
+
+ // Save votes
+ saveParticipantVotes(participant, participantToSave);
+
+ dao.update(participantToSave);
+
+ result = participantToSave;
+
+ // TODO-fdesbois-2010-05-27 : execute vote counting if poll.isContinuousResults()
+
+ } else {
+ throw new VoteNotAllowedException();
+ }
+
return result;
} catch (TopiaException e) {
throw new PollenTechnicalException(e);
}
}
+ //FIXME tchemit-20120123 : what is the need ? :(
public PollAccount findPollAccount(Poll poll, UserAccount user) {
- ServiceVoteImpl service = new ServiceVoteImpl();
- try {
- PollAccount result = service.executeFindPollAccount(getTransaction(), poll, user);
- return result;
- } catch (Exception e) {
- throw new PollenTechnicalException(e);
+ throw new UnsupportedOperationException("unsupported operation findPollAccount");
+ }
+
+ protected void checkParticipantDoubloons(PollAccountDAO dao,
+ Poll poll,
+ PollAccount participant)
+ throws TopiaException, VoteDoubloonException {
+
+ TopiaQuery query = dao.createQueryFindAllParticipantsByPoll(poll);
+
+ String participantAlias = PollenQueryHelper.ALIAS_POLL_ACCOUNT_CHILD;
+
+ String participantNameProperty =
+ TopiaQuery.getProperty(participantAlias,
+ PollAccount.PROPERTY_NAME);
+
+ query.addEquals(participantNameProperty, participant.getName());
+
+ if (StringUtils.isNotEmpty(participant.getTopiaId())) {
+ query.addWhere(participantAlias, TopiaQuery.Op.NEQ, participant);
}
+
+ if (dao.existByQuery(query)) {
+ throw new VoteDoubloonException();
+ }
}
+ /**
+ * Create a new participant for a running {@code poll}. The participant uid
+ * will be generated and the new instance of pollAccount will be added to
+ * the {@code poll}.
+ *
+ * @param poll Poll where the new participant will be added
+ * @return a new PollAccount added to the poll
+ * @throws TopiaException for Topia errors
+ */
+ protected PollAccount createNewParticipant(Poll poll)
+ throws TopiaException {
+
+ PollAccountDAO dao =
+ PollenDAOHelper.getPollAccountDAO(getTransaction());
+
+ // Generate new uid
+ String newUid = serviceContext.createPollenUrlId();
+ PollAccount newParticipant = dao.create(newUid);
+
+ // Add the new participant in poll
+ PollDAO pollDAO = PollenDAOHelper.getPollDAO(getTransaction());
+
+ Poll pollFound = pollDAO.findByTopiaId(poll.getTopiaId());
+ pollFound.addPollAccount(newParticipant);
+
+ pollDAO.update(pollFound);
+ return newParticipant;
+ }
+
+ /**
+ * Save all votes from a participant. Votes will be added/updated or deleted
+ * depends on voteValue and existence in database.
+ *
+ * @param source PollAccount source that contains vote to save
+ * @param destination PollAccount destination where votes will be added to
+ * be persisted
+ * @throws TopiaException for Topia errors
+ */
+ protected void saveParticipantVotes(PollAccount source,
+ PollAccount destination)
+ throws TopiaException {
+
+ VoteDAO voteDAO = PollenDAOHelper.getVoteDAO(getTransaction());
+ for (Vote vote : source.getChoiceVote()) {
+
+ Vote voteToSave = voteDAO.findByTopiaId(vote.getTopiaId());
+
+ if (vote.getVoteValue() != 0) {
+ // Create vote
+ if (voteToSave == null) {
+ if (log.isDebugEnabled()) {
+ log.debug("Create vote for " + destination.getUid());
+ }
+ voteToSave = voteDAO.create();
+ voteToSave.setChoice(vote.getChoice());
+ // Add new vote to destination participant
+ destination.addChoiceVote(voteToSave);
+ }
+
+ // Update vote
+ voteToSave.setVoteValue(vote.getVoteValue());
+ voteDAO.update(voteToSave);
+
+ // Delete vote if exist and new value is 0
+ } else if (voteToSave != null) {
+ if (log.isDebugEnabled()) {
+ log.debug("Delete vote for " + destination.getUid());
+ }
+ // Normally the vote will be deleted
+ destination.removeChoiceVote(voteToSave);
+ }
+ }
+ }
+
+ /**
+ * Copy from account {@code source} to {@code destination}. The {@code
+ * destination} will be persisted. The anonymous case is manage, properties
+ * that identify the person are excluded from the copy in this case.
+ *
+ * @param source PollAccount to save
+ * @param destination PollAccount with up to date data to persist
+ * @see TopiaEntityBinder#copyExcluding(Object, Object, String...)
+ */
+ protected void copyPollAccount(PollAccount source, PollAccount destination) {
+ // Uid is the naturalId, don't copy it
+ String[] excludes = new String[]{PollAccount.PROPERTY_UID};
+
+ // Exclude properties for anonymous account
+ if (source.isAnonymous()) {
+ if (log.isInfoEnabled()) {
+ log.info("Anonymous vote, doesn't copy participant's data : " +
+ "name, email, userAccount");
+ }
+
+ excludes = new String[]{
+ PollAccount.PROPERTY_UID,
+ PollAccount.PROPERTY_NAME,
+ PollAccount.PROPERTY_EMAIL,
+ PollAccount.PROPERTY_USER_ACCOUNT};
+ }
+
+ TopiaEntityBinder<PollAccount> binder =
+ PollenBinderHelper.getSimpleTopiaBinder(PollAccount.class);
+
+ binder.copyExcluding(source, destination, excludes);
+ }
+
} //ServiceVote
Added: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/FavoriteListAlreadyExistException.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/FavoriteListAlreadyExistException.java (rev 0)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/FavoriteListAlreadyExistException.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -0,0 +1,13 @@
+package org.chorem.pollen.services.exceptions;
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.0
+ */
+public class FavoriteListAlreadyExistException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+}
Added: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/ParticipantAlreadyFoundInListException.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/ParticipantAlreadyFoundInListException.java (rev 0)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/ParticipantAlreadyFoundInListException.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -0,0 +1,13 @@
+package org.chorem.pollen.services.exceptions;
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.0
+ */
+public class ParticipantAlreadyFoundInListException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+}
Added: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/ParticipantExistWithoutMailException.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/ParticipantExistWithoutMailException.java (rev 0)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/ParticipantExistWithoutMailException.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -0,0 +1,13 @@
+package org.chorem.pollen.services.exceptions;
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.0
+ */
+public class ParticipantExistWithoutMailException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+}
Added: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollAlreadyClosedException.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollAlreadyClosedException.java (rev 0)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollAlreadyClosedException.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -0,0 +1,13 @@
+package org.chorem.pollen.services.exceptions;
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.0
+ */
+public class PollAlreadyClosedException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+}
Added: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollAlreadyExistException.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollAlreadyExistException.java (rev 0)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollAlreadyExistException.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -0,0 +1,13 @@
+package org.chorem.pollen.services.exceptions;
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.0
+ */
+public class PollAlreadyExistException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+}
Added: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollNotFoundException.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollNotFoundException.java (rev 0)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollNotFoundException.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -0,0 +1,13 @@
+package org.chorem.pollen.services.exceptions;
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.0
+ */
+public class PollNotFoundException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+}
Copied: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/UserEmailAlreadyUsedException.java (from rev 3105, branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserEmailAlreadyUsedException.java)
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/UserEmailAlreadyUsedException.java (rev 0)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/UserEmailAlreadyUsedException.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -0,0 +1,36 @@
+/*
+ * #%L
+ * Pollen :: Services
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2012 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%
+ */
+package org.chorem.pollen.services.exceptions;
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.0
+ */
+public class UserEmailAlreadyUsedException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+}
Property changes on: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/UserEmailAlreadyUsedException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/UserInvalidPasswordException.java (from rev 3105, branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserInvalidPasswordException.java)
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/UserInvalidPasswordException.java (rev 0)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/UserInvalidPasswordException.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -0,0 +1,36 @@
+/*
+ * #%L
+ * Pollen :: Services
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2012 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%
+ */
+package org.chorem.pollen.services.exceptions;
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.0
+ */
+public class UserInvalidPasswordException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+}
Property changes on: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/UserInvalidPasswordException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/UserLoginAlreadyUsedException.java (from rev 3105, branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserLoginAlreadyUsedException.java)
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/UserLoginAlreadyUsedException.java (rev 0)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/UserLoginAlreadyUsedException.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -0,0 +1,36 @@
+/*
+ * #%L
+ * Pollen :: Services
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2012 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%
+ */
+package org.chorem.pollen.services.exceptions;
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.0
+ */
+public class UserLoginAlreadyUsedException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+}
Property changes on: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/UserLoginAlreadyUsedException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/UserNotFoundException.java (from rev 3105, branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserNotFoundException.java)
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/UserNotFoundException.java (rev 0)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/UserNotFoundException.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -0,0 +1,36 @@
+/*
+ * #%L
+ * Pollen :: Services
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2012 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%
+ */
+package org.chorem.pollen.services.exceptions;
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.0
+ */
+public class UserNotFoundException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+}
Property changes on: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/UserNotFoundException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/VoteDoubloonException.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/VoteDoubloonException.java (rev 0)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/VoteDoubloonException.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -0,0 +1,13 @@
+package org.chorem.pollen.services.exceptions;
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.0
+ */
+public class VoteDoubloonException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+}
Added: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/VoteNotAllowedException.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/VoteNotAllowedException.java (rev 0)
+++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/VoteNotAllowedException.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -0,0 +1,13 @@
+package org.chorem.pollen.services.exceptions;
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.0
+ */
+public class VoteNotAllowedException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+}
Modified: branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/service/legacy/AbstractServiceTest.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/service/legacy/AbstractServiceTest.java 2012-01-23 22:27:46 UTC (rev 3108)
+++ branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/service/legacy/AbstractServiceTest.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -72,6 +72,7 @@
* @version $Id$
*/
@Ignore
+@Deprecated
public abstract class AbstractServiceTest {
protected static final String PROPERTY_CHOICE_VOTE =
Modified: branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/service/legacy/ServiceFavoriteImplTest.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/service/legacy/ServiceFavoriteImplTest.java 2012-01-23 22:27:46 UTC (rev 3108)
+++ branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/service/legacy/ServiceFavoriteImplTest.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -45,6 +45,7 @@
* @author fdesbois
* $Id$
*/
+@Deprecated
public class ServiceFavoriteImplTest extends AbstractServiceTest {
private static final Log log = LogFactory.getLog(ServiceUserImplTest.class);
Modified: branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/service/legacy/ServicePollImplTest.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/service/legacy/ServicePollImplTest.java 2012-01-23 22:27:46 UTC (rev 3108)
+++ branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/service/legacy/ServicePollImplTest.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -61,6 +61,7 @@
* @author fdesbois <fdesbois(a)codelutin.com>
* @version $Id$
*/
+@Deprecated
public class ServicePollImplTest extends AbstractServiceTest {
private static final Log log = LogFactory.getLog(ServicePollImplTest.class);
Modified: branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/service/legacy/ServiceUserImplTest.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/service/legacy/ServiceUserImplTest.java 2012-01-23 22:27:46 UTC (rev 3108)
+++ branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/service/legacy/ServiceUserImplTest.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -41,6 +41,7 @@
*
* @author fdesbois
*/
+@Deprecated
public class ServiceUserImplTest extends AbstractServiceTest {
private static final Log log = LogFactory.getLog(ServiceUserImplTest.class);
@@ -105,6 +106,7 @@
/**
* Test of executeConnect method, of class ServiceUserImpl.
+ * @throws Exception
*/
@Test
public void testExecuteConnect() throws Exception {
@@ -139,6 +141,7 @@
/**
* Test of executeGetNewUser method, of class ServiceUserImpl.
+ * @throws Exception
*/
@Test
public void testExecuteGetNewUser() throws Exception {
@@ -151,6 +154,7 @@
/**
* Test of executeCreateUpdateUser method, of class ServiceUserImpl.
+ * @throws Exception
*/
@Test
public void testExecuteCreateUser() throws Exception {
@@ -208,6 +212,7 @@
/**
* Test of executeDeleteUser method, of class ServiceUserImpl.
+ * @throws Exception
*/
@Test
public void testExecuteUpdateUser() throws Exception {
Modified: branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/service/legacy/ServiceVoteImplTest.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/service/legacy/ServiceVoteImplTest.java 2012-01-23 22:27:46 UTC (rev 3108)
+++ branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/service/legacy/ServiceVoteImplTest.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -53,6 +53,7 @@
* @author fdesbois <fdesbois(a)codelutin.com>
* @version $Id$
*/
+@Deprecated
public class ServiceVoteImplTest extends AbstractServiceTest {
private static final Log log = LogFactory.getLog(ServiceVoteImplTest.class);
Modified: branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/FakeServiceContext.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/FakeServiceContext.java 2012-01-23 22:27:46 UTC (rev 3108)
+++ branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/FakeServiceContext.java 2012-01-23 22:29:31 UTC (rev 3109)
@@ -28,7 +28,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.pollen.PollenConfiguration;
-import org.chorem.pollen.PollenTopiaRootContextSupplierFactory;
+import org.chorem.pollen.PollenTopiaRootContextFactory;
import org.junit.rules.TestWatcher;
import org.junit.runner.Description;
import org.nuiton.topia.TopiaContext;
@@ -94,8 +94,8 @@
protected void starting(Description description) {
super.starting(description);
description.getMethodName();
- PollenTopiaRootContextSupplierFactory factory =
- new PollenTopiaRootContextSupplierFactory();
+ PollenTopiaRootContextFactory factory =
+ new PollenTopiaRootContextFactory();
File testDir = getTestSpecificDirectory(description);
if (log.isInfoEnabled()) {
log.info("Test dir = " + testDir);
1
0
r3108 - in branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen: . entity service/legacy
by tchemit@users.chorem.org 23 Jan '12
by tchemit@users.chorem.org 23 Jan '12
23 Jan '12
Author: tchemit
Date: 2012-01-23 23:27:46 +0100 (Mon, 23 Jan 2012)
New Revision: 3108
Url: http://chorem.org/repositories/revision/pollen/3108
Log:
depreciates and add a lot of FIXME to be done on model, rename PollenTopiaRootContextSupplierFactory to PollenTopiaRootContextFactory
Added:
branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenTopiaRootContextFactory.java
Removed:
branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenTopiaRootContextSupplierFactory.java
Modified:
branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenBusinessException.java
branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenContext.java
branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenException.java
branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenProperty.java
branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenUtils.java
branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/ChoiceImpl.java
branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/FavoriteListImpl.java
branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/FavoriteParticipantDAOImpl.java
branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/FavoriteParticipantImpl.java
branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/ParticipantHelper.java
branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/PollAccountDAOImpl.java
branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/PollAccountImpl.java
branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/PollDAOImpl.java
branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/PollImpl.java
branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/UserAccountImpl.java
branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/VoteImpl.java
branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/service/legacy/ServiceUser.java
Modified: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenBusinessException.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenBusinessException.java 2012-01-23 17:32:00 UTC (rev 3107)
+++ branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenBusinessException.java 2012-01-23 22:27:46 UTC (rev 3108)
@@ -36,6 +36,7 @@
* Mise a jour: $Date$
* par : $Author$
*/
+@Deprecated
public class PollenBusinessException extends Exception {
private static final long serialVersionUID = 1L;
Modified: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenContext.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenContext.java 2012-01-23 17:32:00 UTC (rev 3107)
+++ branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenContext.java 2012-01-23 22:27:46 UTC (rev 3108)
@@ -30,7 +30,7 @@
import org.nuiton.topia.framework.EntityFilter;
import org.nuiton.util.ApplicationConfig;
-
+@Deprecated
public interface PollenContext {
/**
Modified: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenException.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenException.java 2012-01-23 17:32:00 UTC (rev 3107)
+++ branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenException.java 2012-01-23 22:27:46 UTC (rev 3108)
@@ -24,7 +24,7 @@
package org.chorem.pollen;
-
+@Deprecated
public class PollenException extends RuntimeException {
protected Object[] args;
Modified: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenProperty.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenProperty.java 2012-01-23 17:32:00 UTC (rev 3107)
+++ branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenProperty.java 2012-01-23 22:27:46 UTC (rev 3108)
@@ -35,6 +35,7 @@
* Mise a jour: $Date$
* par : $Author$
*/
+@Deprecated
public enum PollenProperty {
/** version of the application **/
APP_VERSION("version"),
Copied: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenTopiaRootContextFactory.java (from rev 3105, branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenTopiaRootContextSupplierFactory.java)
===================================================================
--- branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenTopiaRootContextFactory.java (rev 0)
+++ branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenTopiaRootContextFactory.java 2012-01-23 22:27:46 UTC (rev 3108)
@@ -0,0 +1,126 @@
+/*
+ * #%L
+ * Pollen :: Persistence
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2012 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%
+ */
+package org.chorem.pollen;
+
+import com.google.common.collect.Sets;
+import com.google.common.io.Closeables;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.topia.TopiaContext;
+import org.nuiton.topia.TopiaContextFactory;
+import org.nuiton.topia.TopiaNotFoundException;
+import org.nuiton.topia.TopiaRuntimeException;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+import java.util.Set;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class PollenTopiaRootContextFactory {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(PollenTopiaRootContextFactory.class);
+
+ public TopiaContext newEmbeddedDatabase(File dir, String configPath) {
+
+ File databaseFile = new File(dir, "db");
+
+ String databaseAbsolutePath = databaseFile.getAbsolutePath();
+
+ // prepare call to topia-context factory
+ Properties properties = new Properties();
+ InputStream input = null;
+ try {
+ input = getClass().getResourceAsStream(configPath);
+ properties.load(input);
+ } catch (IOException e) {
+ throw new PollenTechnicalException(e);
+ } finally {
+ Closeables.closeQuietly(input);
+ }
+ properties.setProperty(
+ TopiaContextFactory.CONFIG_URL,
+ "jdbc:h2:file:" + databaseAbsolutePath + "/pollen");
+
+ // add entities to the context
+ properties.setProperty(
+ TopiaContextFactory.CONFIG_PERSISTENCE_CLASSES,
+ PollenDAOHelper.getImplementationClassesAsString());
+
+ TopiaContext rootContext;
+ try {
+ rootContext = TopiaContextFactory.getContext(properties);
+ } catch (TopiaNotFoundException e) {
+ throw new TopiaRuntimeException(e);
+ }
+
+ if (log.isDebugEnabled()) {
+ log.debug("will output database in " + databaseAbsolutePath);
+ }
+
+ return rootContext;
+ }
+
+ public TopiaContext newDatabaseFromConfig(PollenConfiguration config) {
+
+ Properties properties = config.getProperties();
+
+ return newDatabaseFromProperties(properties);
+ }
+
+ public TopiaContext newDatabaseFromProperties(Properties properties) {
+
+ if (log.isDebugEnabled()) {
+ log.debug("Database settings are :");
+ Set<String> keysToDisplay = Sets.newHashSet(
+ "hibernate.dialect",
+ "hibernate.connection.driver_class",
+ "hibernate.connection.url",
+ "hibernate.connection.username");
+ for (String key : keysToDisplay) {
+ log.debug(String.format("%s=%s", key, properties.getProperty(key)));
+ }
+ }
+
+ // add entities to the context
+ String classesKey = TopiaContextFactory.CONFIG_PERSISTENCE_CLASSES;
+ String classesValue = PollenDAOHelper.getImplementationClassesAsString();
+ properties.setProperty(classesKey, classesValue);
+
+ TopiaContext rootContext;
+ try {
+ rootContext = TopiaContextFactory.getContext(properties);
+ } catch (TopiaNotFoundException e) {
+ throw new TopiaRuntimeException(e);
+ }
+
+ return rootContext;
+ }
+}
Property changes on: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenTopiaRootContextFactory.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenTopiaRootContextSupplierFactory.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenTopiaRootContextSupplierFactory.java 2012-01-23 17:32:00 UTC (rev 3107)
+++ branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenTopiaRootContextSupplierFactory.java 2012-01-23 22:27:46 UTC (rev 3108)
@@ -1,127 +0,0 @@
-/*
- * #%L
- * Pollen :: Persistence
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2009 - 2012 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%
- */
-package org.chorem.pollen;
-
-import com.google.common.base.Supplier;
-import com.google.common.collect.Sets;
-import com.google.common.io.Closeables;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.topia.TopiaContext;
-import org.nuiton.topia.TopiaContextFactory;
-import org.nuiton.topia.TopiaNotFoundException;
-import org.nuiton.topia.TopiaRuntimeException;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-import java.util.Set;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class PollenTopiaRootContextSupplierFactory {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(PollenTopiaRootContextSupplierFactory.class);
-
- public TopiaContext newEmbeddedDatabase(File dir, String configPath) {
-
- File databaseFile = new File(dir, "db");
-
- String databaseAbsolutePath = databaseFile.getAbsolutePath();
-
- // prepare call to topia-context factory
- Properties properties = new Properties();
- InputStream input = null;
- try {
- input = getClass().getResourceAsStream(configPath);
- properties.load(input);
- } catch (IOException e) {
- throw new PollenTechnicalException(e);
- } finally {
- Closeables.closeQuietly(input);
- }
- properties.setProperty(
- TopiaContextFactory.CONFIG_URL,
- "jdbc:h2:file:" + databaseAbsolutePath + "/pollen");
-
- // add entities to the context
- properties.setProperty(
- TopiaContextFactory.CONFIG_PERSISTENCE_CLASSES,
- PollenDAOHelper.getImplementationClassesAsString());
-
- TopiaContext rootContext;
- try {
- rootContext = TopiaContextFactory.getContext(properties);
- } catch (TopiaNotFoundException e) {
- throw new TopiaRuntimeException(e);
- }
-
- if (log.isDebugEnabled()) {
- log.debug("will output database in " + databaseAbsolutePath);
- }
-
- return rootContext;
- }
-
- public TopiaContext newDatabaseFromConfig(PollenConfiguration config) {
-
- Properties properties = config.getProperties();
-
- return newDatabaseFromProperties(properties);
- }
-
- public TopiaContext newDatabaseFromProperties(Properties properties) {
-
- if (log.isDebugEnabled()) {
- log.debug("Database settings are :");
- Set<String> keysToDisplay = Sets.newHashSet(
- "hibernate.dialect",
- "hibernate.connection.driver_class",
- "hibernate.connection.url",
- "hibernate.connection.username");
- for (String key : keysToDisplay) {
- log.debug(String.format("%s=%s", key, properties.getProperty(key)));
- }
- }
-
- // add entities to the context
- String classesKey = TopiaContextFactory.CONFIG_PERSISTENCE_CLASSES;
- String classesValue = PollenDAOHelper.getImplementationClassesAsString();
- properties.setProperty(classesKey, classesValue);
-
- TopiaContext rootContext;
- try {
- rootContext = TopiaContextFactory.getContext(properties);
- } catch (TopiaNotFoundException e) {
- throw new TopiaRuntimeException(e);
- }
-
- return rootContext;
- }
-}
Modified: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenUtils.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenUtils.java 2012-01-23 17:32:00 UTC (rev 3107)
+++ branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenUtils.java 2012-01-23 22:27:46 UTC (rev 3108)
@@ -31,6 +31,7 @@
* @author fdesbois <fdesbois(a)codelutin.com>
* @version $Id$
*/
+@Deprecated
public class PollenUtils {
private static PollenContext context;
Modified: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/ChoiceImpl.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/ChoiceImpl.java 2012-01-23 17:32:00 UTC (rev 3107)
+++ branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/ChoiceImpl.java 2012-01-23 22:27:46 UTC (rev 3108)
@@ -54,6 +54,7 @@
if (hidden && !previous) {
setName(NumberMethod.HIDDEN_PREFIX + name);
} else if (!hidden && previous) {
+ //FIXME tchemit-20120123 This does nothing !
name.substring(NumberMethod.HIDDEN_PREFIX.length());
}
}
Modified: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/FavoriteListImpl.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/FavoriteListImpl.java 2012-01-23 17:32:00 UTC (rev 3107)
+++ branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/FavoriteListImpl.java 2012-01-23 22:27:46 UTC (rev 3108)
@@ -23,9 +23,9 @@
*/
package org.chorem.pollen.entity;
+import com.google.common.collect.Lists;
import org.chorem.pollen.PollenBusinessException;
-import java.util.ArrayList;
import java.util.Collection;
/**
@@ -40,20 +40,25 @@
@Override
public Collection<Participant> getParticipants() {
- Collection<Participant> results = new ArrayList<Participant>();
+ Collection<Participant> results = Lists.newArrayList();
for (FavoriteParticipant account : getFavoriteParticipant()) {
results.add(account);
}
return results;
}
+ //FIXME tchemit-20120123 Remove this, use a service for this purpose
+ @Deprecated
@Override
public void setParticipants(Collection<Participant> participants)
throws PollenBusinessException {
- setFavoriteParticipant(new ArrayList<FavoriteParticipant>());
+ Collection<FavoriteParticipant> list = Lists.newArrayList();
+ setFavoriteParticipant(list);
ParticipantHelper.setParticipants(this, participants);
}
+ //FIXME tchemit-20120123 : No! please do not use a gentle string error return code : Cobol age is now over :( Do this in a service
+ @Deprecated
@Override
public String addParticipant(Participant participant) {
String name = participant.getName();
@@ -74,6 +79,8 @@
return null;
}
+ //FIXME tchemit-20120123 Remove this, entity is not a DTO
+ @Deprecated
@Override
public String getId() {
return getTopiaId();
Modified: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/FavoriteParticipantDAOImpl.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/FavoriteParticipantDAOImpl.java 2012-01-23 17:32:00 UTC (rev 3107)
+++ branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/FavoriteParticipantDAOImpl.java 2012-01-23 22:27:46 UTC (rev 3108)
@@ -37,6 +37,7 @@
public class FavoriteParticipantDAOImpl<E extends FavoriteParticipant>
extends FavoriteParticipantDAOAbstract<E> {
+ //FIXME tchemit 20120123 Rethink this to avoid floating code with filter..., prefer to add explicit method for explicit purposes...
@Override
public TopiaQuery createQueryFindAllByFavoriteList(EntityFilter filter) {
Modified: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/FavoriteParticipantImpl.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/FavoriteParticipantImpl.java 2012-01-23 17:32:00 UTC (rev 3107)
+++ branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/FavoriteParticipantImpl.java 2012-01-23 22:27:46 UTC (rev 3108)
@@ -33,6 +33,8 @@
private static final long serialVersionUID = 1L;
+ //FIXME tchemit-20120123 Remove this, entity is not a DTO
+ @Deprecated
@Override
public String getId() {
return getTopiaId();
Modified: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/ParticipantHelper.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/ParticipantHelper.java 2012-01-23 17:32:00 UTC (rev 3107)
+++ branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/ParticipantHelper.java 2012-01-23 22:27:46 UTC (rev 3108)
@@ -37,6 +37,8 @@
* @see Participant
* @see ParticipantList
*/
+//FIXME tchemit-20120123 Remove this, use a service instead and please no gentle string return code : Cobol age is over :(
+@Deprecated
public class ParticipantHelper {
private static final Log log = LogFactory.getLog(ParticipantHelper.class);
@@ -51,6 +53,8 @@
* @return an error code if participant already exist : simply the
* concatenation of name and email.
*/
+ //FIXME tchemit-20120123 : oups, this is bad, bad, bad :(
+ @Deprecated
public static String checkParticipantExist(
ParticipantList list, String name, String email) {
for (Participant participant : list.getParticipants()) {
@@ -77,6 +81,8 @@
* @param participants to add to the list
* @throws PollenBusinessException for doubloons case
*/
+ //FIXME tchemit-20120123 : oups, this is bad, bad, bad :(
+ @Deprecated
public static void setParticipants(ParticipantList list,
Collection<Participant> participants)
throws PollenBusinessException {
@@ -93,7 +99,7 @@
doubloons.append(separator).append(doubloon);
} else if (log.isDebugEnabled()) {
log.debug("Participant added : " + participant.getName() +
- " _ " + participant.getEmail());
+ " _ " + participant.getEmail());
}
}
// If doubloons are found, throw an exception
Modified: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/PollAccountDAOImpl.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/PollAccountDAOImpl.java 2012-01-23 17:32:00 UTC (rev 3107)
+++ branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/PollAccountDAOImpl.java 2012-01-23 22:27:46 UTC (rev 3108)
@@ -35,6 +35,7 @@
*/
public class PollAccountDAOImpl<E extends PollAccount> extends PollAccountDAOAbstract<E> {
+ //FIXME tchemit 20120123 Rethink this to avoid floating code with filter..., prefer to add explicit method for explicit purposes...
@Override
public TopiaQuery createQueryFindAllByPoll(EntityFilter filter) {
@@ -78,6 +79,7 @@
return query;
}
+ //FIXME tchemit 20120123 Rethink this to avoid floating code with filter..., prefer to add explicit method for explicit purposes...
@Override
public TopiaQuery createQueryFindAllParticipantsByPoll(Poll poll) {
@@ -116,7 +118,7 @@
// Manage join depends on pollType
if (poll.getType().isGroup()) {
query.addJoin(pollProperty.pollAccount(), listProperty.$alias(), false).
- addJoin(listProperty.child(), participantProperty.$alias(), false);
+ addJoin(listProperty.child(), participantProperty.$alias(), false);
} else {
query.addJoin(pollProperty.pollAccount(), participantProperty.$alias(), false);
}
Modified: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/PollAccountImpl.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/PollAccountImpl.java 2012-01-23 17:32:00 UTC (rev 3107)
+++ branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/PollAccountImpl.java 2012-01-23 22:27:46 UTC (rev 3108)
@@ -53,6 +53,8 @@
return results;
}
+ //FIXME tchemit-20120123 Remove this, use a service for this purpose
+ @Deprecated
@Override
public void setParticipants(Collection<Participant> participants)
throws PollenBusinessException {
@@ -64,6 +66,8 @@
ParticipantHelper.setParticipants(this, participants);
}
+ //FIXME tchemit-20120123 Remove this, use a service for this purpose
+ @Deprecated
@Override
public String addParticipant(Participant participant) {
String name = participant.getName();
@@ -83,6 +87,8 @@
return null;
}
+ //FIXME tchemit-20120123 Remove this, entity is not a DTO
+ @Deprecated
@Override
public String getId() {
return getTopiaId();
Modified: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/PollDAOImpl.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/PollDAOImpl.java 2012-01-23 17:32:00 UTC (rev 3107)
+++ branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/PollDAOImpl.java 2012-01-23 22:27:46 UTC (rev 3108)
@@ -37,6 +37,7 @@
*/
public class PollDAOImpl<E extends Poll> extends PollDAOAbstract<E> {
+ //FIXME tchemit 20120123 Rethink this to avoid floating code with filter..., prefer to add explicit method for explicit purposes...
@Override
public TopiaQuery createQueryFindAllByUser(EntityFilter filter)
throws IllegalArgumentException {
@@ -45,11 +46,11 @@
filter.checkReference(UserAccount.class, false);
PollProperty pollProperty =
- PollenQueryHelper.newPollProperty();
+ PollenQueryHelper.newPollProperty();
PollAccountProperty listProperty =
- PollenQueryHelper.newPollAccountProperty();
+ PollenQueryHelper.newPollAccountProperty();
PollAccountProperty participantProperty =
- PollenQueryHelper.newPollAccountChildProperty();
+ PollenQueryHelper.newPollAccountChildProperty();
// participantUser is the reference to filter on if necessary
filter.setReferenceProperty(participantProperty.userAccount());
@@ -59,11 +60,11 @@
addLeftJoin(pollProperty.pollAccount(), listProperty.$alias(), false).
addFrom(PollAccount.class, participantProperty.$alias()).
addWhere(String.format(
- "%1$s IN (%2$s) OR %1$s IN elements(%3$s) OR %1$s = %4$s",
- participantProperty.$alias(),
- listProperty.$alias(),
- listProperty.child(),
- pollProperty.creator())
+ "%1$s IN (%2$s) OR %1$s IN elements(%3$s) OR %1$s = %4$s",
+ participantProperty.$alias(),
+ listProperty.$alias(),
+ listProperty.child(),
+ pollProperty.creator())
).
addFilter(filter);
Modified: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/PollImpl.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/PollImpl.java 2012-01-23 17:32:00 UTC (rev 3107)
+++ branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/PollImpl.java 2012-01-23 22:27:46 UTC (rev 3108)
@@ -54,18 +54,21 @@
return choice;
}
+ @Deprecated
@Override
public boolean isStarted() {
Date now = PollenUtils.getCurrentDate();
return isStarted(now);
}
+ @Deprecated
@Override
public boolean isFinished() {
Date now = PollenUtils.getCurrentDate();
return isFinished(now);
}
+ @Deprecated
@Override
public boolean isRunning() {
Date now = PollenUtils.getCurrentDate();
Modified: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/UserAccountImpl.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/UserAccountImpl.java 2012-01-23 17:32:00 UTC (rev 3107)
+++ branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/UserAccountImpl.java 2012-01-23 22:27:46 UTC (rev 3108)
@@ -28,19 +28,20 @@
/**
* UserAccountImpl
- *
+ * <p/>
* Created: 30 mars 2010
*
* @author fdesbois
* @version $Revision$
- *
- * Mise a jour: $Date$
- * par : $Author$
+ * <p/>
+ * Mise a jour: $Date$
+ * par : $Author$
*/
public class UserAccountImpl extends UserAccountAbstract {
private static final long serialVersionUID = 1L;
+ @Deprecated
protected String newPassword;
/**
@@ -48,6 +49,7 @@
*
* @return the value of newPassword
*/
+ @Deprecated
@Override
public String getNewPassword() {
return newPassword;
@@ -58,6 +60,7 @@
*
* @param newPassword new value of newPassword
*/
+ @Deprecated
@Override
public void setNewPassword(String newPassword) {
this.newPassword = newPassword;
@@ -69,7 +72,7 @@
String separator = "";
if (StringUtils.isNotEmpty(getFirstName())) {
name += getFirstName();
- separator = " ";
+ separator = " ";
}
if (StringUtils.isNotEmpty(getLastName())) {
name += separator + getLastName();
Modified: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/VoteImpl.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/VoteImpl.java 2012-01-23 17:32:00 UTC (rev 3107)
+++ branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/VoteImpl.java 2012-01-23 22:27:46 UTC (rev 3108)
@@ -26,19 +26,20 @@
/**
* VoteImpl
- *
+ * <p/>
* Created: 23 mars 2010
*
* @author fdesbois
* @version $Revision$
- *
- * Mise a jour: $Date$
- * par : $Author$
+ * <p/>
+ * Mise a jour: $Date$
+ * par : $Author$
*/
public class VoteImpl extends VoteAbstract {
private static final long serialVersionUID = 1L;
+ //FIXME tchemit-20120123 needed ?
@Override
public boolean canUpdateVote(PollAccount person) {
throw new UnsupportedOperationException("Not supported yet.");
Modified: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/service/legacy/ServiceUser.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/service/legacy/ServiceUser.java 2012-01-23 17:32:00 UTC (rev 3107)
+++ branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/service/legacy/ServiceUser.java 2012-01-23 22:27:46 UTC (rev 3108)
@@ -29,6 +29,7 @@
import org.chorem.pollen.entity.UserAccount;
import org.nuiton.topia.framework.EntityFilter;
+@Deprecated
public interface ServiceUser {
UserAccount connect(String login, String password) throws PollenException, PollenBusinessException;
1
0
r3107 - in branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main: java/org/chorem/pollen/ui/actions/admin webapp/WEB-INF/jsp
by tchemit@users.chorem.org 23 Jan '12
by tchemit@users.chorem.org 23 Jan '12
23 Jan '12
Author: tchemit
Date: 2012-01-23 18:32:00 +0100 (Mon, 23 Jan 2012)
New Revision: 3107
Url: http://chorem.org/repositories/revision/pollen/3107
Log:
do not display CUD form
Modified:
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/CreateUser.java
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/DeleteUser.java
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/UpdateUser.java
branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/usersList.jsp
Modified: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/CreateUser.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/CreateUser.java 2012-01-23 17:22:39 UTC (rev 3106)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/CreateUser.java 2012-01-23 17:32:00 UTC (rev 3107)
@@ -27,6 +27,10 @@
return createUser;
}
+ public boolean isCreateUserNotNull() {
+ return createUser !=null;
+ }
+
@Override
public String execute() throws Exception {
Modified: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/DeleteUser.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/DeleteUser.java 2012-01-23 17:22:39 UTC (rev 3106)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/DeleteUser.java 2012-01-23 17:32:00 UTC (rev 3107)
@@ -25,6 +25,10 @@
return deleteUser;
}
+ public boolean isDeleteUserNotNull() {
+ return deleteUser !=null;
+ }
+
@Override
public String execute() throws Exception {
Modified: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/UpdateUser.java
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/UpdateUser.java 2012-01-23 17:22:39 UTC (rev 3106)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/UpdateUser.java 2012-01-23 17:32:00 UTC (rev 3107)
@@ -27,6 +27,10 @@
return updateUser;
}
+ public boolean isUpdateUserNotNull() {
+ return updateUser !=null;
+ }
+
@Override
public String execute() throws Exception {
Modified: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/usersList.jsp
===================================================================
--- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/usersList.jsp 2012-01-23 17:22:39 UTC (rev 3106)
+++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/usersList.jsp 2012-01-23 17:32:00 UTC (rev 3107)
@@ -37,13 +37,13 @@
<script type="text/javascript">
jQuery(document).ready(function () {
- if ('${createUser}' != '') {
+ if ('${createUserNotNull}' == 'true') {
$('#createForm').show();
}
- if ('${updateUser}' != '') {
+ if ('${updateUserNotNull}' == 'true') {
$('#editForm').show();
}
- if ('${deleteUser}' != '') {
+ if ('${deleteUserNotNull}' == 'true') {
$('#deleteForm').show();
}
1
0