From ec62249fb8dff1c6dd9347933a7915dba76c8275 Mon Sep 17 00:00:00 2001
From: Peter Hormanns <peter.hormanns@jalin.de>
Date: Fri, 21 Sep 2012 17:39:25 +0200
Subject: [PATCH] revert domain selection with postgrey domainoption

---
 hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java b/hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java
index be6a826..d3dc673 100644
--- a/hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java
+++ b/hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java
@@ -193,8 +193,11 @@
 	
 	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) {

--
Gitblit v1.9.0-SNAPSHOT