From 177da8d8b082ad4688524d8f3ecea9bee624d09b Mon Sep 17 00:00:00 2001 From: Jacek Poreda Date: Thu, 10 Aug 2023 10:33:25 +0200 Subject: SONAR-20021 Update Issues web apis with Clean Code Taxonomy --- .../main/java/org/sonar/db/issue/ImpactDto.java | 6 + .../resources/org/sonar/db/issue/IssueMapper.xml | 10 +- .../test/java/org/sonar/db/rule/RuleDtoTest.java | 12 +- .../src/main/java/org/sonar/server/es/Facets.java | 12 +- .../java/org/sonar/server/issue/SearchRequest.java | 30 ++++ .../org/sonar/server/issue/SearchRequestTest.java | 9 +- .../org/sonar/server/issue/index/IssueIndex.java | 28 ++-- .../org/sonar/server/issue/index/IssueQuery.java | 2 +- .../server/issue/index/IssueQueryFactory.java | 3 + .../server/issue/index/IssueIndexFacetsTest.java | 22 +-- .../sonar/server/issue/ws/PullTaintActionIT.java | 14 ++ .../org/sonar/server/issue/ws/SearchActionIT.java | 161 ++++++++++++++++++++- .../sonar/server/issue/ws/AddCommentAction.java | 1 + .../org/sonar/server/issue/ws/AssignAction.java | 1 + .../sonar/server/issue/ws/DeleteCommentAction.java | 1 + .../sonar/server/issue/ws/DoTransitionAction.java | 1 + .../sonar/server/issue/ws/EditCommentAction.java | 1 + .../org/sonar/server/issue/ws/SearchAction.java | 46 +++++- .../server/issue/ws/SearchResponseFormat.java | 16 ++ .../sonar/server/issue/ws/SetSeverityAction.java | 1 + .../org/sonar/server/issue/ws/SetTagsAction.java | 1 + .../org/sonar/server/issue/ws/SetTypeAction.java | 1 + .../PullTaintActionProtobufObjectGenerator.java | 15 ++ .../sonar/server/issue/ws/add_comment-example.json | 8 + .../org/sonar/server/issue/ws/assign-example.json | 8 + .../server/issue/ws/delete_comment-example.json | 8 + .../server/issue/ws/do_transition-example.json | 8 + .../server/issue/ws/edit_comment-example.json | 8 + .../sonar/server/issue/ws/pull-taint-example.proto | 13 +- .../org/sonar/server/issue/ws/search-example.json | 8 + .../server/issue/ws/set_severity-example.json | 8 + .../sonar/server/issue/ws/set_tags-example.json | 8 + .../sonar/server/issue/ws/set_type-example.json | 8 + .../SearchResponseFormatFormatOperationTest.java | 12 ++ 34 files changed, 441 insertions(+), 50 deletions(-) (limited to 'server') diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/ImpactDto.java b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/ImpactDto.java index b62469b68db..82da4d3b0b4 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/ImpactDto.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/ImpactDto.java @@ -33,6 +33,12 @@ public class ImpactDto implements Serializable { // nothing to do } + public ImpactDto(String uuid, SoftwareQuality softwareQuality, Severity severity) { + this.uuid = uuid; + this.softwareQuality = softwareQuality; + this.severity = severity; + } + public String getUuid() { return uuid; } diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/issue/IssueMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/issue/IssueMapper.xml index 17889d58ee3..a731ea97d42 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/issue/IssueMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/issue/IssueMapper.xml @@ -801,10 +801,13 @@ i.component_uuid as component_uuid, i.assignee as assigneeUuid, u.login as assigneeLogin, - i.rule_description_context_key as ruleDescriptionContextKey + i.rule_description_context_key as ruleDescriptionContextKey, + + + r.clean_code_attribute as cleanCodeAttribute - select , p.path as filePath @@ -812,6 +815,8 @@ inner join rules r on r.uuid = i.rule_uuid inner join components p on p.uuid=i.component_uuid left join users u on i.assignee = u.uuid + left outer join issues_impacts ii on i.kee = ii.issue_key + left outer join rules_default_impacts rdi on r.uuid = rdi.rule_uuid where i.kee IN @@ -822,6 +827,7 @@ AND i.issue_update_date >= #{changedSince,jdbcType=BIGINT} + order by i.kee