From 0a1dbd4039aa2affc5d95f4f833ee2ca71771acd Mon Sep 17 00:00:00 2001 From: Jacek Poreda Date: Thu, 26 Oct 2023 17:52:13 +0200 Subject: [PATCH] SONAR-20796 Use severity/type mapping for BitBucket Cloud --- .../qualitygate/changeevent/ChangedIssueImpl.java | 10 ++++++++++ .../qualitygate/changeevent/QGChangeEventListener.java | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/server/sonar-webserver-api/src/main/java/org/sonar/server/qualitygate/changeevent/ChangedIssueImpl.java b/server/sonar-webserver-api/src/main/java/org/sonar/server/qualitygate/changeevent/ChangedIssueImpl.java index 60a8bb403d2..0fbdb9bc9b2 100644 --- a/server/sonar-webserver-api/src/main/java/org/sonar/server/qualitygate/changeevent/ChangedIssueImpl.java +++ b/server/sonar-webserver-api/src/main/java/org/sonar/server/qualitygate/changeevent/ChangedIssueImpl.java @@ -19,14 +19,18 @@ */ package org.sonar.server.qualitygate.changeevent; +import java.util.Map; import java.util.Objects; import org.sonar.api.issue.Issue; +import org.sonar.api.issue.impact.Severity; +import org.sonar.api.issue.impact.SoftwareQuality; import org.sonar.api.rules.RuleType; import org.sonar.core.issue.DefaultIssue; class ChangedIssueImpl implements QGChangeEventListener.ChangedIssue { private final String key; private final QGChangeEventListener.Status status; + private final Map impacts; private final RuleType type; private final String severity; private final boolean fromAlm; @@ -40,6 +44,7 @@ class ChangedIssueImpl implements QGChangeEventListener.ChangedIssue { this.status = statusOf(issue); this.type = issue.type(); this.severity = issue.severity(); + this.impacts = issue.impacts(); this.fromAlm = fromAlm; } @@ -92,6 +97,11 @@ class ChangedIssueImpl implements QGChangeEventListener.ChangedIssue { return type; } + @Override + public Map getImpacts() { + return impacts; + } + @Override public String getSeverity() { return severity; diff --git a/server/sonar-webserver-api/src/main/java/org/sonar/server/qualitygate/changeevent/QGChangeEventListener.java b/server/sonar-webserver-api/src/main/java/org/sonar/server/qualitygate/changeevent/QGChangeEventListener.java index d0acdcc2f55..f1decc3f375 100644 --- a/server/sonar-webserver-api/src/main/java/org/sonar/server/qualitygate/changeevent/QGChangeEventListener.java +++ b/server/sonar-webserver-api/src/main/java/org/sonar/server/qualitygate/changeevent/QGChangeEventListener.java @@ -20,7 +20,10 @@ package org.sonar.server.qualitygate.changeevent; import java.util.EnumSet; +import java.util.Map; import java.util.Set; +import org.sonar.api.issue.impact.Severity; +import org.sonar.api.issue.impact.SoftwareQuality; import org.sonar.api.rules.RuleType; import org.sonar.api.server.ServerSide; @@ -44,6 +47,8 @@ public interface QGChangeEventListener { RuleType getType(); + Map getImpacts(); + String getSeverity(); default boolean isNotClosed() { -- 2.39.5