From: Julien Lancelot Date: Fri, 19 Apr 2013 16:10:54 +0000 (+0200) Subject: SONAR-3755 Renamed some column of issues and issue_changes X-Git-Tag: 3.6~618 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=6958ccb31c4bb94fe9b026cfdfe9ee66d065352e;p=sonarqube.git SONAR-3755 Renamed some column of issues and issue_changes --- diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/IssueTracking.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/IssueTracking.java index 29477c8fa44..436baec073a 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/IssueTracking.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/IssueTracking.java @@ -345,12 +345,12 @@ public class IssueTracking implements BatchExtension { } private boolean isSameKey(DefaultIssue newIssue, IssueDto pastIssue) { - return Objects.equal(newIssue.key(), pastIssue.getUuid()); + return Objects.equal(newIssue.key(), pastIssue.getKey()); } private void mapIssue(DefaultIssue newIssue, IssueDto pastIssue, Multimap lastIssuesByRule, Map issueMap) { if (pastIssue != null) { - newIssue.setKey(pastIssue.getUuid()); + newIssue.setKey(pastIssue.getKey()); if (pastIssue.isManualSeverity()) { newIssue.setSeverity(pastIssue.getSeverity()); } diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/IssuesWorkflowDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/IssuesWorkflowDecorator.java index 42140114d2b..9ba3d068569 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/IssuesWorkflowDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/IssuesWorkflowDecorator.java @@ -102,7 +102,7 @@ public class IssuesWorkflowDecorator implements Decorator { } private void closeResolvedStandardIssues(IssueDto openIssue, Set issueKeys) { - if (!openIssue.isManualIssue() && !issueKeys.contains(openIssue.getUuid())) { + if (!openIssue.isManualIssue() && !issueKeys.contains(openIssue.getKey())) { closeAndSave(openIssue); } } diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/IssueTrackingTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/IssueTrackingTest.java index 079e7c0d121..e187bf71437 100644 --- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/IssueTrackingTest.java +++ b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/IssueTrackingTest.java @@ -65,8 +65,8 @@ public class IssueTrackingTest { @Test public void key_should_be_the_prioritary_field_to_check() { - IssueDto referenceIssue1 = newReferenceIssue("message", 10, 1, "checksum1").setUuid("100"); - IssueDto referenceIssue2 = newReferenceIssue("message", 10, 1, "checksum2").setUuid("200"); + IssueDto referenceIssue1 = newReferenceIssue("message", 10, 1, "checksum1").setKey("100"); + IssueDto referenceIssue2 = newReferenceIssue("message", 10, 1, "checksum2").setKey("200"); // exactly the fields of referenceIssue1 but not the same key DefaultIssue newIssue = newDefaultIssue("message", 10, RuleKey.of("squid", "AvoidCycle"), "checksum1").setKey("200"); @@ -232,7 +232,7 @@ public class IssueTrackingTest { IssueDto referenceIssue = new IssueDto(); Long id = violationId++; referenceIssue.setId(id); - referenceIssue.setUuid(Long.toString(id)); + referenceIssue.setKey(Long.toString(id)); referenceIssue.setLine(lineId); referenceIssue.setDescription(description); referenceIssue.setRuleId(ruleId); diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/IssuesWorkflowDecoratorTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/IssuesWorkflowDecoratorTest.java index 62ed7002619..ae18261f23c 100644 --- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/IssuesWorkflowDecoratorTest.java +++ b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/IssuesWorkflowDecoratorTest.java @@ -77,7 +77,7 @@ public class IssuesWorkflowDecoratorTest extends AbstractDaoTestCase { public void should_close_resolved_issue() { when(moduleIssues.issues(anyString())).thenReturn(Collections.emptyList()); when(initialOpenIssuesStack.selectAndRemove(anyInt())).thenReturn(newArrayList( - new IssueDto().setUuid("100").setRuleId(10).setRuleKey_unit_test_only("squid", "AvoidCycle"))); + new IssueDto().setKey("100").setRuleId(10).setRuleKey_unit_test_only("squid", "AvoidCycle"))); decorator.decorate(mock(Resource.class), null); @@ -92,7 +92,7 @@ public class IssuesWorkflowDecoratorTest extends AbstractDaoTestCase { public void should_close_resolved_manual_issue() { when(moduleIssues.issues(anyString())).thenReturn(Collections.emptyList()); when(initialOpenIssuesStack.selectAndRemove(anyInt())).thenReturn(newArrayList( - new IssueDto().setUuid("100").setRuleId(1).setManualIssue(true).setStatus(Issue.STATUS_RESOLVED).setRuleKey_unit_test_only("squid", "AvoidCycle"))); + new IssueDto().setKey("100").setRuleId(1).setManualIssue(true).setStatus(Issue.STATUS_RESOLVED).setRuleKey_unit_test_only("squid", "AvoidCycle"))); decorator.decorate(mock(Resource.class), null); @@ -108,7 +108,7 @@ public class IssuesWorkflowDecoratorTest extends AbstractDaoTestCase { when(moduleIssues.issues(anyString())).thenReturn(Lists.newArrayList( new DefaultIssue().setKey("100"))); when(initialOpenIssuesStack.selectAndRemove(anyInt())).thenReturn(newArrayList( - new IssueDto().setUuid("100").setRuleId(1).setStatus(Issue.STATUS_RESOLVED).setResolution(Issue.RESOLUTION_FIXED) + new IssueDto().setKey("100").setRuleId(1).setStatus(Issue.STATUS_RESOLVED).setResolution(Issue.RESOLUTION_FIXED) .setRuleKey_unit_test_only("squid", "AvoidCycle"))); decorator.decorate(mock(Resource.class), null); @@ -129,7 +129,7 @@ public class IssuesWorkflowDecoratorTest extends AbstractDaoTestCase { when(moduleIssues.issues(anyString())).thenReturn(Lists.newArrayList( new DefaultIssue().setKey("100"))); when(initialOpenIssuesStack.selectAndRemove(anyInt())).thenReturn(newArrayList( - new IssueDto().setUuid("100").setRuleId(1).setStatus(Issue.STATUS_RESOLVED).setResolution(Issue.RESOLUTION_FALSE_POSITIVE) + new IssueDto().setKey("100").setRuleId(1).setStatus(Issue.STATUS_RESOLVED).setResolution(Issue.RESOLUTION_FALSE_POSITIVE) .setRuleKey_unit_test_only("squid", "AvoidCycle"))); decorator.decorate(mock(Resource.class), null); @@ -150,7 +150,7 @@ public class IssuesWorkflowDecoratorTest extends AbstractDaoTestCase { when(moduleIssues.issues(anyString())).thenReturn(Collections.emptyList()); when(initialOpenIssuesStack.selectAndRemove(anyInt())).thenReturn(Collections.emptyList()); - when(initialOpenIssuesStack.getAllIssues()).thenReturn(newArrayList(new IssueDto().setUuid("100").setRuleId(1).setRuleKey_unit_test_only("squid", "AvoidCycle"))); + when(initialOpenIssuesStack.getAllIssues()).thenReturn(newArrayList(new IssueDto().setKey("100").setRuleId(1).setRuleKey_unit_test_only("squid", "AvoidCycle"))); Resource resource = mock(Resource.class); when(resource.getQualifier()).thenReturn(Qualifiers.PROJECT); diff --git a/sonar-batch/src/test/resources/org/sonar/batch/issue/IssuePersisterTest/should_insert_new_issue-result.xml b/sonar-batch/src/test/resources/org/sonar/batch/issue/IssuePersisterTest/should_insert_new_issue-result.xml index f1e9d3a94f9..1a6c188b6c7 100644 --- a/sonar-batch/src/test/resources/org/sonar/batch/issue/IssuePersisterTest/should_insert_new_issue-result.xml +++ b/sonar-batch/src/test/resources/org/sonar/batch/issue/IssuePersisterTest/should_insert_new_issue-result.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/sonar-batch/src/test/resources/org/sonar/batch/issue/IssuePersisterTest/should_update_existing_issue-result.xml b/sonar-batch/src/test/resources/org/sonar/batch/issue/IssuePersisterTest/should_update_existing_issue-result.xml index bab422fd0a2..4ad7e693016 100644 --- a/sonar-batch/src/test/resources/org/sonar/batch/issue/IssuePersisterTest/should_update_existing_issue-result.xml +++ b/sonar-batch/src/test/resources/org/sonar/batch/issue/IssuePersisterTest/should_update_existing_issue-result.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/sonar-batch/src/test/resources/org/sonar/batch/issue/IssuePersisterTest/should_update_existing_issue.xml b/sonar-batch/src/test/resources/org/sonar/batch/issue/IssuePersisterTest/should_update_existing_issue.xml index f4a989b8e24..7e7c68964a6 100644 --- a/sonar-batch/src/test/resources/org/sonar/batch/issue/IssuePersisterTest/should_update_existing_issue.xml +++ b/sonar-batch/src/test/resources/org/sonar/batch/issue/IssuePersisterTest/should_update_existing_issue.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/sonar-core/src/main/java/org/sonar/core/issue/IssueChangeDto.java b/sonar-core/src/main/java/org/sonar/core/issue/IssueChangeDto.java index 2ca3fc6c7a0..104c42133d1 100644 --- a/sonar-core/src/main/java/org/sonar/core/issue/IssueChangeDto.java +++ b/sonar-core/src/main/java/org/sonar/core/issue/IssueChangeDto.java @@ -30,8 +30,8 @@ import java.util.Date; public final class IssueChangeDto { private Long id; - private String issueUuid; - private Long userId; + private String issueKey; + private String userLogin; private String changeType; private String changeData; private String message; @@ -48,20 +48,20 @@ public final class IssueChangeDto { } public String getIssueUuid() { - return issueUuid; + return issueKey; } - public IssueChangeDto setIssueUuid(String issueUuid) { - this.issueUuid = issueUuid; + public IssueChangeDto setIssueKey(String issueKey) { + this.issueKey = issueKey; return this; } - public Long getUserId() { - return userId; + public String getUserLogin() { + return userLogin; } - public IssueChangeDto setUserId(Long userId) { - this.userId = userId; + public IssueChangeDto setUserLogin(String userLogin) { + this.userLogin = userLogin; return this; } diff --git a/sonar-core/src/main/java/org/sonar/core/issue/IssueDto.java b/sonar-core/src/main/java/org/sonar/core/issue/IssueDto.java index 36734e69e50..3d695d148bf 100644 --- a/sonar-core/src/main/java/org/sonar/core/issue/IssueDto.java +++ b/sonar-core/src/main/java/org/sonar/core/issue/IssueDto.java @@ -36,7 +36,7 @@ import java.util.Date; public final class IssueDto { private Long id; - private String uuid; + private String kee; private Integer resourceId; private Integer ruleId; private String severity; @@ -51,8 +51,8 @@ public final class IssueDto { private String checksum; private String userLogin; private String assignee; - private Long personId; - private String data; + private String authorLogin; + private String attributes; private Date createdAt; private Date updatedAt; private Date closedAt; @@ -71,12 +71,12 @@ public final class IssueDto { return this; } - public String getUuid() { - return uuid; + public String getKey() { + return kee; } - public IssueDto setUuid(String uuid) { - this.uuid = uuid; + public IssueDto setKey(String key) { + this.kee = key; return this; } @@ -206,23 +206,23 @@ public final class IssueDto { return this; } - public Long getPersonId() { - return personId; + public String getPersonId() { + return authorLogin; } - public IssueDto setPersonId(@Nullable Long personId) { - this.personId = personId; + public IssueDto setAuthorLogin(@Nullable String authorLogin) { + this.authorLogin = authorLogin; return this; } - public String getData() { - return data; + public String getAttributes() { + return attributes; } - public IssueDto setData(@Nullable String s) { + public IssueDto setAttributes(@Nullable String s) { Preconditions.checkArgument(s == null || s.length() <= 1000, - "Issue data must not exceed 1000 characters: " + s); - this.data = s; + "Issue attributes must not exceed 1000 characters: " + s); + this.attributes = s; return this; } @@ -308,7 +308,7 @@ public final class IssueDto { public static IssueDto toDto(DefaultIssue issue, Integer componentId, Integer ruleId) { return new IssueDto() - .setUuid(issue.key()) + .setKey(issue.key()) .setLine(issue.line()) .setTitle(issue.title()) .setDescription(issue.description()) @@ -326,7 +326,7 @@ public final class IssueDto { .setClosedAt(issue.closedAt()) .setRuleId(ruleId) .setResourceId(componentId) - .setData(issue.attributes() != null ? KeyValueFormat.format(issue.attributes()) : "") + .setAttributes(issue.attributes() != null ? KeyValueFormat.format(issue.attributes()) : "") // TODO // .setPersonId() ; @@ -334,7 +334,7 @@ public final class IssueDto { public DefaultIssue toDefaultIssue() { DefaultIssue issue = new DefaultIssue(); - issue.setKey(uuid); + issue.setKey(kee); issue.setStatus(status); issue.setResolution(resolution); issue.setDescription(description); @@ -347,7 +347,7 @@ public final class IssueDto { issue.setCreatedAt(createdAt); issue.setUpdatedAt(updatedAt); issue.setClosedAt(closedAt); - issue.setAttributes(KeyValueFormat.parse(Objects.firstNonNull(data, ""))); + issue.setAttributes(KeyValueFormat.parse(Objects.firstNonNull(attributes, ""))); issue.setComponentKey(componentKey); issue.setManual(manualIssue); issue.setManualSeverity(manualSeverity); diff --git a/sonar-core/src/main/resources/org/sonar/core/issue/IssueChangeMapper.xml b/sonar-core/src/main/resources/org/sonar/core/issue/IssueChangeMapper.xml index 168aeee56ff..ee47a8477f4 100644 --- a/sonar-core/src/main/resources/org/sonar/core/issue/IssueChangeMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/issue/IssueChangeMapper.xml @@ -26,8 +26,8 @@ i.id, - i.issue_uuid as issueUuid, - i.user_id as userId, + i.issue_key as issueKey, + i.user_login as userLogin, i.change_type as changeType, i.change_data as changeData, i.message as message, @@ -36,8 +36,8 @@ - INSERT INTO issue_changes (issue_uuid, user_id, change_type, change_data, message, created_at, updated_at) - VALUES (#{issueUuid}, #{userId}, #{changeType}, #{changeData}, #{message}, #{createdAt}, #{updatedAt}) + INSERT INTO issue_changes (issue_key, user_login, change_type, change_data, message, created_at, updated_at) + VALUES (#{issueKey}, #{userLogin}, #{changeType}, #{changeData}, #{message}, #{createdAt}, #{updatedAt}) @@ -45,8 +45,8 @@ select issue_changes_seq.NEXTVAL from DUAL - INSERT INTO issue_changes (id, issue_uuid, user_id, change_type, change_data, message, created_at, updated_at) - VALUES (#{id}, #{issueUuid}, #{userId}, #{changeType}, #{changeData}, #{message}, #{createdAt}, #{updatedAt}) + INSERT INTO issue_changes (id, issue_key, user_login, change_type, change_data, message, created_at, updated_at) + VALUES (#{id}, #{issueKey}, #{userLogin}, #{changeType}, #{changeData}, #{message}, #{createdAt}, #{updatedAt}) select from issue_changes i - where i.issue_uuid=#{issueUuid} + where i.issue_key=#{issueKey} diff --git a/sonar-core/src/main/resources/org/sonar/core/issue/IssueMapper.xml b/sonar-core/src/main/resources/org/sonar/core/issue/IssueMapper.xml index 44c0fdd72e0..12200a5ca6a 100644 --- a/sonar-core/src/main/resources/org/sonar/core/issue/IssueMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/issue/IssueMapper.xml @@ -6,14 +6,14 @@ i.id, - i.uuid as uuid, + i.kee as kee, i.resource_id as resourceId, i.rule_id as ruleId, i.severity as severity, i.manual_severity as manualSeverity, i.manual_issue as manualIssue, i.title as title, - i.message as description, + i.description as description, i.line as line, i.cost as cost, i.status as status, @@ -21,8 +21,8 @@ i.checksum as checksum, i.user_login as userLogin, i.assignee_login as assignee, - i.person_id as personId, - i.data as data, + i.author_login as authorLogin, + i.attributes as attributes, i.created_at as createdAt, i.updated_at as updatedAt, i.closed_at as closedAt, @@ -32,10 +32,10 @@ - INSERT INTO issues (uuid, resource_id, rule_id, severity, manual_severity, manual_issue, title, message, line, cost, status, - resolution, checksum, user_login, assignee_login, person_id, data, created_at, updated_at, closed_at) - VALUES (#{uuid}, #{resourceId}, #{ruleId}, #{severity}, #{manualSeverity}, #{manualIssue}, #{title}, #{description}, #{line}, #{cost}, #{status}, - #{resolution}, #{checksum}, #{userLogin}, #{assignee}, #{personId}, #{data}, #{createdAt}, #{updatedAt}, #{closedAt}) + INSERT INTO issues (kee, resource_id, rule_id, severity, manual_severity, manual_issue, title, description, line, cost, status, + resolution, checksum, user_login, assignee_login, author_login, attributes, created_at, updated_at, closed_at) + VALUES (#{kee}, #{resourceId}, #{ruleId}, #{severity}, #{manualSeverity}, #{manualIssue}, #{title}, #{description}, #{line}, #{cost}, #{status}, + #{resolution}, #{checksum}, #{userLogin}, #{assignee}, #{authorLogin}, #{attributes}, #{createdAt}, #{updatedAt}, #{closedAt}) @@ -43,10 +43,10 @@ select issues_seq.NEXTVAL from DUAL - INSERT INTO issues (id, uuid, resource_id, rule_id, severity, manual_severity, manual_issue, title, message, line, cost, status, - resolution, checksum, user_login, assignee_login, person_id, data, created_at, updated_at, closed_at) - VALUES (#{id}, #{uuid}, #{resourceId}, #{ruleId}, #{severity}, #{manualSeverity}, #{manualIssue}, #{title}, #{description}, #{line}, #{cost}, #{status}, - #{resolution}, #{checksum}, #{userLogin}, #{assignee}, #{personId}, #{data}, #{createdAt}, #{updatedAt}, #{closedAt}) + INSERT INTO issues (kee, uuid, resource_id, rule_id, severity, manual_severity, manual_issue, title, description, line, cost, status, + resolution, checksum, user_login, assignee_login, author_login, attributes, created_at, updated_at, closed_at) + VALUES (#{kee}, #{uuid}, #{resourceId}, #{ruleId}, #{severity}, #{manualSeverity}, #{manualIssue}, #{title}, #{description}, #{line}, #{cost}, #{status}, + #{resolution}, #{checksum}, #{userLogin}, #{assignee}, #{authorLogin}, #{attributes}, #{createdAt}, #{updatedAt}, #{closedAt}) @@ -57,7 +57,7 @@ manual_severity=#{manualSeverity}, manual_issue=#{manualIssue}, title=#{title}, - message=#{description}, + description=#{description}, line=#{line}, cost=#{cost}, status=#{status}, @@ -65,12 +65,12 @@ checksum=#{checksum}, user_login=#{userLogin}, assignee_login=#{assignee}, - person_id=#{personId}, - data=#{data}, + author_login=#{authorLogin}, + attributes=#{attributes}, created_at=#{createdAt}, updated_at=#{updatedAt}, closed_at=#{closedAt} - where uuid = #{uuid} + where kee = #{kee}