Commit 70882ce7 by Tuomas Riihimäki

Do not show disabled cards.

1 parent b51948dd
...@@ -3,7 +3,6 @@ package fi.codecrew.moya.facade; ...@@ -3,7 +3,6 @@ package fi.codecrew.moya.facade;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.List; import java.util.List;
import javax.ejb.EJB; import javax.ejb.EJB;
...@@ -101,9 +100,10 @@ public class PrintedCardFacade extends IntegerPkGenericFacade<PrintedCard> { ...@@ -101,9 +100,10 @@ public class PrintedCardFacade extends IntegerPkGenericFacade<PrintedCard> {
CriteriaBuilder cb = getEm().getCriteriaBuilder(); CriteriaBuilder cb = getEm().getCriteriaBuilder();
CriteriaQuery<PrintedCard> cq = cb.createQuery(PrintedCard.class); CriteriaQuery<PrintedCard> cq = cb.createQuery(PrintedCard.class);
Root<PrintedCard> root = cq.from(PrintedCard.class); Root<PrintedCard> root = cq.from(PrintedCard.class);
List<Predicate> preds = new ArrayList<Predicate>(); List<Predicate> preds = new ArrayList<Predicate>();
preds.add(cb.isTrue(root.get(PrintedCard_.enabled)));
preds.add(cb.equal(root.get(PrintedCard_.event), eventbean.getCurrentEvent())); preds.add(cb.equal(root.get(PrintedCard_.event), eventbean.getCurrentEvent()));
if (state.length > 0) { if (state.length > 0) {
...@@ -111,15 +111,15 @@ public class PrintedCardFacade extends IntegerPkGenericFacade<PrintedCard> { ...@@ -111,15 +111,15 @@ public class PrintedCardFacade extends IntegerPkGenericFacade<PrintedCard> {
} }
cq.where(preds.toArray(new Predicate[preds.size()])); cq.where(preds.toArray(new Predicate[preds.size()]));
cq.orderBy(cb.asc(root.get(PrintedCard_.user)), cb.asc(root.get(PrintedCard_.template).get(CardTemplate_.power))); cq.orderBy(cb.asc(root.get(PrintedCard_.template).get(CardTemplate_.power)));
List<PrintedCard> pcl = getEm().createQuery(cq).getResultList(); List<PrintedCard> pcl = getEm().createQuery(cq).getResultList();
HashMap<Integer, PrintedCard> pch = new HashMap<>(); HashMap<Integer, PrintedCard> pch = new HashMap<>();
for(PrintedCard pc : pcl) { for (PrintedCard pc : pcl) {
pch.put(pc.getUser().getId(), pc); pch.put(pc.getUser().getId(), pc);
} }
return new ArrayList<PrintedCard>(pch.values()); return new ArrayList<PrintedCard>(pch.values());
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!