Browse code

BM-14022 Fix: reorder repair plugins

Thomas Fricker authored on 31/12/2018 13:19:39
Showing 3 changed files
... ...
@@ -58,7 +58,7 @@ public class MailboxSubtreesRepair implements IDirEntryRepairSupport {
58 58
 		private final BmContext context;
59 59
 
60 60
 		public MailboxSubtreesMaintenance(BmContext ctx) {
61
-			super(ownerSubs.identifier, null, null, 1);
61
+			super(ownerSubs.identifier, null, "mailboxDefaultFolders", 1);
62 62
 			this.context = ctx;
63 63
 		}
64 64
 
... ...
@@ -58,7 +58,7 @@ public class MailboxHsmMigrationMaintenanceOperation extends MailboxMaintenanceO
58 58
 	private static final String MAINTENANCE_OPERATION_ID = DiagnosticReportCheckId.mailboxHsm.name();
59 59
 
60 60
 	public MailboxHsmMigrationMaintenanceOperation(BmContext context) {
61
-		super(context, MAINTENANCE_OPERATION_ID);
61
+		super(context, MAINTENANCE_OPERATION_ID, null, "replication.subtree");
62 62
 	}
63 63
 
64 64
 	@Override
... ...
@@ -101,9 +101,15 @@ public class MailboxRepairSupport implements IDirEntryRepairSupport {
101 101
 		private static final Logger logger = LoggerFactory.getLogger(MailboxMaintenanceOperation.class);
102 102
 
103 103
 		public static enum DiagnosticReportCheckId {
104
-			mailboxExists, mailboxIndexExists, mailboxAclsContainer, mailboxAcls, mailboxHsm, mailboxFilesystem,
105
-			mailboxImapHierarchy, mailboxQuota, mailboxFilters, mailboxPostfixMaps, mailboxSubscription,
106
-			mailboxDefaultFolders
104
+			mailboxExists(true), mailboxIndexExists(true), mailboxAclsContainer(true), mailboxAcls(true), mailboxHsm(
105
+					false), mailboxFilesystem(true), mailboxImapHierarchy(true), mailboxQuota(true), mailboxFilters(
106
+							true), mailboxPostfixMaps(true), mailboxSubscription(true), mailboxDefaultFolders(true);
107
+
108
+			private DiagnosticReportCheckId(boolean sortable) {
109
+				this.sortable = sortable;
110
+			}
111
+
112
+			private final boolean sortable;
107 113
 		}
108 114
 
109 115
 		protected BmContext context;
... ...
@@ -115,15 +121,25 @@ public class MailboxRepairSupport implements IDirEntryRepairSupport {
115 121
 			this.context = context;
116 122
 		}
117 123
 
124
+		public MailboxMaintenanceOperation(BmContext context, String identifier, String beforeOp, String afterOp) {
125
+			super(identifier, beforeOp, afterOp, 1);
126
+
127
+			this.context = context;
128
+		}
129
+
118 130
 		private static String getBeforeOperation(String identifier) {
119 131
 			DiagnosticReportCheckId currentOp = DiagnosticReportCheckId.valueOf(identifier);
132
+			if (!currentOp.sortable) {
133
+				return null;
134
+			}
120 135
 			String previousOp = null;
121 136
 			for (DiagnosticReportCheckId id : DiagnosticReportCheckId.values()) {
122 137
 				if (id == currentOp) {
123 138
 					break;
124 139
 				}
125
-
126
-				previousOp = id.name();
140
+				if (id.sortable) {
141
+					previousOp = id.name();
142
+				}
127 143
 			}
128 144
 
129 145
 			return previousOp;