branch feature/april updated (c5fff77a -> 26380285)
This is an automated email from the git hooks/post-receive script. New change to branch feature/april in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git from c5fff77a refs #221 Vote associatif - Modification API new 4d28e3a6 refs #210 : RGPD features : - Add rgpd checkbox for unlogged users on vote edition page new f0484fe4 refs #210 : RGPD features : fix linter errors new 99ea3a3a refs #210 : Cron d'anonymisation ; Cassage des liens entre votes à l'anonymisation des votes d'un utilisateurs supprimant son compte. new 471c3925 fixes #210 - Prendre en compte la RGPD new e8360a65 fixes #210 : Cleaning code and doc new 517ef04d fixes #227 - Liste d'émargement sans email new ff245d01 Quick permissions fix new ae096ef2 add header file new e0f4eb3b release 3.2.4 success [skip ci] new 70227c33 add header file new 040a1a02 Mise a jour du model new 8315dfbc refs #221 Vote associatif - Modification API new dd2c391e Fix typo new a4dde9b9 refs #221 - Vote associatif : EmailService should be ok new bf4a2896 refs #221 Vote associatif - FeedService should be ok new 50b45ff8 refs #221 - Vote associatif - ChoiceService should be ok new 375727c6 refs #221 - Vote associatif - VoterListService should be ok new 662dccae refs #221 - Vote associatif - VoteService should be ok new 26380285 Merge branch 'feature/april' of gitlab.nuiton.org:chorem/pollen into feature/april The 19 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 263802851c2f8e2b619d5a893348f7019ef74ecf Merge: 662dccae c5fff77a Author: jcouteau <couteau@codelutin.com> Date: Tue Oct 2 15:19:31 2018 +0200 Merge branch 'feature/april' of gitlab.nuiton.org:chorem/pollen into feature/april commit 662dccaeed3ef827831a888e4f51092dddd2803d Author: jcouteau <couteau@codelutin.com> Date: Tue Oct 2 15:09:07 2018 +0200 refs #221 - Vote associatif - VoteService should be ok commit 375727c6c848b3ed60f16bd01e7e65ec940fd709 Author: jcouteau <couteau@codelutin.com> Date: Tue Oct 2 14:53:51 2018 +0200 refs #221 - Vote associatif - VoterListService should be ok commit 50b45ff82f498fb34420e3258a1ea8629a9fa139 Author: jcouteau <couteau@codelutin.com> Date: Tue Oct 2 10:59:42 2018 +0200 refs #221 - Vote associatif - ChoiceService should be ok commit bf4a2896d1640c9b6158d98b822dc95b85feef8b Author: jcouteau <couteau@codelutin.com> Date: Tue Oct 2 10:56:32 2018 +0200 refs #221 Vote associatif - FeedService should be ok commit a4dde9b9fc93fca0c05c52d79d5905c8f227c0d9 Author: jcouteau <couteau@codelutin.com> Date: Tue Oct 2 10:52:00 2018 +0200 refs #221 - Vote associatif : EmailService should be ok commit dd2c391eb3f0778cd1b64014b1f48ec2302cc43c Author: jcouteau <couteau@codelutin.com> Date: Mon Oct 1 16:35:25 2018 +0200 Fix typo commit 8315dfbcdc2e6eb3b98778835cf221efd4dfdaed Author: jcouteau <couteau@codelutin.com> Date: Mon Oct 1 16:31:39 2018 +0200 refs #221 Vote associatif - Modification API Module persistence compile commit 040a1a020efe2632881d00de7e533ca9f6160703 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Fri Sep 28 17:24:26 2018 +0200 Mise a jour du model commit 70227c33b5592d987bc4b5dde9e03b365716fdf9 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Wed Sep 26 15:42:11 2018 +0200 add header file commit e0f4eb3b3d6b676a6aa8fc24cee50eab328a8856 Author: Maven Release <maven-release@codelutin.com> Date: Fri Sep 21 15:25:55 2018 +0000 release 3.2.4 success [skip ci] commit ae096ef27de8c4dd6b06d0ddbca5d4102d81c66b Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Fri Sep 21 17:03:35 2018 +0200 add header file commit ff245d01532f1b643d47b1df4ba84eda7350f4d1 Author: jcouteau <couteau@codelutin.com> Date: Fri Sep 21 16:25:42 2018 +0200 Quick permissions fix commit 517ef04df6623c66ff1d272d8077bacbd48d144e Author: jcouteau <couteau@codelutin.com> Date: Fri Sep 21 16:04:12 2018 +0200 fixes #227 - Liste d'émargement sans email commit e8360a65d677f53a0b3f2f926b26f51a0efb09f4 Author: jcouteau <couteau@codelutin.com> Date: Thu Sep 20 11:59:08 2018 +0200 fixes #210 : Cleaning code and doc commit 471c39252e3d9a26ec2545047cd65eb6866818fb Author: jcouteau <couteau@codelutin.com> Date: Wed Sep 19 17:17:17 2018 +0200 fixes #210 - Prendre en compte la RGPD commit 99ea3a3a3ddf54e09f79fd6d3dc9a4c82dbe5054 Author: jcouteau <couteau@codelutin.com> Date: Wed Sep 12 16:34:52 2018 +0200 refs #210 : Cron d'anonymisation ; Cassage des liens entre votes à l'anonymisation des votes d'un utilisateurs supprimant son compte. commit f0484fe4118bb84385361c49b7a20fe103a0c440 Author: jcouteau <couteau@codelutin.com> Date: Wed Sep 12 10:24:41 2018 +0200 refs #210 : RGPD features : fix linter errors commit 4d28e3a60543996d34d6b7a6680440fed1b1d87f Author: jcouteau <couteau@codelutin.com> Date: Tue Sep 11 17:49:34 2018 +0200 refs #210 : RGPD features : - Add rgpd checkbox for unlogged users on vote edition page Summary of changes: .../pollen/services/service/ChoiceService.java | 83 ++++++------- .../pollen/services/service/FeedService.java | 32 +++-- .../pollen/services/service/VoteService.java | 134 ++++++++++----------- .../pollen/services/service/VoterListService.java | 13 +- .../pollen/services/service/mail/EmailService.java | 52 ++++++-- .../services/service/mail/PollInvitationEmail.java | 2 +- 6 files changed, 184 insertions(+), 132 deletions(-) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/april in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 4d28e3a60543996d34d6b7a6680440fed1b1d87f Author: jcouteau <couteau@codelutin.com> Date: Tue Sep 11 17:49:34 2018 +0200 refs #210 : RGPD features : - Add rgpd checkbox for unlogged users on vote edition page --- pollen-ui-riot-js/src/main/web/i18n/en.json | 3 ++ pollen-ui-riot-js/src/main/web/i18n/fr.json | 3 ++ .../src/main/web/tag/poll/EditVote.tag.html | 32 +++++++++++++++++++++- 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/pollen-ui-riot-js/src/main/web/i18n/en.json b/pollen-ui-riot-js/src/main/web/i18n/en.json index 7b220644..3661ab30 100644 --- a/pollen-ui-riot-js/src/main/web/i18n/en.json +++ b/pollen-ui-riot-js/src/main/web/i18n/en.json @@ -184,6 +184,9 @@ "poll_votes_tooManyPoint": "There is {0} point distributed too much", "poll_votes_voteByClickAndDrop": "Vote by click and drop", "poll_votes_voteByInput": "Vote by entry", + "poll_votes_validation_before" : "I read and accept the", + "poll_votes_validation_link" : "general terms of use.", + "poll_votes_validation_after" : "For the consultation needs, my vote will be stored for 2 years, then anonymized.", "poll_participants_noParticipant": "Voting list is not available", "poll_participants_download": "Download", "poll_participants_download_title": "Download voting list", diff --git a/pollen-ui-riot-js/src/main/web/i18n/fr.json b/pollen-ui-riot-js/src/main/web/i18n/fr.json index 0c3a0a3f..29c78761 100644 --- a/pollen-ui-riot-js/src/main/web/i18n/fr.json +++ b/pollen-ui-riot-js/src/main/web/i18n/fr.json @@ -184,6 +184,9 @@ "poll_votes_tooManyPoint": "Il y a {0} point distribué en trop", "poll_votes_voteByClickAndDrop": "Vote par cliquer/glisser", "poll_votes_voteByInput": "Vote par saisie", + "poll_votes_validation_before" : "J'ai lu et j'accepte les", + "poll_votes_validation_link" : "conditions générales d'utilisation", + "poll_votes_validation_after" : ". Pour les besoins de la consultation, mon vote sera conservé au maximum 2 ans puis anonymisé.", "poll_participants_noParticipant": "Le liste d'émagement n'est pas diponible", "poll_participants_download": "Télécharger", "poll_participants_download_title": "Télécharger la liste d'émargement", diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/EditVote.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/EditVote.tag.html index 31889002..f014543f 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/EditVote.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/EditVote.tag.html @@ -119,13 +119,29 @@ </div> <div class="footer separator-top" if="{poll.choices && (poll.canVote || voteInEdition)}"> <div class="current-voter-actions separator-right"> + <div class="o-form-element" if={!session.isConnected()}> + <label class="c-field c-field--choice gtu-validation"> + <input type="checkbox" + onchange="{onRgpdAccepted}" + ref="rgpdCheckbox" + required> + {_t.validation_before} + <a class="c-link" + href="{session.configuration.endPoint}/v1/gtu" + target="_blank"> + {_t.validation_link} + </a> + {_t.validation_after} + </label> + + </div> <div class="current-voter-buttons"> <button if={!voteInEdition} class="c-button c-button--brand pull-right" type="submit" name="newVote" tabindex="{(poll.choices.length + 1) * 10}" - disabled={tooManyChoicesSelected || remainPoints || voting}> + disabled={tooManyChoicesSelected || remainPoints || voting || (!rgpdAccepted && !session.isConnected())}> <i class="fa fa-envelope"></i> {_t.toVote} </button> @@ -171,6 +187,7 @@ import moment from "moment"; this.moment = moment; + this.session = session; this.installBundle(session, "poll_votes"); this.tooManyChoicesSelected = false; @@ -277,6 +294,19 @@ this.update(); }; + this.onRgpdAccepted = () => { + if (session.isConnected()) { + this.rgpdAccepted = true; + } else { + let input = this.refs["rgpdCheckbox"]; + if (!input) { + this.rgpdAccepted = false; + } else { + this.rgpdAccepted = input.checked; + } + } + }; + this.resetVoteForm = () => { if (this.poll.canVote) { this.refs.voterName.value = null; -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/april in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit e0f4eb3b3d6b676a6aa8fc24cee50eab328a8856 Author: Maven Release <maven-release@codelutin.com> Date: Fri Sep 21 15:25:55 2018 +0000 release 3.2.4 success [skip ci] --- CHANGELOG | 5 +++++ pollen-persistence/pom.xml | 2 +- pollen-rest-api/pom.xml | 2 +- pollen-services/pom.xml | 2 +- pollen-ui-riot-js/package.json | 2 +- pollen-ui-riot-js/pom.xml | 2 +- pollen-votecounting-aggregator/pom.xml | 2 +- pollen-votecounting-api/pom.xml | 2 +- pollen-votecounting-borda/pom.xml | 2 +- pollen-votecounting-condorcet/pom.xml | 2 +- pollen-votecounting-coombs/pom.xml | 2 +- pollen-votecounting-cumulative/pom.xml | 2 +- pollen-votecounting-instant-runoff/pom.xml | 2 +- pollen-votecounting-majority-judgment/pom.xml | 2 +- pollen-votecounting-normal/pom.xml | 2 +- pollen-votecounting-number/pom.xml | 2 +- pom.xml | 2 +- 17 files changed, 21 insertions(+), 16 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 4101fa14..3aa37c96 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -105,3 +105,8 @@ - Erreur à la création d'un sondage avec un seul choix +3.2.4 (2018/09/21) + + - Suppression des emails de la liste d'émargement + - Prendre en compte la RGPD + diff --git a/pollen-persistence/pom.xml b/pollen-persistence/pom.xml index 0866317f..f834086a 100644 --- a/pollen-persistence/pom.xml +++ b/pollen-persistence/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.chorem</groupId> <artifactId>pollen</artifactId> - <version>3.2.3</version> + <version>3.2.4</version> </parent> <groupId>org.chorem.pollen</groupId> diff --git a/pollen-rest-api/pom.xml b/pollen-rest-api/pom.xml index 745548e1..72b7badc 100644 --- a/pollen-rest-api/pom.xml +++ b/pollen-rest-api/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.chorem</groupId> <artifactId>pollen</artifactId> - <version>3.2.3</version> + <version>3.2.4</version> </parent> <groupId>org.chorem.pollen</groupId> diff --git a/pollen-services/pom.xml b/pollen-services/pom.xml index c8293faa..4a156940 100644 --- a/pollen-services/pom.xml +++ b/pollen-services/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.chorem</groupId> <artifactId>pollen</artifactId> - <version>3.2.3</version> + <version>3.2.4</version> </parent> <groupId>org.chorem.pollen</groupId> diff --git a/pollen-ui-riot-js/package.json b/pollen-ui-riot-js/package.json index e34bc7f1..4a2cd0d6 100644 --- a/pollen-ui-riot-js/package.json +++ b/pollen-ui-riot-js/package.json @@ -1,6 +1,6 @@ { "name": "Pollen", - "version": "3.2.3", + "version": "3.2.4", "description": "Pollen UI", "main": "index.html", "repository": { diff --git a/pollen-ui-riot-js/pom.xml b/pollen-ui-riot-js/pom.xml index e2491031..6d04a050 100644 --- a/pollen-ui-riot-js/pom.xml +++ b/pollen-ui-riot-js/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.chorem</groupId> <artifactId>pollen</artifactId> - <version>3.2.3</version> + <version>3.2.4</version> </parent> <groupId>org.chorem.pollen</groupId> diff --git a/pollen-votecounting-aggregator/pom.xml b/pollen-votecounting-aggregator/pom.xml index ff0065d7..c10dec02 100644 --- a/pollen-votecounting-aggregator/pom.xml +++ b/pollen-votecounting-aggregator/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.chorem</groupId> <artifactId>pollen</artifactId> - <version>3.2.3</version> + <version>3.2.4</version> </parent> <groupId>org.chorem.pollen</groupId> diff --git a/pollen-votecounting-api/pom.xml b/pollen-votecounting-api/pom.xml index 7c9d0809..22cc0a11 100644 --- a/pollen-votecounting-api/pom.xml +++ b/pollen-votecounting-api/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.chorem</groupId> <artifactId>pollen</artifactId> - <version>3.2.3</version> + <version>3.2.4</version> </parent> <groupId>org.chorem.pollen</groupId> diff --git a/pollen-votecounting-borda/pom.xml b/pollen-votecounting-borda/pom.xml index f1717e3b..196e73e1 100644 --- a/pollen-votecounting-borda/pom.xml +++ b/pollen-votecounting-borda/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.chorem</groupId> <artifactId>pollen</artifactId> - <version>3.2.3</version> + <version>3.2.4</version> </parent> <groupId>org.chorem.pollen</groupId> diff --git a/pollen-votecounting-condorcet/pom.xml b/pollen-votecounting-condorcet/pom.xml index cfdc26f2..d98cec48 100644 --- a/pollen-votecounting-condorcet/pom.xml +++ b/pollen-votecounting-condorcet/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.chorem</groupId> <artifactId>pollen</artifactId> - <version>3.2.3</version> + <version>3.2.4</version> </parent> <groupId>org.chorem.pollen</groupId> diff --git a/pollen-votecounting-coombs/pom.xml b/pollen-votecounting-coombs/pom.xml index 7d2ff4e2..71186a76 100644 --- a/pollen-votecounting-coombs/pom.xml +++ b/pollen-votecounting-coombs/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.chorem</groupId> <artifactId>pollen</artifactId> - <version>3.2.3</version> + <version>3.2.4</version> </parent> <groupId>org.chorem.pollen</groupId> diff --git a/pollen-votecounting-cumulative/pom.xml b/pollen-votecounting-cumulative/pom.xml index a2685ac0..e805783c 100644 --- a/pollen-votecounting-cumulative/pom.xml +++ b/pollen-votecounting-cumulative/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.chorem</groupId> <artifactId>pollen</artifactId> - <version>3.2.3</version> + <version>3.2.4</version> </parent> <groupId>org.chorem.pollen</groupId> diff --git a/pollen-votecounting-instant-runoff/pom.xml b/pollen-votecounting-instant-runoff/pom.xml index 3cefedc3..228f01ee 100644 --- a/pollen-votecounting-instant-runoff/pom.xml +++ b/pollen-votecounting-instant-runoff/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.chorem</groupId> <artifactId>pollen</artifactId> - <version>3.2.3</version> + <version>3.2.4</version> </parent> <groupId>org.chorem.pollen</groupId> diff --git a/pollen-votecounting-majority-judgment/pom.xml b/pollen-votecounting-majority-judgment/pom.xml index ce62c992..47bc450e 100644 --- a/pollen-votecounting-majority-judgment/pom.xml +++ b/pollen-votecounting-majority-judgment/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.chorem</groupId> <artifactId>pollen</artifactId> - <version>3.2.3</version> + <version>3.2.4</version> </parent> <groupId>org.chorem.pollen</groupId> diff --git a/pollen-votecounting-normal/pom.xml b/pollen-votecounting-normal/pom.xml index 0f4565be..6c091d76 100644 --- a/pollen-votecounting-normal/pom.xml +++ b/pollen-votecounting-normal/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.chorem</groupId> <artifactId>pollen</artifactId> - <version>3.2.3</version> + <version>3.2.4</version> </parent> <groupId>org.chorem.pollen</groupId> diff --git a/pollen-votecounting-number/pom.xml b/pollen-votecounting-number/pom.xml index b4d39f12..d262ca12 100644 --- a/pollen-votecounting-number/pom.xml +++ b/pollen-votecounting-number/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.chorem</groupId> <artifactId>pollen</artifactId> - <version>3.2.3</version> + <version>3.2.4</version> </parent> <groupId>org.chorem.pollen</groupId> diff --git a/pom.xml b/pom.xml index 21d536c4..e4f70457 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ <groupId>org.chorem</groupId> <artifactId>pollen</artifactId> - <version>3.2.3</version> + <version>3.2.4</version> <packaging>pom</packaging> <name>Pollen</name> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/april in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 70227c33b5592d987bc4b5dde9e03b365716fdf9 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Wed Sep 26 15:42:11 2018 +0200 add header file --- .gitlab-ci.yml | 3 +++ mkdocs.yml | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0669446d..b5974038 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -148,7 +148,10 @@ pages: - public before_script: + - python --version + - pip --version - pip install mkdocs + - mkdocs --version # (https://github.com/mkdocs/mkdocs/wiki/MkDocs-Themes) - pip install mkdocs-material diff --git a/mkdocs.yml b/mkdocs.yml index 4bdef352..fa27f505 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -26,4 +26,5 @@ extra: markdown_extensions: - admonition - codehilite - - toc(permalink=true) + - toc: + permalink: True -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/april in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 040a1a020efe2632881d00de7e533ca9f6160703 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Fri Sep 28 17:24:26 2018 +0200 Mise a jour du model --- pollen-persistence/src/main/xmi/pollen.zargo | Bin 30935 -> 31232 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/pollen-persistence/src/main/xmi/pollen.zargo b/pollen-persistence/src/main/xmi/pollen.zargo index fee50cb2..9108adea 100644 Binary files a/pollen-persistence/src/main/xmi/pollen.zargo and b/pollen-persistence/src/main/xmi/pollen.zargo differ -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/april in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 8315dfbcdc2e6eb3b98778835cf221efd4dfdaed Author: jcouteau <couteau@codelutin.com> Date: Mon Oct 1 16:31:39 2018 +0200 refs #221 Vote associatif - Modification API Module persistence compile --- .../pollen/persistence/entity/ChoiceTopiaDao.java | 4 +-- .../pollen/persistence/entity/CommentTopiaDao.java | 7 ++++ .../pollen/persistence/entity/PollTopiaDao.java | 42 +++++++++++++++------- .../chorem/pollen/persistence/entity/Polls.java | 22 ++++++------ .../pollen/persistence/entity/VoteTopiaDao.java | 14 ++++---- 5 files changed, 56 insertions(+), 33 deletions(-) diff --git a/pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/ChoiceTopiaDao.java b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/ChoiceTopiaDao.java index 4c8a24a9..113e5a9f 100644 --- a/pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/ChoiceTopiaDao.java +++ b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/ChoiceTopiaDao.java @@ -25,9 +25,9 @@ import java.util.List; public class ChoiceTopiaDao extends AbstractChoiceTopiaDao<Choice> { - public List<Choice> findAll(Poll poll) { + public List<Choice> findAll(Question question) { - return forPollEquals(poll) + return forQuestionEquals(question) .setOrderByArguments(Choice.PROPERTY_CHOICE_ORDER) .findAll(); } diff --git a/pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/CommentTopiaDao.java b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/CommentTopiaDao.java index 0e89028b..d01afebf 100644 --- a/pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/CommentTopiaDao.java +++ b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/CommentTopiaDao.java @@ -32,4 +32,11 @@ public class CommentTopiaDao extends AbstractCommentTopiaDao<Comment> { .findPage(paginationParameter); } + + public PaginationResult<Comment> find(Question question, PaginationParameter paginationParameter) { + + return forQuestionEquals(question) + .findPage(paginationParameter); + + } } diff --git a/pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/PollTopiaDao.java b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/PollTopiaDao.java index 38cd4aee..05d64d45 100644 --- a/pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/PollTopiaDao.java +++ b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/PollTopiaDao.java @@ -100,7 +100,8 @@ public class PollTopiaDao extends AbstractPollTopiaDao<Poll> { parameters.put("user", user); String hql = "FROM " + Vote.class.getName() + " as vote " - + " INNER JOIN vote." + Vote.PROPERTY_POLL + " as poll" + + " INNER JOIN vote." + Vote.PROPERTY_QUESTION + " as question" + + " INNER JOIN question." + Question.PROPERTY_POLL + " as poll" + " WHERE vote." + Vote.PROPERTY_VOTER + "." + PollenPrincipal.PROPERTY_POLLEN_USER + " = :user"; if (StringUtils.isNotBlank(search)) { hql += " AND " + DaoUtils.getSearchClause("poll", parameters, Poll.PROPERTY_TITLE, search); @@ -148,26 +149,41 @@ public class PollTopiaDao extends AbstractPollTopiaDao<Poll> { @Override public void delete(Poll entity) { + //get all questions + QuestionTopiaDao questionDao = topiaDaoSupplier + .getDao(Question.class, QuestionTopiaDao.class); + List<Question> questions = questionDao.forPollEquals(entity).findAll(); - { // --- remove choices --- // + for (Question question:questions) { + { // --- remove choices --- // - ChoiceTopiaDao dao = topiaDaoSupplier - .getDao(Choice.class, ChoiceTopiaDao.class); - List<Choice> list = dao.forPollEquals(entity).findAll(); - dao.deleteAll(list); + ChoiceTopiaDao dao = topiaDaoSupplier + .getDao(Choice.class, ChoiceTopiaDao.class); + List<Choice> list = dao.forQuestionEquals(question).findAll(); + dao.deleteAll(list); - } + } - { // --- remove votes --- // + { // --- remove votes --- // - VoteTopiaDao dao = topiaDaoSupplier - .getDao(Vote.class, VoteTopiaDao.class); - List<Vote> list = dao.forPollEquals(entity).findAll(); - dao.deleteAll(list); + VoteTopiaDao dao = topiaDaoSupplier + .getDao(Vote.class, VoteTopiaDao.class); + List<Vote> list = dao.forQuestionEquals(question).findAll(); + dao.deleteAll(list); + + } + + { // --- remove question comments -- // + + CommentTopiaDao dao = topiaDaoSupplier + .getDao(Comment.class, CommentTopiaDao.class); + List<Comment> list = dao.forPollEquals(entity).findAll(); + dao.deleteAll(list); + } } - { // --- remove comments -- // + { // --- remove poll comments -- // CommentTopiaDao dao = topiaDaoSupplier .getDao(Comment.class, CommentTopiaDao.class); diff --git a/pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/Polls.java b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/Polls.java index 460057a8..3864939c 100644 --- a/pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/Polls.java +++ b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/Polls.java @@ -59,22 +59,22 @@ public class Polls { return endDate != null && currentDate.after(endDate); } - public static boolean isAddChoiceStarted(Poll poll, Date currentDate) { - Date beginChoiceDate = poll.getBeginChoiceDate(); - return poll.isChoiceAddAllowed() && + public static boolean isAddChoiceStarted(Question question, Date currentDate) { + Date beginChoiceDate = question.getBeginChoiceDate(); + return question.isChoiceAddAllowed() && (beginChoiceDate == null || beginChoiceDate.before(currentDate)); } - public static boolean isAddChoiceRunning(Poll poll, Date currentDate) { - return poll.isChoiceAddAllowed() && - !isFinished(poll, currentDate) && - isAddChoiceStarted(poll, currentDate) && - !isAddChoiceFinished(poll, currentDate); + public static boolean isAddChoiceRunning(Question question, Date currentDate) { + return question.isChoiceAddAllowed() && + !isFinished(question.getPoll(), currentDate) && + isAddChoiceStarted(question, currentDate) && + !isAddChoiceFinished(question, currentDate); } - public static boolean isAddChoiceFinished(Poll poll, Date currentDate) { - Date endChoiceDate = poll.getEndChoiceDate(); - return !poll.isChoiceAddAllowed() || + public static boolean isAddChoiceFinished(Question question, Date currentDate) { + Date endChoiceDate = question.getEndChoiceDate(); + return !question.isChoiceAddAllowed() || (endChoiceDate != null && endChoiceDate.before(currentDate)); } } diff --git a/pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/VoteTopiaDao.java b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/VoteTopiaDao.java index 7e946a4d..6a2e928c 100644 --- a/pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/VoteTopiaDao.java +++ b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/VoteTopiaDao.java @@ -32,9 +32,9 @@ public class VoteTopiaDao extends AbstractVoteTopiaDao<Vote> { public static final String ANONYMOUS_NAME = "?"; - public List<Vote> findAll(Poll poll) { + public List<Vote> findAll(Question question) { - return forPollEquals(poll) + return forQuestionEquals(question) .setOrderByArguments(Vote.PROPERTY_TOPIA_CREATE_DATE) .findAll(); } @@ -42,21 +42,21 @@ public class VoteTopiaDao extends AbstractVoteTopiaDao<Vote> { public long getVoteIndex(Vote vote) { HqlAndParametersBuilder<Vote> builder = newHqlAndParametersBuilder(); - builder.addEquals(Vote.PROPERTY_POLL, vote.getPoll()); + builder.addEquals(Vote.PROPERTY_QUESTION, vote.getQuestion()); builder.addLowerOrEquals(Vote.PROPERTY_TOPIA_CREATE_DATE, vote.getTopiaCreateDate()); builder.setSelectClause("select count(" + Vote.PROPERTY_TOPIA_ID + ")"); return count(builder.getHql(), builder.getHqlParameters()); } - public List<Vote> findAllSince(Poll poll, Date since) { + public List<Vote> findAllSince(Question question, Date since) { if (since == null) { - return findAll(poll); + return findAll(question); } return forHql("FROM " + Vote.class.getCanonicalName() +" v" + - " WHERE v." + Vote.PROPERTY_POLL + " = :" + Vote.PROPERTY_POLL + + " WHERE v." + Vote.PROPERTY_QUESTION + " = :" + Vote.PROPERTY_QUESTION + " AND v." + Vote.PROPERTY_TOPIA_CREATE_DATE + " >= :" + Vote.PROPERTY_TOPIA_CREATE_DATE + " ORDER BY v." + Vote.PROPERTY_TOPIA_CREATE_DATE, - Vote.PROPERTY_POLL, poll, + Vote.PROPERTY_QUESTION, question, Vote.PROPERTY_TOPIA_CREATE_DATE, since).findAll(); } -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/april in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit dd2c391eb3f0778cd1b64014b1f48ec2302cc43c Author: jcouteau <couteau@codelutin.com> Date: Mon Oct 1 16:35:25 2018 +0200 Fix typo --- .../org/chorem/pollen/services/service/mail/PollInvitationEmail.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/mail/PollInvitationEmail.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/mail/PollInvitationEmail.java index fe8a9b66..e46bb4e0 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/mail/PollInvitationEmail.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/mail/PollInvitationEmail.java @@ -110,7 +110,7 @@ public class PollInvitationEmail extends PollenMail { try { replyTo = Collections.singletonList(new InternetAddress(creator.getEmail(), creator.getName())); } catch (UnsupportedEncodingException e) { - throw new PollenTechnicalException("Error on replyTo adresse", e); + throw new PollenTechnicalException("Error on replyTo adress", e); } } -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/april in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit a4dde9b9fc93fca0c05c52d79d5905c8f227c0d9 Author: jcouteau <couteau@codelutin.com> Date: Tue Oct 2 10:52:00 2018 +0200 refs #221 - Vote associatif : EmailService should be ok --- .../pollen/services/service/mail/EmailService.java | 52 +++++++++++++++++----- 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/mail/EmailService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/mail/EmailService.java index a92d54a5..5272e7d2 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/mail/EmailService.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/mail/EmailService.java @@ -45,6 +45,7 @@ import org.chorem.pollen.persistence.entity.Poll; import org.chorem.pollen.persistence.entity.PollenPrincipal; import org.chorem.pollen.persistence.entity.PollenResource; import org.chorem.pollen.persistence.entity.PollenUser; +import org.chorem.pollen.persistence.entity.Question; import org.chorem.pollen.persistence.entity.Report; import org.chorem.pollen.persistence.entity.UserCredential; import org.chorem.pollen.persistence.entity.Vote; @@ -124,23 +125,26 @@ public class EmailService extends PollenServiceSupport { return timeZone; } - public ChoiceAddedEmail newChoiceAddedEmail(Poll poll, Choice choice) { + public ChoiceAddedEmail newChoiceAddedEmail(Question question, Choice choice) { + //FIXME JC181002 - Modifier l'email pour adapter aux questions ChoiceAddedEmail email = new ChoiceAddedEmail(getLocale(), getTimeZone()); - email.setPoll(poll); + email.setPoll(question.getPoll()); email.setChoice(choice); return email; } - public ChoiceEditedEmail newChoiceEditedEmail(Poll poll, Choice choice) { + public ChoiceEditedEmail newChoiceEditedEmail(Question question, Choice choice) { + //FIXME JC181002 - Modifier l'email pour adapter aux questions ChoiceEditedEmail email = new ChoiceEditedEmail(getLocale(), getTimeZone()); - email.setPoll(poll); + email.setPoll(question.getPoll()); email.setChoice(choice); return email; } - public ChoiceDeletedEmail newChoiceDeletedEmail(Poll poll, Choice choice) { + public ChoiceDeletedEmail newChoiceDeletedEmail(Question question, Choice choice) { + //FIXME JC181002 - Modifier l'email pour adapter aux questions ChoiceDeletedEmail email = new ChoiceDeletedEmail(getLocale(), getTimeZone()); - email.setPoll(poll); + email.setPoll(question.getPoll()); email.setChoice(choice); return email; } @@ -166,16 +170,40 @@ public class EmailService extends PollenServiceSupport { return email; } - public VoteAddedEmail newVoteAddedEmail(Poll poll, Vote vote) { - return new VoteAddedEmail(getLocale(), getTimeZone(), poll, vote); + public CommentAddedEmail newCommentAddedEmail(Question question, Comment comment) { + //FIXME JC181002 - Email spécifique pour les questions ? + CommentAddedEmail email = new CommentAddedEmail(getLocale(), getTimeZone()); + email.setPoll(question.getPoll()); + email.setComment(comment); + return email; + } + + public CommentEditedEmail newCommentEditedEmail(Question question, Comment comment) { + //FIXME JC181002 - Email spécifique pour les questions ? + CommentEditedEmail email = new CommentEditedEmail(getLocale(), getTimeZone()); + email.setPoll(question.getPoll()); + email.setComment(comment); + return email; + } + + public CommentDeletedEmail newCommentDeletedEmail(Question question, Comment comment) { + //FIXME JC181002 - Email spécifique pour les questions ? + CommentDeletedEmail email = new CommentDeletedEmail(getLocale(), getTimeZone()); + email.setPoll(question.getPoll()); + email.setComment(comment); + return email; + } + + public VoteAddedEmail newVoteAddedEmail(Question question, Vote vote) { + return new VoteAddedEmail(getLocale(), getTimeZone(), question.getPoll(), vote); } - public VoteEditedEmail newVoteEditedEmail(Poll poll, Vote vote) { - return new VoteEditedEmail(getLocale(), getTimeZone(), poll, vote); + public VoteEditedEmail newVoteEditedEmail(Question question, Vote vote) { + return new VoteEditedEmail(getLocale(), getTimeZone(), question.getPoll(), vote); } - public VoteDeletedEmail newVoteDeletedEmail(Poll poll, Vote vote) { - return new VoteDeletedEmail(getLocale(), getTimeZone(), poll, vote); + public VoteDeletedEmail newVoteDeletedEmail(Question question, Vote vote) { + return new VoteDeletedEmail(getLocale(), getTimeZone(), question.getPoll(), vote); } public PollCreatedEmail newPollCreatedEmail(Poll poll) { -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/april in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit bf4a2896d1640c9b6158d98b822dc95b85feef8b Author: jcouteau <couteau@codelutin.com> Date: Tue Oct 2 10:56:32 2018 +0200 refs #221 Vote associatif - FeedService should be ok --- .../pollen/services/service/FeedService.java | 32 ++++++++++++++++------ 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/FeedService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/FeedService.java index 862f3b50..e5da0364 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/FeedService.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/FeedService.java @@ -34,6 +34,7 @@ import org.apache.commons.lang3.StringUtils; import org.chorem.pollen.persistence.entity.Choice; import org.chorem.pollen.persistence.entity.Comment; import org.chorem.pollen.persistence.entity.Poll; +import org.chorem.pollen.persistence.entity.Question; import org.chorem.pollen.persistence.entity.Vote; import org.chorem.pollen.services.PollenTechnicalException; import org.chorem.pollen.services.service.security.PollenPermissions; @@ -98,20 +99,20 @@ public class FeedService extends PollenServiceSupport { addFeedEntry(poll, t("pollen.service.feed.pollReopened.title")); } - public void onChoiceAdded(Poll poll, Choice choice) { - addFeedEntry(poll, t("pollen.service.feed.choiceAdded.title")); + public void onChoiceAdded(Question question, Choice choice) { + addFeedEntry(question.getPoll(), t("pollen.service.feed.choiceAdded.title")); } - public void onVoteAdded(Poll poll, Vote vote) { - addVoteFeedEntry(poll, vote, n("pollen.service.feed.voteAdded.title")); + public void onVoteAdded(Question question, Vote vote) { + addVoteFeedEntry(question.getPoll(), vote, n("pollen.service.feed.voteAdded.title")); } - public void onVoteEdited(Poll poll, Vote vote) { - addVoteFeedEntry(poll, vote, n("pollen.service.feed.voteEdited.title")); + public void onVoteEdited(Question question, Vote vote) { + addVoteFeedEntry(question.getPoll(), vote, n("pollen.service.feed.voteEdited.title")); } - public void onVoteDeleted(Poll poll, Vote vote) { - addVoteFeedEntry(poll, vote, n("pollen.service.feed.voteDeleted.title")); + public void onVoteDeleted(Question question, Vote vote) { + addVoteFeedEntry(question.getPoll(), vote, n("pollen.service.feed.voteDeleted.title")); } public void onCommentAdded(Poll poll, Comment comment) { @@ -126,6 +127,21 @@ public class FeedService extends PollenServiceSupport { addFeedEntry(poll, t("pollen.service.feed.commentDeleted.title", comment.getAuthor())); } + public void onCommentAdded(Question question, Comment comment) { + //FIXME JC181002 - FeedEntry spécifique pour questions + addFeedEntry(question.getPoll(), t("pollen.service.feed.commentAdded.title", comment.getAuthor())); + } + + public void onCommentEdited(Question question, Comment comment) { + //FIXME JC181002 - FeedEntry spécifique pour questions + addFeedEntry(question.getPoll(), t("pollen.service.feed.commentEdited.title", comment.getAuthor())); + } + + public void onCommentDeleted(Question question, Comment comment) { + //FIXME JC181002 - FeedEntry spécifique pour questions + addFeedEntry(question.getPoll(), t("pollen.service.feed.commentDeleted.title", comment.getAuthor())); + } + public SyndFeed getFeedForPoll(String pollId) { checkNotNull(pollId); -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/april in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 50b45ff82f498fb34420e3258a1ea8629a9fa139 Author: jcouteau <couteau@codelutin.com> Date: Tue Oct 2 10:59:42 2018 +0200 refs #221 - Vote associatif - ChoiceService should be ok --- .../pollen/services/service/ChoiceService.java | 83 +++++++++++----------- 1 file changed, 42 insertions(+), 41 deletions(-) diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java index d3a89399..180ac988 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java @@ -27,9 +27,9 @@ import org.chorem.pollen.persistence.entity.Choice; import org.chorem.pollen.persistence.entity.ChoiceImpl; import org.chorem.pollen.persistence.entity.ChoiceTopiaDao; import org.chorem.pollen.persistence.entity.ChoiceType; -import org.chorem.pollen.persistence.entity.Poll; import org.chorem.pollen.persistence.entity.PollenPrincipal; import org.chorem.pollen.persistence.entity.PollenResource; +import org.chorem.pollen.persistence.entity.Question; import org.chorem.pollen.services.bean.ChoiceBean; import org.chorem.pollen.services.bean.PollenEntityRef; import org.chorem.pollen.services.bean.ReportResumeBean; @@ -93,56 +93,56 @@ public class ChoiceService extends PollenServiceSupport { return entity; } - public List<ChoiceBean> getChoices(String pollId) { + public List<ChoiceBean> getChoices(String questionId) { checkIsConnectedRequired(); - checkNotNull(pollId); + checkNotNull(questionId); - Poll poll = getPollService().getPoll0(pollId); - checkPermission(PollenPermissions.read(poll)); + Question question = getQuestionService().getQuestion0(questionId); + checkPermission(PollenPermissions.read(question)); - List<Choice> choices = getChoiceDao().findAll(poll); + List<Choice> choices = getChoiceDao().findAll(question); return toBeanList(choices, this::toChoiceBean); } - public ChoiceBean getChoice(String pollId, String choiceId) { + public ChoiceBean getChoice(String questionId, String choiceId) { checkIsConnectedRequired(); - checkNotNull(pollId); + checkNotNull(questionId); checkNotNull(choiceId); - Poll poll = getPollService().getPoll0(pollId); - checkPermission(PollenPermissions.read(poll)); + Question question = getQuestionService().getQuestion0(questionId); + checkPermission(PollenPermissions.read(question)); - Choice choice = getChoice(poll, choiceId); + Choice choice = getChoice(question, choiceId); return toChoiceBean(choice); } - public PollenEntityRef<Choice> addChoice(String pollId, ChoiceBean choice) throws InvalidFormException { + public PollenEntityRef<Choice> addChoice(String questionId, ChoiceBean choice) throws InvalidFormException { checkIsConnectedRequired(); - checkNotNull(pollId); + checkNotNull(questionId); checkNotNull(choice); checkIsNotPersisted(choice); // FIXME 01/06/2018 SBavencoff Evite les modifications concurantes en BD du sondage - synchronized (getLock(pollId)) { + synchronized (getLock(questionId)) { - Poll poll = getPollService().getPoll0(pollId); - checkPermission(PollenPermissions.addChoice(poll)); + Question question = getQuestionService().getQuestion0(questionId); + checkPermission(PollenPermissions.addChoice(question)); - List<Choice> existingChoices = getChoiceDao().findAll(poll); + List<Choice> existingChoices = getChoiceDao().findAll(question); ErrorMap errorMap = checkChoice(existingChoices, choice); errorMap.failIfNotEmpty(); - Choice result = saveChoice(poll, choice); + Choice result = saveChoice(question, choice); commit(); - getNotificationService().onChoiceAdded(poll, result); - getFeedService().onChoiceAdded(poll, result); + getNotificationService().onChoiceAdded(question, result); + getFeedService().onChoiceAdded(question, result); return PollenEntityRef.of(result); @@ -151,41 +151,41 @@ public class ChoiceService extends PollenServiceSupport { } - public ChoiceBean editChoice(String pollId, ChoiceBean choice) throws InvalidFormException { + public ChoiceBean editChoice(String questionId, ChoiceBean choice) throws InvalidFormException { checkIsConnectedRequired(); checkNotNull(choice); checkIsPersisted(choice); - Poll poll = getPollService().getPoll0(pollId); - Choice choiceBd = getChoice(poll, choice.getEntityId()); + Question question = getQuestionService().getQuestion0(questionId); + Choice choiceBd = getChoice(question, choice.getEntityId()); checkPermission(PollenPermissions.edit(choiceBd)); - List<Choice> existingChoices = getChoiceDao().findAll(poll); + List<Choice> existingChoices = getChoiceDao().findAll(question); ErrorMap errorMap = checkChoice(existingChoices, choice); errorMap.failIfNotEmpty(); - Choice result = saveChoice(poll, choice); + Choice result = saveChoice(question, choice); commit(); - getNotificationService().onChoiceEdited(poll, result); + getNotificationService().onChoiceEdited(question, result); return toChoiceBean(result); } - public void deleteChoice(String pollId, String choiceId) throws InvalidFormException { + public void deleteChoice(String questionId, String choiceId) throws InvalidFormException { checkIsConnectedRequired(); - checkNotNull(pollId); + checkNotNull(questionId); checkNotNull(choiceId); - Poll poll = getPollService().getPoll0(pollId); - Choice choice = getChoice(poll, choiceId); + Question question = getQuestionService().getQuestion0(questionId); + Choice choice = getChoice(question, choiceId); checkPermission(PollenPermissions.delete(choice)); - List<Choice> existingChoices = getChoiceDao().findAll(poll); + List<Choice> existingChoices = getChoiceDao().findAll(question); if (existingChoices.size() == 1) { // can't delete this choice @@ -198,18 +198,18 @@ public class ChoiceService extends PollenServiceSupport { getChoiceDao().delete(choice); commit(); - getNotificationService().onChoiceDeleted(poll, choice); + getNotificationService().onChoiceDeleted(question, choice); } - protected Choice getChoice(Poll poll, String choiceId) { + protected Choice getChoice(Question question, String choiceId) { Choice result = getChoiceDao().forTopiaIdEquals(choiceId).findUnique(); - if (!poll.equals(result.getPoll())) { + if (!question.equals(result.getQuestion())) { - throw new InvalidEntityLinkException(Choice.PROPERTY_POLL, result, poll); + throw new InvalidEntityLinkException(Choice.PROPERTY_QUESTION, result, question); } @@ -217,7 +217,7 @@ public class ChoiceService extends PollenServiceSupport { } - protected Choice saveChoice(Poll poll, ChoiceBean choice) { + protected Choice saveChoice(Question question, ChoiceBean choice) { ChoiceTopiaDao choiceDao = getChoiceDao(); @@ -228,7 +228,7 @@ public class ChoiceService extends PollenServiceSupport { // get existing choice - toSave = getChoice(poll, choice.getEntityId()); + toSave = getChoice(question, choice.getEntityId()); if (toSave.getChoiceType() == ChoiceType.RESOURCE) { // check if new resource then delete old resource @@ -258,8 +258,9 @@ public class ChoiceService extends PollenServiceSupport { // principal.setEmail(creator.getEmail()); // } + //FIXME JC181002 - Useless setCreator, overriden later on toSave.setCreator(principal); - toSave.setPoll(poll); + toSave.setQuestion(question); } @@ -273,7 +274,7 @@ public class ChoiceService extends PollenServiceSupport { } toSave.setDescription(choice.getDescription()); - toSave.setCreator(poll.getCreator()); + toSave.setCreator(question.getPoll().getCreator()); return toSave; @@ -376,8 +377,8 @@ public class ChoiceService extends PollenServiceSupport { } - public long getChoiceCount(Poll poll) { + public long getChoiceCount(Question question) { checkIsConnectedRequired(); - return getChoiceDao().forPollEquals(poll).count(); + return getChoiceDao().forQuestionEquals(question).count(); } } -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/april in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 375727c6c848b3ed60f16bd01e7e65ec940fd709 Author: jcouteau <couteau@codelutin.com> Date: Tue Oct 2 14:53:51 2018 +0200 refs #221 - Vote associatif - VoterListService should be ok --- .../chorem/pollen/services/service/VoterListService.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/VoterListService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/VoterListService.java index 3b54d373..2d274335 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/VoterListService.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/VoterListService.java @@ -30,6 +30,7 @@ import org.apache.commons.lang3.tuple.Pair; import org.chorem.pollen.persistence.entity.Poll; import org.chorem.pollen.persistence.entity.PollenPrincipal; import org.chorem.pollen.persistence.entity.PollenUser; +import org.chorem.pollen.persistence.entity.Question; import org.chorem.pollen.persistence.entity.Vote; import org.chorem.pollen.persistence.entity.VoterList; import org.chorem.pollen.persistence.entity.VoterListMember; @@ -48,6 +49,7 @@ import org.nuiton.util.pagination.PaginationParameter; import org.nuiton.util.pagination.PaginationResult; import java.io.IOException; +import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; @@ -850,7 +852,14 @@ public class VoterListService extends PollenServiceSupport { } protected int sendInvitation(Poll poll, List<VoterListMember> members, boolean allMemberNoVoting) { - List<Vote> votes = getVoteDao().forPollEquals(poll).findAll(); + + //get all votes for all questions + List<Question> questions = getQuestionService().getQuestionsforPoll(poll); + List<Vote> votes = new ArrayList<>(); + for (Question question:questions) { + List<Vote> questionVotes = getVoteDao().forQuestionEquals(question).findAll(); + votes.addAll(questionVotes); + } List<VoterListMember> memberToSend; @@ -872,7 +881,7 @@ public class VoterListService extends PollenServiceSupport { getNotificationService().sendInvitation(poll, memberToSend); - // plusieurs membre dans des liste différent peuvent avoir le même email + // plusieurs membre dans des listes différentes peuvent avoir le même email List<PollenPrincipal> pollenPrincipals = memberToSend.stream().map(VoterListMember::getMember).collect(Collectors.toList()); getVoterListMemberDao() -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/april in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 662dccaeed3ef827831a888e4f51092dddd2803d Author: jcouteau <couteau@codelutin.com> Date: Tue Oct 2 15:09:07 2018 +0200 refs #221 - Vote associatif - VoteService should be ok --- .../pollen/services/service/VoteService.java | 148 +++++++++------------ 1 file changed, 66 insertions(+), 82 deletions(-) diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteService.java index 0f780f74..bfb73bcc 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteService.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteService.java @@ -22,20 +22,7 @@ package org.chorem.pollen.services.service; */ import org.apache.commons.collections4.CollectionUtils; -import org.chorem.pollen.persistence.entity.Choice; -import org.chorem.pollen.persistence.entity.Poll; -import org.chorem.pollen.persistence.entity.PollType; -import org.chorem.pollen.persistence.entity.PollenPrincipal; -import org.chorem.pollen.persistence.entity.PollenPrincipalTopiaDao; -import org.chorem.pollen.persistence.entity.PollenUser; -import org.chorem.pollen.persistence.entity.Polls; -import org.chorem.pollen.persistence.entity.Vote; -import org.chorem.pollen.persistence.entity.VoteToChoice; -import org.chorem.pollen.persistence.entity.VoteToChoiceTopiaDao; -import org.chorem.pollen.persistence.entity.VoteToChoices; -import org.chorem.pollen.persistence.entity.VoteTopiaDao; -import org.chorem.pollen.persistence.entity.VoterList; -import org.chorem.pollen.persistence.entity.VoterListMember; +import org.chorem.pollen.persistence.entity.*; import org.chorem.pollen.services.bean.ChoiceBean; import org.chorem.pollen.services.bean.PaginationParameterBean; import org.chorem.pollen.services.bean.PaginationResultBean; @@ -116,7 +103,7 @@ public class VoteService extends PollenServiceSupport { bean.setVoterAvatar(null); } - int maxVoters = getPollService().getMaxVoters(entity.getPoll()); + int maxVoters = getPollService().getMaxVoters(entity.getQuestion().getPoll()); if (maxVoters > 0 && getVoteDao().getVoteIndex(entity) >= maxVoters) { bean.setIgnored(true); bean.getChoice().forEach(vc -> vc.setVoteValue(null)); @@ -140,11 +127,11 @@ public class VoteService extends PollenServiceSupport { return bean; } - public VoteBean getNewVote(String pollId) { + public VoteBean getNewVote(String questionId) { checkIsConnectedRequired(); - Poll poll = getPollService().getPoll0(pollId); - checkPermission(PollenPermissions.addVote(poll)); + Question question = getQuestionService().getQuestion0(questionId); + checkPermission(PollenPermissions.addVote(question)); VoteBean voteBean = new VoteBean(); voteBean.setWeight(1d); @@ -152,15 +139,15 @@ public class VoteService extends PollenServiceSupport { PollenPrincipal mainPrincipal = getSecurityContext().getMainPrincipal(); PollenUser connectedUser = getConnectedUser(); - if (poll.getPollType() == PollType.RESTRICTED) { + if (question.getPoll().getPollType() == PollType.RESTRICTED) { // si si le mainPrincipal a voté List<VoterListMember> voterListMembers = getVoterListMemberDao() .forEquals(VoterListMember.PROPERTY_MEMBER + "." + PollenPrincipal.PROPERTY_EMAIL, mainPrincipal.getEmail()) - .addEquals(VoterListMember.PROPERTY_VOTER_LIST + "." + VoterList.PROPERTY_POLL + "." + Poll.PROPERTY_TOPIA_ID, pollId) + .addEquals(VoterListMember.PROPERTY_VOTER_LIST + "." + VoterList.PROPERTY_POLL + "." + Poll.PROPERTY_TOPIA_ID, question.getPoll().getTopiaId()) .findAll(); - if (CollectionUtils.isNotEmpty(voterListMembers) && !getVoteDao().forPollEquals(poll).addEquals(Vote.PROPERTY_VOTER, mainPrincipal).exists()) { + if (CollectionUtils.isNotEmpty(voterListMembers) && !getVoteDao().forQuestionEquals(question).addEquals(Vote.PROPERTY_VOTER, mainPrincipal).exists()) { voteBean.setVoterName(mainPrincipal.getName()); voteBean.setVoterListMembers(voterListMembers); } else if (connectedUser != null) { @@ -175,7 +162,7 @@ public class VoteService extends PollenServiceSupport { List<VoterListMember> voterListMembers = getVoterListMemberDao() .forEquals(VoterListMember.PROPERTY_MEMBER + "." + PollenPrincipal.PROPERTY_EMAIL, mainPrincipal.getEmail()) - .addEquals(VoterListMember.PROPERTY_VOTER_LIST + "." + VoterList.PROPERTY_POLL + "." + Poll.PROPERTY_TOPIA_ID, pollId) + .addEquals(VoterListMember.PROPERTY_VOTER_LIST + "." + VoterList.PROPERTY_POLL + "." + Poll.PROPERTY_TOPIA_ID, question.getPoll().getTopiaId()) .findAll(); if (voterListMembers != null) { voteBean.setVoterListMembers(voterListMembers); @@ -193,13 +180,13 @@ public class VoteService extends PollenServiceSupport { } - public PaginationResultBean<VoteBean> getVotes(String pollId, PaginationParameterBean paginationParameter) { + public PaginationResultBean<VoteBean> getVotes(String questionId, PaginationParameterBean paginationParameter) { checkIsConnectedRequired(); - checkNotNull(pollId); + checkNotNull(questionId); - Poll poll = getPollService().getPoll0(pollId); - List<Vote> votes = getVotes0(poll).stream() + Question question = getQuestionService().getQuestion0(questionId); + List<Vote> votes = getVotes0(question).stream() .filter(vote -> isPermitted(PollenPermissions.read(vote))) .collect(Collectors.toList()); @@ -209,47 +196,48 @@ public class VoteService extends PollenServiceSupport { } - public VoteBean getVote(String pollId, String voteId) { + public VoteBean getVote(String questionId, String voteId) { checkIsConnectedRequired(); checkNotNull(voteId); - Poll poll = getPollService().getPoll0(pollId); + Question question = getQuestionService().getQuestion0(questionId); - Vote vote = getVote(poll, voteId); + Vote vote = getVote(question, voteId); checkPermission(PollenPermissions.read(vote)); return toVoteBean(vote); } - public PollenEntityRef<Vote> addVote(String pollId, VoteBean vote) throws InvalidFormException { + public PollenEntityRef<Vote> addVote(String questionId, VoteBean vote) throws InvalidFormException { checkIsConnectedRequired(); - checkNotNull(pollId); + checkNotNull(questionId); checkNotNull(vote); checkIsNotPersisted(vote); - Poll poll = getPollService().getPoll0(pollId); - checkPermission(PollenPermissions.addVote(poll)); + Question question = getQuestionService().getQuestion0(questionId); - List<ChoiceBean> choices = getChoiceService().getChoices(pollId); + checkPermission(PollenPermissions.addVote(question)); - ErrorMap errorMap = checkVote(poll, vote, choices); + List<ChoiceBean> choices = getChoiceService().getChoices(questionId); + + ErrorMap errorMap = checkVote(question, vote, choices); errorMap.failIfNotEmpty(); - Vote result = saveVote(poll, vote); + Vote result = saveVote(question, vote); commit(); - getNotificationService().onVoteAdded(poll, result); - getFeedService().onVoteAdded(poll, result); + getNotificationService().onVoteAdded(question, result); + getFeedService().onVoteAdded(question, result); - int maxVoters = getPollService().getMaxVoters(poll); - if (maxVoters > 0 && getVoteCount(poll) > maxVoters) { - boolean notificationSend = getPollDao().setFlagNotificationMaxVoterSend(poll); + int maxVoters = getPollService().getMaxVoters(question.getPoll()); + if (maxVoters > 0 && getVoteCount(question) > maxVoters) { + boolean notificationSend = getPollDao().setFlagNotificationMaxVoterSend(question.getPoll()); if (notificationSend) { commit(); - getNotificationService().onExceedingMaxVoters(poll, maxVoters); + getNotificationService().onExceedingMaxVoters(question.getPoll(), maxVoters); } } @@ -257,49 +245,49 @@ public class VoteService extends PollenServiceSupport { } - public VoteBean editVote(String pollId, VoteBean vote) throws InvalidFormException { + public VoteBean editVote(String questionId, VoteBean vote) throws InvalidFormException { checkIsConnectedRequired(); checkNotNull(vote); checkIsPersisted(vote); - Poll poll = getPollService().getPoll0(pollId); - Vote voteBd = getVote(poll, vote.getEntityId()); + Question question = getQuestionService().getQuestion0(questionId); + Vote voteBd = getVote(question, vote.getEntityId()); checkPermission(PollenPermissions.edit(voteBd)); - List<ChoiceBean> choices = getChoiceService().getChoices(pollId); + List<ChoiceBean> choices = getChoiceService().getChoices(questionId); - ErrorMap errorMap = checkVote(poll, vote, choices); + ErrorMap errorMap = checkVote(question, vote, choices); errorMap.failIfNotEmpty(); - Vote result = saveVote(poll, vote); + Vote result = saveVote(question, vote); commit(); - getNotificationService().onVoteEdited(poll, result); - getFeedService().onVoteEdited(poll, result); + getNotificationService().onVoteEdited(question, result); + getFeedService().onVoteEdited(question, result); return toVoteBean(result); } - public void deleteVote(String pollId, String voteId) throws InvalidFormException { + public void deleteVote(String questionId, String voteId) throws InvalidFormException { checkIsConnectedRequired(); - checkNotNull(pollId); + checkNotNull(questionId); checkNotNull(voteId); - Poll poll = getPollService().getPoll0(pollId); - Vote vote = getVote(poll, voteId); + Question question = getQuestionService().getQuestion0(questionId); + Vote vote = getVote(question, voteId); checkPermission(PollenPermissions.delete(vote)); - ErrorMap errorMap = checkPoll(poll); + ErrorMap errorMap = checkPoll(question.getPoll()); errorMap.failIfNotEmpty(); getVoteDao().delete(vote); commit(); - getNotificationService().onVoteDeleted(poll, vote); - getFeedService().onVoteDeleted(poll, vote); + getNotificationService().onVoteDeleted(question, vote); + getFeedService().onVoteDeleted(question, vote); } @@ -315,19 +303,19 @@ public class VoteService extends PollenServiceSupport { return errors; } - protected <C extends VoteCountingConfig> ErrorMap checkVote(Poll poll, VoteBean vote, List<ChoiceBean> choices) { + protected <C extends VoteCountingConfig> ErrorMap checkVote(Question question, VoteBean vote, List<ChoiceBean> choices) { ErrorMap errors = new ErrorMap(); Set<String> voterNames = new HashSet<>(); - errors.addAllErrors(checkPoll(poll)); + errors.addAllErrors(checkPoll(question.getPoll())); boolean voteExists = vote.isPersisted(); boolean voteNameNotBlank = checkNotBlank(errors, "voter.name", vote.getVoterName(), l(getLocale(), "pollen.error.vote.voterName.mandatory")); if (voteNameNotBlank) { - List<Vote> existingVote = getVoteDao().findAll(poll); + List<Vote> existingVote = getVoteDao().findAll(question); if (CollectionUtils.isNotEmpty(existingVote)) { @@ -349,8 +337,8 @@ public class VoteService extends PollenServiceSupport { } - VoteCounting<?, C> voteCounting = getVoteCountingService().getVoteCounting(poll); - C config = getVoteCountingService().getVoteCountingConfig(poll); + VoteCounting<?, C> voteCounting = getVoteCountingService().getVoteCounting(question); + C config = getVoteCountingService().getVoteCountingConfig(question); ErrorMap valueErrors = getVoteCountingService().checkVote(vote, voteCounting, choices, config); @@ -360,7 +348,7 @@ public class VoteService extends PollenServiceSupport { } - protected Vote saveVote(Poll poll, VoteBean vote) { + protected Vote saveVote(Question question, VoteBean vote) { boolean voteExist = vote.isPersisted(); @@ -369,24 +357,23 @@ public class VoteService extends PollenServiceSupport { //TODO Finish save if (voteExist) { - toSave = getVote(poll, vote.getEntityId()); + toSave = getVote(question, vote.getEntityId()); } else { toSave = getVoteDao().create(); -// toSave.setPostDate(serviceContext.getNow()); PollenPrincipal mainPrincipal = getSecurityContext().getMainPrincipal(); - if (Polls.isPollRestricted(poll)) { + if (Polls.isPollRestricted(question.getPoll())) { // si si le mainPrincipal a voté List<VoterListMember> voterListMembers = getVoterListMemberDao() .forEquals(VoterListMember.PROPERTY_MEMBER + "." + PollenPrincipal.PROPERTY_EMAIL, mainPrincipal.getEmail()) - .addEquals(VoterListMember.PROPERTY_VOTER_LIST + "." + VoterList.PROPERTY_POLL, poll) + .addEquals(VoterListMember.PROPERTY_VOTER_LIST + "." + VoterList.PROPERTY_POLL, question.getPoll().getTopiaId()) .findAll(); - if (CollectionUtils.isNotEmpty(voterListMembers) && !getVoteDao().forPollEquals(poll).addEquals(Vote.PROPERTY_VOTER, mainPrincipal).exists()) { + if (CollectionUtils.isNotEmpty(voterListMembers) && !getVoteDao().forQuestionEquals(question).addEquals(Vote.PROPERTY_VOTER, mainPrincipal).exists()) { // vote pour le mainPrincipal toSave.setVoterListMember(voterListMembers); toSave.setVoter(mainPrincipal); @@ -394,7 +381,7 @@ public class VoteService extends PollenServiceSupport { // vote pour le connectedUser voterListMembers = getVoterListMemberDao() .forEquals(VoterListMember.PROPERTY_MEMBER + "." + PollenPrincipal.PROPERTY_POLLEN_USER, getConnectedUser()) - .addEquals(VoterListMember.PROPERTY_VOTER_LIST + "." + VoterList.PROPERTY_POLL, poll) + .addEquals(VoterListMember.PROPERTY_VOTER_LIST + "." + VoterList.PROPERTY_POLL, question.getPoll().getTopiaId()) .findAll(); toSave.setVoterListMember(voterListMembers); toSave.setVoter(voterListMembers.get(0).getMember()); @@ -404,7 +391,7 @@ public class VoteService extends PollenServiceSupport { if (mainPrincipal != null) { List<VoterListMember> voterListMembers = getVoterListMemberDao().forMemberEquals(mainPrincipal) - .addEquals(VoterListMember.PROPERTY_VOTER_LIST + "." + VoterList.PROPERTY_POLL, poll) + .addEquals(VoterListMember.PROPERTY_VOTER_LIST + "." + VoterList.PROPERTY_POLL, question.getPoll().getTopiaId()) .findAll(); if (!voterListMembers.isEmpty()) { toSave.setVoterListMember(voterListMembers); @@ -423,17 +410,14 @@ public class VoteService extends PollenServiceSupport { } } - toSave.setPoll(poll); + toSave.setQuestion(question); } - toSave.setAnonymous(poll.isAnonymousVoteAllowed()); + toSave.setAnonymous(question.getPoll().isAnonymousVoteAllowed()); // -- author -- // toSave.getVoter().setName(vote.getVoterName()); -// if (StringUtils.isNotBlank(vote.getVoterEmail())) { -// toSave.getVoter().setEmail(getCleanMail(vote.getVoter().getEmail())); -// } PollenUser connectedUser = getConnectedUser(); @@ -479,13 +463,13 @@ public class VoteService extends PollenServiceSupport { } - protected Vote getVote(Poll poll, String voteId) { + protected Vote getVote(Question question, String voteId) { Vote result = getVoteDao().forTopiaIdEquals(voteId).findUnique(); - if (!poll.equals(result.getPoll())) { + if (!question.equals(result.getQuestion())) { - throw new InvalidEntityLinkException(Vote.PROPERTY_POLL, result, poll); + throw new InvalidEntityLinkException(Vote.PROPERTY_QUESTION, result, question); } @@ -493,9 +477,9 @@ public class VoteService extends PollenServiceSupport { } - protected List<Vote> getVotes0(Poll poll) { + protected List<Vote> getVotes0(Question question) { - return getVoteDao().findAll(poll); + return getVoteDao().findAll(question); } @@ -536,10 +520,10 @@ public class VoteService extends PollenServiceSupport { } - public long getVoteCount(Poll poll) { + public long getVoteCount(Question question) { checkIsConnectedRequired(); - return getVoteDao().forPollEquals(poll).count(); + return getVoteDao().forQuestionEquals(question).count(); } public void purgeOldVotes() { -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/april in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 263802851c2f8e2b619d5a893348f7019ef74ecf Merge: 662dccae c5fff77a Author: jcouteau <couteau@codelutin.com> Date: Tue Oct 2 15:19:31 2018 +0200 Merge branch 'feature/april' of gitlab.nuiton.org:chorem/pollen into feature/april .../org/chorem/pollen/services/service/VoteService.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --cc pollen-services/src/main/java/org/chorem/pollen/services/service/VoteService.java index bfb73bcc,0f780f74..ba430ec7 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteService.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteService.java @@@ -22,7 -22,20 +22,21 @@@ package org.chorem.pollen.services.serv */ import org.apache.commons.collections4.CollectionUtils; - import org.chorem.pollen.persistence.entity.*; ++ + import org.chorem.pollen.persistence.entity.Choice; + import org.chorem.pollen.persistence.entity.Poll; + import org.chorem.pollen.persistence.entity.PollType; + import org.chorem.pollen.persistence.entity.PollenPrincipal; + import org.chorem.pollen.persistence.entity.PollenPrincipalTopiaDao; + import org.chorem.pollen.persistence.entity.PollenUser; + import org.chorem.pollen.persistence.entity.Polls; + import org.chorem.pollen.persistence.entity.Vote; + import org.chorem.pollen.persistence.entity.VoteToChoice; + import org.chorem.pollen.persistence.entity.VoteToChoiceTopiaDao; + import org.chorem.pollen.persistence.entity.VoteToChoices; + import org.chorem.pollen.persistence.entity.VoteTopiaDao; + import org.chorem.pollen.persistence.entity.VoterList; + import org.chorem.pollen.persistence.entity.VoterListMember; import org.chorem.pollen.services.bean.ChoiceBean; import org.chorem.pollen.services.bean.PaginationParameterBean; import org.chorem.pollen.services.bean.PaginationResultBean; -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm