revert domain selection with postgrey domainoption

This commit is contained in:
Peter Hormanns 2012-09-21 17:39:25 +02:00
parent f33c40fad7
commit ec62249fb8

View File

@ -193,8 +193,11 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
private Processor createPostgreyConfiguration(EntityManager em) throws ProcessorException {
ArrayList<Map<String, String>> domsMaps = new ArrayList<Map<String, String>>();
Query query = em.createQuery("SELECT d FROM Domains d WHERE d.domainoptions.name = :option");
query.setParameter("option", "nogreylisting");
Query query = em.createQuery("SELECT DISTINCT dom FROM Domains WHERE NOT EXISTS " +
"( SELECT postgreyDom FROM Domains postgreyDom " +
" WHERE postgreyDom.domainoptions.name = :option" +
" AND postgreyDom.name = dom.name )");
query.setParameter("option", "greylisting");
List<?> result = query.getResultList();
for (Object dom : result) {
if (dom instanceof Domain) {