diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2011-12-12 10:43:33 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2011-12-12 10:45:15 +0100 |
commit | 5bfd55625c8a62cf308d388784497db52b6e0b78 (patch) | |
tree | 702958ba607ceaf4b7566eb726f70c515dab467a /sonar-core/src | |
parent | 435ea536687a88f5ffa765947eb23b3dc70eca4d (diff) | |
download | sonarqube-5bfd55625c8a62cf308d388784497db52b6e0b78.tar.gz sonarqube-5bfd55625c8a62cf308d388784497db52b6e0b78.zip |
SONAR-2973 replace RULE_FAILURES_OVERRIDDEN_SEVERITY by REVIEWS.MANUAL_SEVERITY (boolean)
Diffstat (limited to 'sonar-core/src')
5 files changed, 73 insertions, 42 deletions
diff --git a/sonar-core/src/main/java/org/sonar/persistence/model/Review.java b/sonar-core/src/main/java/org/sonar/persistence/model/Review.java index 4badd593f87..4f680448212 100644 --- a/sonar-core/src/main/java/org/sonar/persistence/model/Review.java +++ b/sonar-core/src/main/java/org/sonar/persistence/model/Review.java @@ -49,6 +49,7 @@ public class Review { private String severity; private Integer ruleId; private Boolean manualViolation; + private Boolean manualSeverity; public Long getId() { return id; @@ -185,6 +186,15 @@ public class Review { return this; } + public Boolean getManualSeverity() { + return manualSeverity; + } + + public Review setManualSeverity(Boolean b) { + this.manualSeverity = b; + return this; + } + @Override public String toString() { return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); diff --git a/sonar-core/src/main/java/org/sonar/persistence/model/ReviewMapper.java b/sonar-core/src/main/java/org/sonar/persistence/model/ReviewMapper.java index 82b39c74356..2eb0c23025a 100644 --- a/sonar-core/src/main/java/org/sonar/persistence/model/ReviewMapper.java +++ b/sonar-core/src/main/java/org/sonar/persistence/model/ReviewMapper.java @@ -19,6 +19,8 @@ */ package org.sonar.persistence.model; +import org.apache.ibatis.annotations.Param; + import java.util.List; /** @@ -30,4 +32,6 @@ public interface ReviewMapper { List<Review> selectByResource(int resourceId); List<Review> selectByQuery(ReviewQuery query); + + List<Review> selectCloseables(@Param("resourceId") int resourceId, @Param("snapshotId") int snapshotId); } diff --git a/sonar-core/src/main/resources/org/sonar/persistence/model/ReviewMapper.xml b/sonar-core/src/main/resources/org/sonar/persistence/model/ReviewMapper.xml index e336df91505..e60a06ce745 100644 --- a/sonar-core/src/main/resources/org/sonar/persistence/model/ReviewMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/persistence/model/ReviewMapper.xml @@ -47,5 +47,19 @@ </where> </select> + <select id="selectCloseables" parameterType="map" resultMap="reviewResultMap"> + select + <include refid="reviewColumns"/> + from reviews + <where> + resource_id=#{resourceId} AND + ( + (manual_violation=false AND status!='CLOSED' AND rule_failure_permanent_id NOT IN (SELECT permanent_id FROM rule_failures WHERE snapshot_id=#{snapshotId} AND permanent_id IS NOT NULL)) + OR + (manual_violation=true AND status='RESOLVED') + ) + </where> + </select> + </mapper> diff --git a/sonar-core/src/main/resources/org/sonar/persistence/schema-derby.ddl b/sonar-core/src/main/resources/org/sonar/persistence/schema-derby.ddl index c08611c872c..05bf6631511 100644 --- a/sonar-core/src/main/resources/org/sonar/persistence/schema-derby.ddl +++ b/sonar-core/src/main/resources/org/sonar/persistence/schema-derby.ddl @@ -314,7 +314,8 @@ CREATE TABLE "REVIEWS" ( "RESOURCE_LINE" INTEGER, "RESOLUTION" VARCHAR(200), "RULE_ID" INTEGER, - "MANUAL_VIOLATION" BOOLEAN + "MANUAL_VIOLATION" BOOLEAN, + "MANUAL_SEVERITY" BOOLEAN ); CREATE TABLE "RULES_CATEGORIES" ( @@ -433,8 +434,7 @@ CREATE TABLE "RULE_FAILURES" ( "CHECKSUM" VARCHAR(1000), "PERMANENT_ID" INTEGER, "SWITCHED_OFF" BOOLEAN, - "COMMITTER" VARCHAR(100), - "OVERRIDDEN_SEVERITY" BOOLEAN + "COMMITTER" VARCHAR(100) ); CREATE TABLE "METRICS" ( diff --git a/sonar-core/src/test/resources/org/sonar/persistence/dao/ReviewDaoTest/shared.xml b/sonar-core/src/test/resources/org/sonar/persistence/dao/ReviewDaoTest/shared.xml index 6cbe3307202..70c101759de 100644 --- a/sonar-core/src/test/resources/org/sonar/persistence/dao/ReviewDaoTest/shared.xml +++ b/sonar-core/src/test/resources/org/sonar/persistence/dao/ReviewDaoTest/shared.xml @@ -2,50 +2,53 @@ <!-- First resource --> <reviews - id="100" - status="OPEN" - rule_failure_permanent_id="1" - resolution="RESOLVE" - created_at="[null]" - updated_at="[null]" - project_id="20" - resource_line="200" - severity="BLOCKER" - user_id="300" - resource_id="400" - rule_id="500" - manual_violation="[true]"/> + id="100" + status="OPEN" + rule_failure_permanent_id="1" + resolution="RESOLVE" + created_at="[null]" + updated_at="[null]" + project_id="20" + resource_line="200" + severity="BLOCKER" + user_id="300" + resource_id="400" + rule_id="500" + manual_violation="[true]" + manual_severity="[false]"/> <reviews - id="101" - status="CLOSED" - rule_failure_permanent_id="1" - resolution="RESOLVE" - created_at="[null]" - updated_at="[null]" - project_id="30" - resource_line="120" - severity="MAJOR" - user_id="300" - resource_id="400" - rule_id="505" - manual_violation="[false]"/> + id="101" + status="CLOSED" + rule_failure_permanent_id="1" + resolution="RESOLVE" + created_at="[null]" + updated_at="[null]" + project_id="30" + resource_line="120" + severity="MAJOR" + user_id="300" + resource_id="400" + rule_id="505" + manual_violation="[false]" + manual_severity="[false]"/> <!-- Second resource --> <reviews - id="102" - status="OPEN" - rule_failure_permanent_id="1" - resolution="RESOLVE" - created_at="[null]" - updated_at="[null]" - project_id="20" - resource_line="200" - severity="BLOCKER" - user_id="300" - resource_id="401" - rule_id="500" - manual_violation="[true]"/> + id="102" + status="OPEN" + rule_failure_permanent_id="1" + resolution="RESOLVE" + created_at="[null]" + updated_at="[null]" + project_id="20" + resource_line="200" + severity="BLOCKER" + user_id="300" + resource_id="401" + rule_id="500" + manual_violation="[true]" + manual_severity="[false]"/> </dataset> |