diff options
author | Godin <mandrikov@gmail.com> | 2010-12-07 00:19:43 +0000 |
---|---|---|
committer | Godin <mandrikov@gmail.com> | 2010-12-07 00:19:43 +0000 |
commit | 9f5f478e89f25b57f238e64b54c740f90c6b56f5 (patch) | |
tree | b9ae97d5cc18fb8ec102878a6f9145ab0d913008 /sonar-ws-client/src/main/java/org | |
parent | 39323540f630b889cb2f35346cfd9367ad62d7c6 (diff) | |
download | sonarqube-9f5f478e89f25b57f238e64b54c740f90c6b56f5.tar.gz sonarqube-9f5f478e89f25b57f238e64b54c740f90c6b56f5.zip |
SONAR-2024: Add support for rule status parameter
Diffstat (limited to 'sonar-ws-client/src/main/java/org')
3 files changed, 24 insertions, 1 deletions
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Rule.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Rule.java index 0b6fcfb822c..8fb2192b299 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Rule.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Rule.java @@ -32,6 +32,7 @@ public class Rule extends Model { private String description = null; private String severity = null; private List<RuleParam> params; + private boolean active; public String getTitle() { return title; @@ -78,6 +79,14 @@ public class Rule extends Model { return this; } + public void setActive(boolean active) { + this.active = active; + } + + public boolean isActive() { + return active; + } + public List<RuleParam> getParams() { return params; } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/RuleQuery.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/RuleQuery.java index f777047ce26..d5d96f9475f 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/RuleQuery.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/RuleQuery.java @@ -30,6 +30,7 @@ public class RuleQuery extends Query<Rule> { private String searchText; private String profile; private String[] severities; + private Boolean active; public RuleQuery(String language) { this.language = language; @@ -80,6 +81,15 @@ public class RuleQuery extends Query<Rule> { return severities; } + public RuleQuery setActive(Boolean active) { + this.active = active; + return this; + } + + public Boolean getStatus() { + return active; + } + @Override public String getUrl() { StringBuilder url = new StringBuilder(BASE_URL); @@ -89,6 +99,9 @@ public class RuleQuery extends Query<Rule> { appendUrlParameter(url, "searchtext", searchText); appendUrlParameter(url, "profile", profile); appendUrlParameter(url, "priorities", severities); + if (active != null) { + appendUrlParameter(url, "status", active ? "ACTIVE" : "INACTIVE"); + } return url.toString(); } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/RuleUnmarshaller.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/RuleUnmarshaller.java index f766a4b6b69..001ac3463fc 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/RuleUnmarshaller.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/RuleUnmarshaller.java @@ -45,7 +45,8 @@ public class RuleUnmarshaller extends AbstractUnmarshaller<Rule> { .setKey(JsonUtils.getString(json, "key")) .setPlugin(JsonUtils.getString(json, "plugin")) .setDescription(JsonUtils.getString(json, "description")) - .setSeverity(JsonUtils.getString(json, "priority")); + .setSeverity(JsonUtils.getString(json, "priority")) + .setActive("ACTIVE".equals(JsonUtils.getString(json, "status"))); } private void parseParams(JSONObject json, Rule rule) { |