diff options
author | Léo Geoffroy <leo.geoffroy@sonarsource.com> | 2024-10-09 14:33:03 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-10-16 20:03:01 +0000 |
commit | 9be6b7091b066077e7222b3885e2b403f29f0706 (patch) | |
tree | 7f510cc44b543459c8bb1b1f152a6f8270b9c1da /server/sonar-server-common | |
parent | 6efb7c2170ca7384d1e4b4ca3e51ff01eed40e02 (diff) | |
download | sonarqube-9be6b7091b066077e7222b3885e2b403f29f0706.tar.gz sonarqube-9be6b7091b066077e7222b3885e2b403f29f0706.zip |
SONAR-23250 Update rule activator to support impact severity overrides
Diffstat (limited to 'server/sonar-server-common')
-rw-r--r-- | server/sonar-server-common/src/main/java/org/sonar/server/qualityprofile/ActiveRuleChange.java | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/qualityprofile/ActiveRuleChange.java b/server/sonar-server-common/src/main/java/org/sonar/server/qualityprofile/ActiveRuleChange.java index 65412f21a66..eefcb5b8bd2 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/qualityprofile/ActiveRuleChange.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/qualityprofile/ActiveRuleChange.java @@ -20,11 +20,14 @@ package org.sonar.server.qualityprofile; import com.google.common.base.MoreObjects; +import java.util.EnumMap; import java.util.HashMap; import java.util.Map; import javax.annotation.CheckForNull; import javax.annotation.Nullable; import org.apache.commons.lang3.StringUtils; +import org.sonar.api.issue.impact.Severity; +import org.sonar.api.issue.impact.SoftwareQuality; import org.sonar.db.qualityprofile.ActiveRuleDto; import org.sonar.db.qualityprofile.ActiveRuleKey; import org.sonar.db.qualityprofile.QProfileChangeDto; @@ -42,6 +45,7 @@ public class ActiveRuleChange { private final ActiveRuleKey key; private final String ruleUuid; private String severity = null; + private final Map<SoftwareQuality, Severity> impactSeverities = new EnumMap<>(SoftwareQuality.class); private Boolean prioritizedRule = null; private ActiveRuleInheritance inheritance = null; private final Map<String, String> parameters = new HashMap<>(); @@ -81,13 +85,23 @@ public class ActiveRuleChange { return this; } - public ActiveRuleChange setPrioritizedRule(@Nullable Boolean prioritizedRule){ + public Map<SoftwareQuality, Severity> getImpactSeverities() { + return impactSeverities; + } + + public ActiveRuleChange setImpactSeverities(Map<SoftwareQuality, Severity> impactSeverities) { + this.impactSeverities.clear(); + this.impactSeverities.putAll(impactSeverities); + return this; + } + + public ActiveRuleChange setPrioritizedRule(@Nullable Boolean prioritizedRule) { this.prioritizedRule = prioritizedRule; return this; } @CheckForNull - public Boolean isPrioritizedRule(){ + public Boolean isPrioritizedRule() { return prioritizedRule; } @@ -159,6 +173,7 @@ public class ActiveRuleChange { .add("inheritance", inheritance) .add("parameters", parameters) .add("prioritizedRule", prioritizedRule) + .add("impactSeverities", impactSeverities) .toString(); } } |