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 f0484fe4118bb84385361c49b7a20fe103a0c440 Author: jcouteau <couteau@codelutin.com> Date: Wed Sep 12 10:24:41 2018 +0200 refs #210 : RGPD features : fix linter errors --- .../src/main/java/org/chorem/pollen/services/job/RGPDPurgeJob.java | 4 ++++ pollen-ui-riot-js/src/main/web/tag/poll/EditVote.tag.html | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/job/RGPDPurgeJob.java b/pollen-services/src/main/java/org/chorem/pollen/services/job/RGPDPurgeJob.java new file mode 100644 index 00000000..189122b3 --- /dev/null +++ b/pollen-services/src/main/java/org/chorem/pollen/services/job/RGPDPurgeJob.java @@ -0,0 +1,4 @@ +package org.chorem.pollen.services.job; + +public class RGPDPurgeJob { +} 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 f014543f..ca6c685a 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 @@ -298,7 +298,7 @@ if (session.isConnected()) { this.rgpdAccepted = true; } else { - let input = this.refs["rgpdCheckbox"]; + let input = this.refs.rgpdCheckbox; if (!input) { this.rgpdAccepted = false; } else { -- 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 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. --- .../pollen/persistence/entity/VoteTopiaDao.java | 16 +++++++++++ .../rest/api/PollenRestApiApplicationListener.java | 15 ++++++++++ pollen-services/src/main/config/PollenServices.ini | 8 +++++- .../chorem/pollen/services/job/RGPDPurgeJob.java | 23 +++++++++++++-- .../pollen/services/service/PollenUserService.java | 12 ++++++-- .../pollen/services/service/VoteService.java | 33 ++++++++++++++++++++++ .../i18n/pollen-services_en_GB.properties | 1 + .../i18n/pollen-services_fr_FR.properties | 1 + 8 files changed, 103 insertions(+), 6 deletions(-) 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 6af63b31..fe53c91f 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 @@ -23,6 +23,7 @@ package org.chorem.pollen.persistence.entity; import org.nuiton.topia.persistence.HqlAndParametersBuilder; +import java.util.Calendar; import java.util.Date; import java.util.List; @@ -56,4 +57,19 @@ public class VoteTopiaDao extends AbstractVoteTopiaDao<Vote> { Vote.PROPERTY_TOPIA_CREATE_DATE, since).findAll(); } + public List<Vote> findAllOldVotes() { + + HqlAndParametersBuilder<Vote> builder = new HqlAndParametersBuilder<>(Vote.class); + + Calendar cal = Calendar.getInstance(); + cal.add(Calendar.YEAR, -2); + Date twoYearsAgo = cal.getTime(); + + builder.addLowerThan(Vote.PROPERTY_TOPIA_CREATE_DATE, twoYearsAgo); + builder.addNotNull(Vote.PROPERTY_VOTER+"."+PollenPrincipal.PROPERTY_POLLEN_USER); + + List<Vote> oldVotes = findAll(builder.getHql(), builder.getHqlParameters()); + return oldVotes; + } + } diff --git a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/PollenRestApiApplicationListener.java b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/PollenRestApiApplicationListener.java index 469b0317..240198bc 100644 --- a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/PollenRestApiApplicationListener.java +++ b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/PollenRestApiApplicationListener.java @@ -43,6 +43,7 @@ import org.chorem.pollen.services.config.PollenServicesConfig; import org.chorem.pollen.services.job.AbstractPollenJob; import org.chorem.pollen.services.job.CheckMailBoxJob; import org.chorem.pollen.services.job.DeleteObsoleteSessionTokensJob; +import org.chorem.pollen.services.job.RGPDPurgeJob; import org.chorem.pollen.services.job.SendEmailInErrorsJob; import org.chorem.pollen.services.job.SendPollEndReminderJob; import org.quartz.CronScheduleBuilder; @@ -127,6 +128,11 @@ public class PollenRestApiApplicationListener implements ServletContextListener .withIdentity("checkMailBoxJob", "pollenJobs") .build(); + JobDetail rgpdPurgeJob = JobBuilder.newJob(RGPDPurgeJob.class) + .usingJobData(data) + .withIdentity("rgpdPurgeJob", "pollenJobs") + .build(); + try { scheduler = new StdSchedulerFactory().getScheduler(); @@ -169,6 +175,15 @@ public class PollenRestApiApplicationListener implements ServletContextListener scheduler.scheduleJob(checkMailBoxJob, checkMailBoxTrigger); + // schedule rgpd purge + Trigger rgpdPurgeTrigger = TriggerBuilder + .newTrigger() + .withIdentity("rgpdPurgeTrigger", "pollenTriggers") + .withSchedule(CronScheduleBuilder.cronSchedule(applicationConfig.getRgpdPurgeCronSchedule())) + .build(); + + scheduler.scheduleJob(rgpdPurgeJob, rgpdPurgeTrigger); + scheduler.start(); if (log.isDebugEnabled()) { diff --git a/pollen-services/src/main/config/PollenServices.ini b/pollen-services/src/main/config/PollenServices.ini index a708830e..585db685 100644 --- a/pollen-services/src/main/config/PollenServices.ini +++ b/pollen-services/src/main/config/PollenServices.ini @@ -216,4 +216,10 @@ defaultValue = ALL_USERS description = pollen.configuration.deleteObsoleteSessionTokensCronSchedule key = pollen.deleteObsoleteSessionTokensCronSchedule type = string -defaultValue = "0 0/5 * * * ?" \ No newline at end of file +defaultValue = "0 0/5 * * * ?" + +[option rgpdPurgeCronSchedule] +description = pollen.configuration.rpgdPurgeCronSchedule +key = pollen.rgpdPurgeCronSchedule +type = string +defaultValue = "0 0 0 * * ?" \ No newline at end of file diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/job/RGPDPurgeJob.java b/pollen-services/src/main/java/org/chorem/pollen/services/job/RGPDPurgeJob.java index 189122b3..41e95628 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/job/RGPDPurgeJob.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/job/RGPDPurgeJob.java @@ -1,4 +1,23 @@ package org.chorem.pollen.services.job; -public class RGPDPurgeJob { -} +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.pollen.services.service.VoteService; +import org.quartz.DisallowConcurrentExecution; + +@DisallowConcurrentExecution +public class RGPDPurgeJob extends AbstractPollenJob { + + private static final Log log = LogFactory.getLog(CheckMailBoxJob.class); + + @Override + public void execute() { + + if (log.isDebugEnabled()) { + log.debug("Start job to anonymize old votes (RGPD)"); + } + + VoteService voteService = newService(VoteService.class); + voteService.purgeOldVotes(); + } +} \ No newline at end of file diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenUserService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenUserService.java index 942fc24c..6f740777 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenUserService.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenUserService.java @@ -537,14 +537,18 @@ public class PollenUserService extends PollenServiceSupport implements PollenSer } + /** + * Anonymize a user (setting name to "?"), and break links between votes and comments so that we cannot trace back + * the user + * @param user + */ protected void anonymizeUser(PollenUser user) { - PollenPrincipal anonymousUser = getSecurityService().generatePollenPrincipal(); - anonymousUser.setName("?"); - List<Vote> votesUser = getVoteDao().forEquals(Vote.PROPERTY_VOTER + "." + PollenPrincipal.PROPERTY_POLLEN_USER, user).findAll(); for (Vote vote : votesUser) { + PollenPrincipal anonymousUser = getSecurityService().generatePollenPrincipal(); + anonymousUser.setName("?"); vote.setVoter(anonymousUser); vote.setAnonymous(true); } @@ -552,6 +556,8 @@ public class PollenUserService extends PollenServiceSupport implements PollenSer List<Comment> commentsUser = getCommentDao().forEquals(Comment.PROPERTY_AUTHOR + "." + PollenPrincipal.PROPERTY_POLLEN_USER, user).findAll(); for (Comment comment : commentsUser) { + PollenPrincipal anonymousUser = getSecurityService().generatePollenPrincipal(); + anonymousUser.setName("?"); comment.setAuthor(anonymousUser); } 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 852fe3ad..ed703bb5 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 @@ -26,12 +26,14 @@ 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; @@ -46,6 +48,7 @@ import org.chorem.pollen.votecounting.VoteCounting; import org.chorem.pollen.votecounting.model.VoteCountingConfig; import org.nuiton.util.pagination.PaginationResult; +import java.util.ArrayList; import java.util.Collection; import java.util.Date; import java.util.HashSet; @@ -537,4 +540,34 @@ public class VoteService extends PollenServiceSupport { return getVoteDao().forPollEquals(poll).count(); } + + public void purgeOldVotes() { + + PollenPrincipalTopiaDao principalDao = getPollenPrincipalDao(); + + VoteTopiaDao voteDao = getVoteDao(); + + List<Vote> votesToAnon = voteDao.findAllOldVotes(); + + List<PollenPrincipal> principalsToSave = new ArrayList<>(); + List<Vote> votesToSave = new ArrayList<>(); + + for(Vote vote:votesToAnon){ + PollenPrincipal principal = vote.getVoter(); + //Ceinture-bretelles, on vérifie bien que aucun user est lié, + // même si ça devrait jamais être le cas + if (principal.getPollenUser() != null) { + principal.setName("?"); + principalsToSave.add(principal); + vote.setAnonymous(true); + votesToSave.add(vote); + } + } + + //save votes + voteDao.updateAll(votesToSave); + + //save principals + principalDao.updateAll(principalsToSave); + } } diff --git a/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties b/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties index 26ab4fbd..15abe9c9 100644 --- a/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties +++ b/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties @@ -26,6 +26,7 @@ pollen.configuration.report.maxScore=Maximum score for reporting before administ pollen.configuration.resendEmailsCronSchedule=Time between two cron jobs of email resending pollen.configuration.resource.maxSize=Maximum size of pollen resource pollen.configuration.resource.preview.max=Maximum dimension of image preview +pollen.configuration.rpgdPurgeCronSchedule= pollen.configuration.sendEndPollRemindersCronSchedule=Time between two cron jobs of poll end reminder sending pollen.configuration.smptHost=Smtp Host pollen.configuration.smtpFrom=Smtp From diff --git a/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties b/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties index e988b33b..11df2f24 100644 --- a/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties +++ b/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties @@ -26,6 +26,7 @@ pollen.configuration.report.maxScore=Score maximum pour un signalement avant que pollen.configuration.resendEmailsCronSchedule=Intervalle entre deux lancements de la tâche de renvoi des emails en erreur pollen.configuration.resource.maxSize=Taille maximal pour un fichier de resource de Pollen pollen.configuration.resource.preview.max=Dimension maximal de la prévisualisation d'un image +pollen.configuration.rpgdPurgeCronSchedule= pollen.configuration.sendEndPollRemindersCronSchedule=Intervalle entre deux lancements de la tâche d'envoi de mails de rappel de fin de sondage pollen.configuration.smptHost=Hôte smtp pollen.configuration.smtpFrom=Expéditeur -- 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 471c39252e3d9a26ec2545047cd65eb6866818fb Author: jcouteau <couteau@codelutin.com> Date: Wed Sep 19 17:17:17 2018 +0200 fixes #210 - Prendre en compte la RGPD --- docs/config.md | 4 +++- .../chorem/pollen/persistence/entity/VoteTopiaDao.java | 7 +++++-- .../rest/api/PollenRestApiApplicationListener.java | 14 +++++++------- pollen-services/src/main/config/PollenServices.ini | 14 ++++++++++---- .../{RGPDPurgeJob.java => AnonymizeOlderVoteJob.java} | 6 +++--- .../org/chorem/pollen/services/service/VoteService.java | 7 +++++-- .../resources/i18n/pollen-services_en_GB.properties | 2 ++ .../resources/i18n/pollen-services_fr_FR.properties | 2 ++ .../src/main/web/tag/poll/EditVote.tag.html | 17 +---------------- .../src/main/web/tag/poll/EditVoteOrder.tag.html | 16 ++++++++++++++++ 10 files changed, 54 insertions(+), 35 deletions(-) diff --git a/docs/config.md b/docs/config.md index 460001b1..29b02eea 100644 --- a/docs/config.md +++ b/docs/config.md @@ -113,7 +113,9 @@ Si le mail reçu provient d’un retour d’une invitation à un sondage, il ser | pollen.default.maxVoters | Nombre maximum de votes pris en compte pour de sondage standard (0 : pas de limite) | Numérique | 0 | | pollen.default.userConnectedRequired | Seul les utilisateurs connectés peuvent accéder à l'application | Booléen | false | | pollen.default.usersCanCreatePoll | Quels utilisateurs peuvent créer des sondages | All_USERS, USERS_CONNECTED ou USERS_SELECTED | All_USERS | -| pollen.deleteObsoleteSessionTokensCronSchedule | Intervalle entre deux lancements de la suppression des tokens de session obsolètes | CRON | 0 0/5 * * * ? | +| pollen.deleteObsoleteSessionTokensCronSchedule | Intervalle entre deux lancements de la suppression des tokens de session obsolètes | CRON | 0 0/5 * * * ? | +| pollen.anonymizeOlderVotesCronSchedule | Intervalle entre deux lancements de l'anonymisation des anciens votes | CRON | 0 0 0 * * ? | + Site public ----------- 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 fe53c91f..bf627b6a 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 @@ -29,6 +29,8 @@ import java.util.List; public class VoteTopiaDao extends AbstractVoteTopiaDao<Vote> { + public static final String ANONYMOUS_NAME = "?"; + public List<Vote> findAll(Poll poll) { return forPollEquals(poll) @@ -57,16 +59,17 @@ public class VoteTopiaDao extends AbstractVoteTopiaDao<Vote> { Vote.PROPERTY_TOPIA_CREATE_DATE, since).findAll(); } - public List<Vote> findAllOldVotes() { + public List<Vote> findAllOldVotes(int age) { HqlAndParametersBuilder<Vote> builder = new HqlAndParametersBuilder<>(Vote.class); Calendar cal = Calendar.getInstance(); - cal.add(Calendar.YEAR, -2); + cal.add(Calendar.SECOND, -1*age); Date twoYearsAgo = cal.getTime(); builder.addLowerThan(Vote.PROPERTY_TOPIA_CREATE_DATE, twoYearsAgo); builder.addNotNull(Vote.PROPERTY_VOTER+"."+PollenPrincipal.PROPERTY_POLLEN_USER); + builder.addNotEquals(Vote.PROPERTY_VOTER+"."+PollenPrincipal.PROPERTY_POLLEN_USER, ANONYMOUS_NAME); List<Vote> oldVotes = findAll(builder.getHql(), builder.getHqlParameters()); return oldVotes; diff --git a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/PollenRestApiApplicationListener.java b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/PollenRestApiApplicationListener.java index 240198bc..e81186d7 100644 --- a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/PollenRestApiApplicationListener.java +++ b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/PollenRestApiApplicationListener.java @@ -43,7 +43,7 @@ import org.chorem.pollen.services.config.PollenServicesConfig; import org.chorem.pollen.services.job.AbstractPollenJob; import org.chorem.pollen.services.job.CheckMailBoxJob; import org.chorem.pollen.services.job.DeleteObsoleteSessionTokensJob; -import org.chorem.pollen.services.job.RGPDPurgeJob; +import org.chorem.pollen.services.job.AnonymizeOlderVoteJob; import org.chorem.pollen.services.job.SendEmailInErrorsJob; import org.chorem.pollen.services.job.SendPollEndReminderJob; import org.quartz.CronScheduleBuilder; @@ -128,9 +128,9 @@ public class PollenRestApiApplicationListener implements ServletContextListener .withIdentity("checkMailBoxJob", "pollenJobs") .build(); - JobDetail rgpdPurgeJob = JobBuilder.newJob(RGPDPurgeJob.class) + JobDetail anonymizeOlderVotesJob = JobBuilder.newJob(AnonymizeOlderVoteJob.class) .usingJobData(data) - .withIdentity("rgpdPurgeJob", "pollenJobs") + .withIdentity("anonymizeOlderVotesJob", "pollenJobs") .build(); try { @@ -176,13 +176,13 @@ public class PollenRestApiApplicationListener implements ServletContextListener scheduler.scheduleJob(checkMailBoxJob, checkMailBoxTrigger); // schedule rgpd purge - Trigger rgpdPurgeTrigger = TriggerBuilder + Trigger anonymizeOlderVotesTrigger = TriggerBuilder .newTrigger() - .withIdentity("rgpdPurgeTrigger", "pollenTriggers") - .withSchedule(CronScheduleBuilder.cronSchedule(applicationConfig.getRgpdPurgeCronSchedule())) + .withIdentity("anonymizeOlderVotesTrigger", "pollenTriggers") + .withSchedule(CronScheduleBuilder.cronSchedule(applicationConfig.getAnonymizeOlderVotesCronSchedule())) .build(); - scheduler.scheduleJob(rgpdPurgeJob, rgpdPurgeTrigger); + scheduler.scheduleJob(anonymizeOlderVotesJob, anonymizeOlderVotesTrigger); scheduler.start(); diff --git a/pollen-services/src/main/config/PollenServices.ini b/pollen-services/src/main/config/PollenServices.ini index 585db685..6cdba5d4 100644 --- a/pollen-services/src/main/config/PollenServices.ini +++ b/pollen-services/src/main/config/PollenServices.ini @@ -218,8 +218,14 @@ key = pollen.deleteObsoleteSessionTokensCronSchedule type = string defaultValue = "0 0/5 * * * ?" -[option rgpdPurgeCronSchedule] -description = pollen.configuration.rpgdPurgeCronSchedule -key = pollen.rgpdPurgeCronSchedule +[option anonymizeOlderVotesCronSchedule] +description = pollen.configuration.anonymizeOlderVotesCronSchedule +key = pollen.anonymizeOlderVotesCronSchedule type = string -defaultValue = "0 0 0 * * ?" \ No newline at end of file +defaultValue = "0 0 0 * * ?" + +[option anonymizeOlderVotesAge] +description = pollen.configuration.anonymizeOlderVotesAge +key = pollen.anonymizeOlderVotesAge +type = int +defaultValue = 63072000 \ No newline at end of file diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/job/RGPDPurgeJob.java b/pollen-services/src/main/java/org/chorem/pollen/services/job/AnonymizeOlderVoteJob.java similarity index 68% rename from pollen-services/src/main/java/org/chorem/pollen/services/job/RGPDPurgeJob.java rename to pollen-services/src/main/java/org/chorem/pollen/services/job/AnonymizeOlderVoteJob.java index 41e95628..f2e3176b 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/job/RGPDPurgeJob.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/job/AnonymizeOlderVoteJob.java @@ -6,15 +6,15 @@ import org.chorem.pollen.services.service.VoteService; import org.quartz.DisallowConcurrentExecution; @DisallowConcurrentExecution -public class RGPDPurgeJob extends AbstractPollenJob { +public class AnonymizeOlderVoteJob extends AbstractPollenJob { - private static final Log log = LogFactory.getLog(CheckMailBoxJob.class); + private static final Log log = LogFactory.getLog(AnonymizeOlderVoteJob.class); @Override public void execute() { if (log.isDebugEnabled()) { - log.debug("Start job to anonymize old votes (RGPD)"); + log.debug("Start job to anonymize old votes"); } VoteService voteService = newService(VoteService.class); 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 ed703bb5..0f780f74 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 @@ -43,6 +43,7 @@ import org.chorem.pollen.services.bean.PollenEntityRef; import org.chorem.pollen.services.bean.ReportResumeBean; import org.chorem.pollen.services.bean.VoteBean; import org.chorem.pollen.services.bean.VoteToChoiceBean; +import org.chorem.pollen.services.config.PollenServicesConfig; import org.chorem.pollen.services.service.security.PollenPermissions; import org.chorem.pollen.votecounting.VoteCounting; import org.chorem.pollen.votecounting.model.VoteCountingConfig; @@ -546,8 +547,10 @@ public class VoteService extends PollenServiceSupport { PollenPrincipalTopiaDao principalDao = getPollenPrincipalDao(); VoteTopiaDao voteDao = getVoteDao(); + + PollenServicesConfig applicationConfig = getPollenServiceConfig(); - List<Vote> votesToAnon = voteDao.findAllOldVotes(); + List<Vote> votesToAnon = voteDao.findAllOldVotes(applicationConfig.getAnonymizeOlderVotesAge()); List<PollenPrincipal> principalsToSave = new ArrayList<>(); List<Vote> votesToSave = new ArrayList<>(); @@ -557,7 +560,7 @@ public class VoteService extends PollenServiceSupport { //Ceinture-bretelles, on vérifie bien que aucun user est lié, // même si ça devrait jamais être le cas if (principal.getPollenUser() != null) { - principal.setName("?"); + principal.setName(VoteTopiaDao.ANONYMOUS_NAME); principalsToSave.add(principal); vote.setAnonymous(true); votesToSave.add(vote); diff --git a/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties b/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties index 15abe9c9..49f01d06 100644 --- a/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties +++ b/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties @@ -1,4 +1,6 @@ PollenServicesConfig.description=Pollen Backend configuration +pollen.configuration.anonymizeOlderVotesAge=Minimum age of anonymized votes (in seconds). Older votes gets anonymized +pollen.configuration.anonymizeOlderVotesCronSchedule=Time between two vote anonymisation cron jobs pollen.configuration.data.directory=Directory where Pollen stores his data pollen.configuration.defaultCommentNotification=Default notification type for the comments of a poll pollen.configuration.defaultCommentVisibility=Default comment visibility diff --git a/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties b/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties index 11df2f24..b21fddcf 100644 --- a/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties +++ b/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties @@ -1,4 +1,6 @@ PollenServicesConfig.description=Configuration du backend de Pollen +pollen.configuration.anonymizeOlderVotesAge=Age minimum des votes anonymisés (en secondes). Les votes plus agés sont anonymisés +pollen.configuration.anonymizeOlderVotesCronSchedule=Intervalle entre deux lancements de l'anonymisation des anciens votes pollen.configuration.data.directory=Répertoire de données de l'application pollen.configuration.defaultCommentNotification=Type de notification par défaut pour les commentaires pollen.configuration.defaultCommentVisibility=Visibilité des commentaires par défaut 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 ca6c685a..a387c43f 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 @@ -122,8 +122,6 @@ <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" @@ -141,7 +139,7 @@ type="submit" name="newVote" tabindex="{(poll.choices.length + 1) * 10}" - disabled={tooManyChoicesSelected || remainPoints || voting || (!rgpdAccepted && !session.isConnected())}> + disabled={tooManyChoicesSelected || remainPoints || voting}> <i class="fa fa-envelope"></i> {_t.toVote} </button> @@ -294,19 +292,6 @@ 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; diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/EditVoteOrder.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/EditVoteOrder.tag.html index bbdf5ccd..3d11cf8e 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/EditVoteOrder.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/EditVoteOrder.tag.html @@ -105,6 +105,21 @@ </div> </div> </Draggable> + + <div class="o-form-element" if={!session.isConnected()}> + <label class="c-field c-field--choice gtu-validation"> + <input type="checkbox" + 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> </form> </div> @@ -115,6 +130,7 @@ import poll from "../../js/Poll.js"; this.loaded = false; + this.session = session; this.moment = moment; this.installBundle(session, "poll_votes"); -- 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 e8360a65d677f53a0b3f2f926b26f51a0efb09f4 Author: jcouteau <couteau@codelutin.com> Date: Thu Sep 20 11:59:08 2018 +0200 fixes #210 : Cleaning code and doc --- docs/config.md | 1 + .../main/java/org/chorem/pollen/persistence/entity/VoteTopiaDao.java | 1 + .../java/org/chorem/pollen/services/service/PollenUserService.java | 5 +++-- .../src/main/resources/i18n/pollen-services_en_GB.properties | 1 - .../src/main/resources/i18n/pollen-services_fr_FR.properties | 1 - 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/config.md b/docs/config.md index 29b02eea..4f578225 100644 --- a/docs/config.md +++ b/docs/config.md @@ -115,6 +115,7 @@ Si le mail reçu provient d’un retour d’une invitation à un sondage, il ser | pollen.default.usersCanCreatePoll | Quels utilisateurs peuvent créer des sondages | All_USERS, USERS_CONNECTED ou USERS_SELECTED | All_USERS | | pollen.deleteObsoleteSessionTokensCronSchedule | Intervalle entre deux lancements de la suppression des tokens de session obsolètes | CRON | 0 0/5 * * * ? | | pollen.anonymizeOlderVotesCronSchedule | Intervalle entre deux lancements de l'anonymisation des anciens votes | CRON | 0 0 0 * * ? | +| pollen.anonymizeOlderVotesAge | Age minimum des votes anonymisés (en secondes). Les votes plus agés sont anonymisés | Numérique | 63072000 | Site public 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 bf627b6a..7e946a4d 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 @@ -26,6 +26,7 @@ import org.nuiton.topia.persistence.HqlAndParametersBuilder; import java.util.Calendar; import java.util.Date; import java.util.List; +import java.util.Map; public class VoteTopiaDao extends AbstractVoteTopiaDao<Vote> { diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenUserService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenUserService.java index 6f740777..9b060618 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenUserService.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenUserService.java @@ -33,6 +33,7 @@ import org.chorem.pollen.persistence.entity.PollenUserEmailAddress; import org.chorem.pollen.persistence.entity.ResourceType; import org.chorem.pollen.persistence.entity.UserCredential; import org.chorem.pollen.persistence.entity.Vote; +import org.chorem.pollen.persistence.entity.VoteTopiaDao; import org.chorem.pollen.services.PollenService; import org.chorem.pollen.services.bean.PaginationParameterBean; import org.chorem.pollen.services.bean.PaginationResultBean; @@ -548,7 +549,7 @@ public class PollenUserService extends PollenServiceSupport implements PollenSer for (Vote vote : votesUser) { PollenPrincipal anonymousUser = getSecurityService().generatePollenPrincipal(); - anonymousUser.setName("?"); + anonymousUser.setName(VoteTopiaDao.ANONYMOUS_NAME); vote.setVoter(anonymousUser); vote.setAnonymous(true); } @@ -557,7 +558,7 @@ public class PollenUserService extends PollenServiceSupport implements PollenSer for (Comment comment : commentsUser) { PollenPrincipal anonymousUser = getSecurityService().generatePollenPrincipal(); - anonymousUser.setName("?"); + anonymousUser.setName(VoteTopiaDao.ANONYMOUS_NAME); comment.setAuthor(anonymousUser); } diff --git a/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties b/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties index 49f01d06..06aa85e7 100644 --- a/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties +++ b/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties @@ -28,7 +28,6 @@ pollen.configuration.report.maxScore=Maximum score for reporting before administ pollen.configuration.resendEmailsCronSchedule=Time between two cron jobs of email resending pollen.configuration.resource.maxSize=Maximum size of pollen resource pollen.configuration.resource.preview.max=Maximum dimension of image preview -pollen.configuration.rpgdPurgeCronSchedule= pollen.configuration.sendEndPollRemindersCronSchedule=Time between two cron jobs of poll end reminder sending pollen.configuration.smptHost=Smtp Host pollen.configuration.smtpFrom=Smtp From diff --git a/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties b/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties index b21fddcf..3221b2e0 100644 --- a/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties +++ b/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties @@ -28,7 +28,6 @@ pollen.configuration.report.maxScore=Score maximum pour un signalement avant que pollen.configuration.resendEmailsCronSchedule=Intervalle entre deux lancements de la tâche de renvoi des emails en erreur pollen.configuration.resource.maxSize=Taille maximal pour un fichier de resource de Pollen pollen.configuration.resource.preview.max=Dimension maximal de la prévisualisation d'un image -pollen.configuration.rpgdPurgeCronSchedule= pollen.configuration.sendEndPollRemindersCronSchedule=Intervalle entre deux lancements de la tâche d'envoi de mails de rappel de fin de sondage pollen.configuration.smptHost=Hôte smtp pollen.configuration.smtpFrom=Expéditeur -- 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 517ef04df6623c66ff1d272d8077bacbd48d144e Author: jcouteau <couteau@codelutin.com> Date: Fri Sep 21 16:04:12 2018 +0200 fixes #227 - Liste d'émargement sans email --- .../pollen/services/service/VoterListService.java | 28 +++++++++++++++++++--- .../src/main/web/tag/poll/Participants.tag.html | 18 ++++---------- 2 files changed, 29 insertions(+), 17 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 17b1bdfa..3b54d373 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 @@ -90,6 +90,29 @@ public class VoterListService extends PollenServiceSupport { return bean; } + /** + * Same as {@link this.toVoterListMemberBean()} with only name, avatar and voting + * @param entity + * @return + */ + public VoterListMemberBean toVoterListMemberLightBean(VoterListMember entity) { + + VoterListMemberBean bean = new VoterListMemberBean(); + + PollenPrincipal pollenPrincipal = entity.getMember(); + if (pollenPrincipal != null) { + bean.setName(pollenPrincipal.getName()); + if (pollenPrincipal.getPollenUser() != null && pollenPrincipal.getPollenUser().getAvatar() != null) { + bean.setAvatar(getPollenResourceService().getReduceIdByTopiaId(pollenPrincipal.getPollenUser().getAvatar().getTopiaId())); + } + } + + boolean voting = getVoteDao().forVoterListMemberContains(entity).exists(); + bean.setVoting(voting); + + return bean; + } + public VoterListBean toVoterListBean(VoterList entity) { checkIsConnectedRequired(); @@ -246,7 +269,7 @@ public class VoterListService extends PollenServiceSupport { .forProperties(VoterListMember.PROPERTY_VOTER_LIST + "." + VoterList.PROPERTY_POLL, poll) .findPage(paginationParameter1); - return toPaginationListBean(result, this::toVoterListMemberBean); + return toPaginationListBean(result, this::toVoterListMemberLightBean); } public ExportBean exportAllVoterListMembers(String pollId) { @@ -261,11 +284,10 @@ public class VoterListService extends PollenServiceSupport { .setOrderByArguments(VoterListMember.PROPERTY_MEMBER + "." + PollenPrincipal.PROPERTY_NAME) .findAll(); - ImmutableList<VoterListMemberBean> memberBeans = toBeanList(members, this::toVoterListMemberBean); + ImmutableList<VoterListMemberBean> memberBeans = toBeanList(members, this::toVoterListMemberLightBean); Exporter<VoterListMemberBean> beanExporter = new ExporterBuilder<VoterListMemberBean>() .addColumn(PollenPrincipal.PROPERTY_NAME, VoterListMemberBean::getName) - .addColumn(PollenPrincipal.PROPERTY_EMAIL, VoterListMemberBean::getEmail) .addColumn("voting", VoterListMemberBean::isVoting, b -> Boolean.toString(b)) .build(); diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Participants.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Participants.tag.html index 25b550e5..f77381f8 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Participants.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Participants.tag.html @@ -46,13 +46,8 @@ <div class="avatar"> <Avatar avatar={element.avatar} name={element.name} rounded="true"/> </div> - <div class="name-email"> - <div class="name"> - {element.name} - </div> - <div class="email"> - {element.email} - </div> + <div class="name"> + {element.name} </div> </div> </yield> @@ -62,13 +57,8 @@ <div class="avatar"> <i class="fa fa-user-circle c-icon"></i> </div> - <div class="name-email"> - <div class="name"> - <i class="fa fa-spinner fa-pulse"></i> - </div> - <div class="email"> - <i class="fa fa-spinner fa-pulse"></i> - </div> + <div class="name"> + <i class="fa fa-spinner fa-pulse"></i> </div> </div> </yield> -- 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 ff245d01532f1b643d47b1df4ba84eda7350f4d1 Author: jcouteau <couteau@codelutin.com> Date: Fri Sep 21 16:25:42 2018 +0200 Quick permissions fix --- pollen-ui-riot-js/src/main/web/tag/poll/Participants.tag.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Participants.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Participants.tag.html index f77381f8..3f1206ba 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Participants.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Participants.tag.html @@ -27,7 +27,7 @@ <div if="{poll.participantsIsVisible}" class="participants-body" > <div class="actions-right"> <a class="c-button c-button--info" - href="{parent.session.configuration.endPoint}/v1/polls/{poll.id}/participants/exports" + href="{parent.session.configuration.endPoint}/v1/polls/{poll.id}/participants/exports?{poll.permission ? 'permission=' + poll.permission : ''}" target="_blank" title={_t.download_title}> <i class="fa fa-download"></i> -- 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 ae096ef27de8c4dd6b06d0ddbca5d4102d81c66b Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Fri Sep 21 17:03:35 2018 +0200 add header file --- .../pollen/services/job/AnonymizeOlderVoteJob.java | 23 +++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/job/AnonymizeOlderVoteJob.java b/pollen-services/src/main/java/org/chorem/pollen/services/job/AnonymizeOlderVoteJob.java index f2e3176b..228a78bd 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/job/AnonymizeOlderVoteJob.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/job/AnonymizeOlderVoteJob.java @@ -1,5 +1,26 @@ package org.chorem.pollen.services.job; +/*- + * #%L + * Pollen :: Service + * %% + * Copyright (C) 2009 - 2018 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.pollen.services.service.VoteService; @@ -20,4 +41,4 @@ public class AnonymizeOlderVoteJob extends AbstractPollenJob { VoteService voteService = newService(VoteService.class); voteService.purgeOldVotes(); } -} \ No newline at end of file +} -- 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