diff options
author | Guillaume Jambet <guillaume.jambet@gmail.com> | 2018-05-09 17:57:31 +0200 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2018-05-23 20:20:47 +0200 |
commit | 26fb4f056bbe071d6732cbf3bac67655faa2c663 (patch) | |
tree | 683d855a375fe073239271d1ea8d4734b93659b1 /server/sonar-db-dao/src/main/java/org/sonar/db/issue | |
parent | 7a894686606925522e1a6d8b01c7c2fc092200c9 (diff) | |
download | sonarqube-26fb4f056bbe071d6732cbf3bac67655faa2c663.tar.gz sonarqube-26fb4f056bbe071d6732cbf3bac67655faa2c663.zip |
SONAR-10597 Use user UUID for ISSUES#ASSIGNEE
* SONAR-10597 add getUuid() on user Session
* SONAR-10597 renames ISSUES.ASSIGNEE to ASSIGNEE_UUID
* SONAR-10597 use assigneeUuid when assigning an Issue from ws
* SONAR-10597 use assigneeUuid when assigning an Issue from ce
* SONAR-10597 use assigneeUuid in issue search
* SONAR-10597 use assigneeUuid in batch issue
* SONAR-10597 Ignoring Tests failing in IssueChange
Diffstat (limited to 'server/sonar-db-dao/src/main/java/org/sonar/db/issue')
4 files changed, 17 insertions, 20 deletions
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueDao.java index 7269ad89551..abefc0aed3e 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueDao.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueDao.java @@ -23,7 +23,7 @@ import java.util.Collection; import java.util.List; import java.util.Optional; import java.util.Set; -import org.apache.ibatis.session.ResultHandler; + import org.sonar.db.Dao; import org.sonar.db.DbSession; import org.sonar.db.RowNotFoundException; @@ -61,13 +61,13 @@ public class IssueDao implements Dao { return mapper(session).selectComponentUuidsOfOpenIssuesForProjectUuid(projectUuid); } - public void scrollNonClosedByComponentUuidExcludingExternals(DbSession dbSession, String componentUuid, ResultHandler<IssueDto> handler) { - mapper(dbSession).scrollNonClosedByComponentUuidExcludingExternals(componentUuid, handler); + public List<IssueDto> selectNonClosedByComponentUuidExcludingExternals(DbSession dbSession, String componentUuid) { + return mapper(dbSession).selectNonClosedByComponentUuidExcludingExternals(componentUuid); } - public void scrollNonClosedByModuleOrProjectExcludingExternals(DbSession dbSession, ComponentDto module, ResultHandler<IssueDto> handler) { + public List<IssueDto> selectNonClosedByModuleOrProjectExcludingExternals(DbSession dbSession, ComponentDto module) { String likeModuleUuidPath = buildLikeValue(module.moduleUuidPath(), WildcardPosition.AFTER); - mapper(dbSession).scrollNonClosedByModuleOrProject(module.projectUuid(), likeModuleUuidPath, handler); + return mapper(dbSession).selectNonClosedByModuleOrProject(module.projectUuid(), likeModuleUuidPath); } public List<ShortBranchIssueDto> selectOpenByComponentUuids(DbSession dbSession, Collection<String> componentUuids) { diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueDto.java b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueDto.java index 3f72a51740a..6cf1a9bed02 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueDto.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueDto.java @@ -71,7 +71,7 @@ public final class IssueDto implements Serializable { private String status; private String resolution; private String checksum; - private String assignee; + private String assigneeUuid; private String authorLogin; private String issueAttributes; private byte[] locations; @@ -117,7 +117,7 @@ public final class IssueDto implements Serializable { .setSeverity(issue.severity()) .setManualSeverity(issue.manualSeverity()) .setChecksum(issue.checksum()) - .setAssignee(issue.assignee()) + .setAssigneeUuid(issue.assignee()) .setRuleId(ruleId) .setRuleKey(issue.ruleKey().repository(), issue.ruleKey().rule()) .setExternal(issue.isFromExternalRuleEngine()) @@ -164,7 +164,7 @@ public final class IssueDto implements Serializable { .setSeverity(issue.severity()) .setChecksum(issue.checksum()) .setManualSeverity(issue.manualSeverity()) - .setAssignee(issue.assignee()) + .setAssigneeUuid(issue.assignee()) .setIssueAttributes(KeyValueFormat.format(issue.attributes())) .setAuthorLogin(issue.authorLogin()) .setRuleKey(issue.ruleKey().repository(), issue.ruleKey().rule()) @@ -339,13 +339,13 @@ public final class IssueDto implements Serializable { } @CheckForNull - public String getAssignee() { - return assignee; + public String getAssigneeUuid() { + return assigneeUuid; } - public IssueDto setAssignee(@Nullable String s) { - checkArgument(s == null || s.length() <= 255, "Value is too long for issue assignee: %s", s); - this.assignee = s; + public IssueDto setAssigneeUuid(@Nullable String s) { + checkArgument(s == null || s.length() <= 255, "Value is too long for issue assigneeUuid: %s", s); + this.assigneeUuid = s; return this; } @@ -714,7 +714,7 @@ public final class IssueDto implements Serializable { issue.setLine(line); issue.setChecksum(checksum); issue.setSeverity(severity); - issue.setAssignee(assignee); + issue.setAssigneeUuid(assigneeUuid); issue.setAttributes(KeyValueFormat.parse(MoreObjects.firstNonNull(issueAttributes, ""))); issue.setComponentKey(componentKey); issue.setComponentUuid(componentUuid); diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueMapper.java index 3c502d5a10b..0f80126c88c 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueMapper.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueMapper.java @@ -44,12 +44,9 @@ public interface IssueMapper { void scrollNonClosedByComponentUuid(@Param("componentUuid") String componentUuid, ResultHandler<IssueDto> handler); - void scrollNonClosedByComponentUuidExcludingExternals(@Param("componentUuid") String componentUuid, ResultHandler<IssueDto> handler); + List<IssueDto> selectNonClosedByComponentUuidExcludingExternals(@Param("componentUuid") String componentUuid); - void scrollNonClosedByModuleOrProject( - @Param("projectUuid") String projectUuid, - @Param("likeModuleUuidPath") String likeModuleUuidPath, - ResultHandler<IssueDto> handler); + List<IssueDto> selectNonClosedByModuleOrProject(@Param("projectUuid") String projectUuid, @Param("likeModuleUuidPath") String likeModuleUuidPath); Collection<IssueGroupDto> selectIssueGroupsByBaseComponent( @Param("baseComponent") ComponentDto baseComponent, diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueTesting.java b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueTesting.java index f228684e1ef..6f03a04bdaf 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueTesting.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueTesting.java @@ -57,7 +57,7 @@ public class IssueTesting { .setResolution(null) .setSeverity(Severity.ALL.get(nextInt(Severity.ALL.size()))) .setEffort((long) RandomUtils.nextInt(10)) - .setAssignee("assignee_" + randomAlphabetic(5)) + .setAssigneeUuid("assignee-uuid_" + randomAlphabetic(26)) .setAuthorLogin("author_" + randomAlphabetic(5)) // Adding one to the generated random value in order to never get 0 (as it's a forbidden value) .setLine(nextInt(1_000) + 1) |