Browse code

BM-14371 Fix: delete domain filters prior to domain deletion

Thomas Fricker authored on 14/03/2019 13:53:51
Showing 3 changed files
... ...
@@ -64,6 +64,8 @@ import net.bluemind.group.api.IGroup;
64 64
 import net.bluemind.hornetq.client.MQ;
65 65
 import net.bluemind.hornetq.client.OOPMessage;
66 66
 import net.bluemind.hornetq.client.Topic;
67
+import net.bluemind.mailbox.api.IMailboxes;
68
+import net.bluemind.mailbox.api.MailFilter;
67 69
 import net.bluemind.mailbox.api.Mailbox.Routing;
68 70
 import net.bluemind.resource.api.type.IResourceTypes;
69 71
 import net.bluemind.role.api.BasicRoles;
... ...
@@ -268,6 +270,9 @@ public class DomainsService implements IDomains {
268 270
 	}
269 271
 
270 272
 	private void deepDelete(ItemValue<Domain> domain) throws ServerFault {
273
+		logger.info("Deleting domain mail filters of domain {}", domain.uid);
274
+		context.provider().instance(IMailboxes.class, domain.uid).setDomainFilter(new MailFilter());
275
+
271 276
 		IDirectory dir = context.provider().instance(IDirectory.class, domain.uid);
272 277
 
273 278
 		List<DirEntry> entries = dir.getEntries(domain.uid);
... ...
@@ -55,12 +55,6 @@
55 55
          </reg>
56 56
       </extension>
57 57
       <extension
58
-            point="net.bluemind.domain.domainHook">
59
-         <hook
60
-               class="net.bluemind.mailbox.service.hook.DomainMailFilterHook">
61
-         </hook>
62
-      </extension>
63
-      <extension
64 58
             point="net.bluemind.mailmessage.mailtip">
65 59
          <evaluation
66 60
                impl="net.bluemind.mailbox.service.mailtip.OverQuotaMailTipEvaluation">
67 61
deleted file mode 100644
... ...
@@ -1,42 +0,0 @@
1
-/* BEGIN LICENSE
2
- * Copyright © Blue Mind SAS, 2012-2018
3
- *
4
- * This file is part of BlueMind. BlueMind is a messaging and collaborative
5
- * solution.
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of either the GNU Affero General Public License as
9
- * published by the Free Software Foundation (version 3 of the License).
10
- *
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15
- *
16
- * See LICENSE.txt
17
- * END LICENSE
18
- */
19
-package net.bluemind.mailbox.service.hook;
20
-
21
-import org.slf4j.Logger;
22
-import org.slf4j.LoggerFactory;
23
-
24
-import net.bluemind.core.api.fault.ServerFault;
25
-import net.bluemind.core.container.model.ItemValue;
26
-import net.bluemind.core.rest.BmContext;
27
-import net.bluemind.domain.api.Domain;
28
-import net.bluemind.domain.hook.DomainHookAdapter;
29
-import net.bluemind.mailbox.api.IMailboxes;
30
-import net.bluemind.mailbox.api.MailFilter;
31
-
32
-public class DomainMailFilterHook extends DomainHookAdapter {
33
-
34
-	public static final Logger logger = LoggerFactory.getLogger(DomainMailFilterHook.class);
35
-
36
-	@Override
37
-	public void onBeforeDelete(BmContext context, ItemValue<Domain> domain) throws ServerFault {
38
-		logger.info("Deleting domain mail filters of domain {}", domain.uid);
39
-		context.su().provider().instance(IMailboxes.class, domain.uid).setDomainFilter(new MailFilter());
40
-	}
41
-
42
-}