01/01: set findAllParticipated without hql
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository pollen. See http://git.chorem.org/pollen.git commit 90e8e43aecff950e15715eb78f34a9a5f8d4ee4d Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Tue Jul 1 12:17:12 2014 +0200 set findAllParticipated without hql --- .../org/chorem/pollen/persistence/entity/PollTopiaDao.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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 55ac87a..a07efa5 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 @@ -28,6 +28,7 @@ import org.nuiton.util.pagination.PaginationParameter; import org.nuiton.util.pagination.PaginationResult; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; import java.util.Set; @@ -48,8 +49,14 @@ public class PollTopiaDao extends AbstractPollTopiaDao<Poll> { } public PaginationResult<Poll> findAllParticipated(PollenUser user, PaginationParameter paginationParameter) { - //TODO - return PaginationResult.of(new ArrayList<Poll>(), 0, paginationParameter); + // TODO : use hql + VoteTopiaDao dao = topiaDaoSupplier.getDao(Vote.class, VoteTopiaDao.class); + List<Vote> votes = dao.forEquals(Vote.PROPERTY_VOTER + "." + PollenPrincipal.PROPERTY_POLLEN_USER, user).findAll(); + Set<Poll> polls = new HashSet<Poll>(); + for (Vote vote : votes) { + polls.add(vote.getPoll()); + } + return PaginationResult.of(new ArrayList<Poll>(polls), 0, paginationParameter); } public Set<Poll> findAllFreePolls() { -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm