aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2013-09-05 16:49:26 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2013-09-05 16:49:26 +0200
commitce7a0f35a776f0bcd5d179a239042bcd97b7e3be (patch)
tree5a71ce2de6cbf2545199cf2d60e5807e928b0c35
parentdc7fa6d03c5dbde59c3c6db9aeee9378c0692075 (diff)
downloadsonarqube-ce7a0f35a776f0bcd5d179a239042bcd97b7e3be.tar.gz
sonarqube-ce7a0f35a776f0bcd5d179a239042bcd97b7e3be.zip
SONAR-4602 Evict dryRun cache on profile restore
-rw-r--r--sonar-server/src/main/java/org/sonar/server/rules/ProfilesConsole.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/sonar-server/src/main/java/org/sonar/server/rules/ProfilesConsole.java b/sonar-server/src/main/java/org/sonar/server/rules/ProfilesConsole.java
index 557da01b302..b662f2bff3c 100644
--- a/sonar-server/src/main/java/org/sonar/server/rules/ProfilesConsole.java
+++ b/sonar-server/src/main/java/org/sonar/server/rules/ProfilesConsole.java
@@ -32,6 +32,7 @@ import org.sonar.api.profiles.XMLProfileSerializer;
import org.sonar.api.rules.ActiveRule;
import org.sonar.api.rules.ActiveRuleParam;
import org.sonar.api.utils.ValidationMessages;
+import org.sonar.core.dryrun.DryRunCache;
import org.sonar.jpa.session.DatabaseSessionFactory;
import java.io.StringReader;
@@ -50,19 +51,21 @@ public final class ProfilesConsole implements ServerComponent {
private XMLProfileSerializer xmlProfileSerializer;
private List<ProfileExporter> exporters = newArrayList();
private List<ProfileImporter> importers = newArrayList();
+ private DryRunCache dryRunCache;
- public ProfilesConsole(DatabaseSessionFactory sessionFactory, XMLProfileParser xmlProfileParser, XMLProfileSerializer xmlProfileSerializer) {
+ public ProfilesConsole(DatabaseSessionFactory sessionFactory, XMLProfileParser xmlProfileParser, XMLProfileSerializer xmlProfileSerializer, DryRunCache dryRunCache) {
this.sessionFactory = sessionFactory;
this.xmlProfileParser = xmlProfileParser;
this.xmlProfileSerializer = xmlProfileSerializer;
+ this.dryRunCache = dryRunCache;
this.exporters = newArrayList();
this.importers = newArrayList();
}
public ProfilesConsole(DatabaseSessionFactory sessionFactory, XMLProfileParser xmlProfileParser, XMLProfileSerializer xmlProfileSerializer,
- ProfileExporter[] exporters,
- ProfileImporter[] importers) {
- this(sessionFactory, xmlProfileParser, xmlProfileSerializer);
+ ProfileExporter[] exporters,
+ ProfileImporter[] importers, DryRunCache dryRunCache) {
+ this(sessionFactory, xmlProfileParser, xmlProfileSerializer, dryRunCache);
this.exporters.addAll(Arrays.asList(exporters));
this.importers.addAll(Arrays.asList(importers));
}
@@ -88,11 +91,12 @@ public final class ProfilesConsole implements ServerComponent {
messages.addErrorText("The profile " + profile + " already exists. Please delete it before restoring.");
} else {
- if (existingProfile!=null) {
+ if (existingProfile != null) {
session.removeWithoutFlush(existingProfile);
}
session.saveWithoutFlush(profile);
session.commit();
+ dryRunCache.reportGlobalModification();
}
}
return messages;