Commit 9025e382 by Juho Juopperi

Merge branch 'votelistfix' into 'master'

Votelistfix
2 parents d1e979ff 7c81f2f5
...@@ -190,4 +190,9 @@ public class VotingBean implements VotingBeanLocal { ...@@ -190,4 +190,9 @@ public class VotingBean implements VotingBeanLocal {
compoEntryFileFacade.create(cef); compoEntryFileFacade.create(cef);
} }
@Override
public List<CompoEntry> getEntriesForCurrentUser() {
EventUser user = permissionBean.getCurrentUser();
return compoEntryFacade.findUsersEntries(user);
}
} }
package fi.codecrew.moya.facade; package fi.codecrew.moya.facade;
import java.util.List;
import javax.ejb.LocalBean; import javax.ejb.LocalBean;
import javax.ejb.Stateless; import javax.ejb.Stateless;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;
import fi.codecrew.moya.model.CompoEntry; import fi.codecrew.moya.model.CompoEntry;
import fi.codecrew.moya.model.CompoEntry_;
import fi.codecrew.moya.model.EventUser;
@Stateless @Stateless
@LocalBean @LocalBean
...@@ -14,4 +21,11 @@ public class CompoEntryFacade extends IntegerPkGenericFacade<CompoEntry> { ...@@ -14,4 +21,11 @@ public class CompoEntryFacade extends IntegerPkGenericFacade<CompoEntry> {
super(CompoEntry.class); super(CompoEntry.class);
} }
public List<CompoEntry> findUsersEntries(EventUser user) {
CriteriaBuilder cb = getEm().getCriteriaBuilder();
CriteriaQuery<CompoEntry> cq = cb.createQuery(CompoEntry.class);
Root<CompoEntry> root = cq.from(CompoEntry.class);
cq.where(cb.equal(root.get(CompoEntry_.creator), user));
return getEm().createQuery(cq).getResultList();
}
} }
...@@ -39,4 +39,6 @@ public interface VotingBeanLocal { ...@@ -39,4 +39,6 @@ public interface VotingBeanLocal {
public void create(CompoEntryFile cef); public void create(CompoEntryFile cef);
public List<CompoEntry> getEntriesForCurrentUser();
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!