diff options
author | Michal Duda <michal.duda@sonarsource.com> | 2020-09-18 17:08:48 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2020-09-29 20:07:42 +0000 |
commit | 0ecd8610552ccd59049308c1be46b03470c48538 (patch) | |
tree | d1da42fc9e90627a037696702cb30dd0e7442e6d /server/sonar-ce-task | |
parent | bc413ee3db73258a22059816bd4766bcea66a9ca (diff) | |
download | sonarqube-0ecd8610552ccd59049308c1be46b03470c48538.tar.gz sonarqube-0ecd8610552ccd59049308c1be46b03470c48538.zip |
SONAR-13862 Add a WS for dismissing analysis warning by the current user
Diffstat (limited to 'server/sonar-ce-task')
-rw-r--r-- | server/sonar-ce-task/src/main/java/org/sonar/ce/task/log/CeTaskMessages.java | 15 | ||||
-rw-r--r-- | server/sonar-ce-task/src/main/java/org/sonar/ce/task/log/CeTaskMessagesImpl.java | 10 |
2 files changed, 13 insertions, 12 deletions
diff --git a/server/sonar-ce-task/src/main/java/org/sonar/ce/task/log/CeTaskMessages.java b/server/sonar-ce-task/src/main/java/org/sonar/ce/task/log/CeTaskMessages.java index 7e92a255c10..53d043c934f 100644 --- a/server/sonar-ce-task/src/main/java/org/sonar/ce/task/log/CeTaskMessages.java +++ b/server/sonar-ce-task/src/main/java/org/sonar/ce/task/log/CeTaskMessages.java @@ -23,6 +23,7 @@ import java.util.Collection; import java.util.Objects; import javax.annotation.concurrent.Immutable; import org.sonar.api.ce.ComputeEngineSide; +import org.sonar.db.ce.CeTaskMessageType; import static com.google.common.base.Preconditions.checkArgument; import static java.util.Objects.requireNonNull; @@ -48,19 +49,19 @@ public interface CeTaskMessages { class Message { private final String text; private final long timestamp; - private final boolean dismissible; + private final CeTaskMessageType type; - public Message(String text, long timestamp, boolean dismissible) { + public Message(String text, long timestamp, CeTaskMessageType type) { requireNonNull(text, "Text can't be null"); checkArgument(!text.isEmpty(), "Text can't be empty"); checkArgument(timestamp >= 0, "Timestamp can't be less than 0"); this.text = text; this.timestamp = timestamp; - this.dismissible = dismissible; + this.type = type; } public Message(String text, long timestamp) { - this(text, timestamp, false); + this(text, timestamp, CeTaskMessageType.GENERIC); } public String getText() { @@ -71,8 +72,8 @@ public interface CeTaskMessages { return timestamp; } - public boolean isDismissible() { - return dismissible; + public CeTaskMessageType getType() { + return type; } @Override @@ -98,7 +99,7 @@ public interface CeTaskMessages { return "Message{" + "text='" + text + '\'' + ", timestamp=" + timestamp + - ", dismissible=" + dismissible + + ", type=" + type + '}'; } } diff --git a/server/sonar-ce-task/src/main/java/org/sonar/ce/task/log/CeTaskMessagesImpl.java b/server/sonar-ce-task/src/main/java/org/sonar/ce/task/log/CeTaskMessagesImpl.java index 153e9ce393d..f4072138cf8 100644 --- a/server/sonar-ce-task/src/main/java/org/sonar/ce/task/log/CeTaskMessagesImpl.java +++ b/server/sonar-ce-task/src/main/java/org/sonar/ce/task/log/CeTaskMessagesImpl.java @@ -71,11 +71,11 @@ public class CeTaskMessagesImpl implements CeTaskMessages { public void insert(DbSession dbSession, Message message) { dbClient.ceTaskMessageDao().insert(dbSession, new CeTaskMessageDto() - .setUuid(uuidFactory.create()) - .setTaskUuid(ceTask.getUuid()) - .setMessage(message.getText()) - .setDismissible(message.isDismissible()) - .setCreatedAt(message.getTimestamp())); + .setUuid(uuidFactory.create()) + .setTaskUuid(ceTask.getUuid()) + .setMessage(message.getText()) + .setType(message.getType()) + .setCreatedAt(message.getTimestamp())); } private static void checkMessage(Message message) { |