use of org.sonar.db.issue.IssueDto in project sonarqube by SonarSource.
the class ViewIndexerTest method addProjectWithIssue.
private ComponentDto addProjectWithIssue(RuleDto rule, OrganizationDto org) {
ComponentDto project = ComponentTesting.newProjectDto(org);
ComponentDto file = ComponentTesting.newFileDto(project, null);
dbTester.components().insertComponents(project, file);
dbTester.users().insertProjectPermissionOnAnyone(UserRole.USER, project);
IssueDto issue = IssueTesting.newDto(rule, file, project);
dbClient.issueDao().insert(dbSession, issue);
dbSession.commit();
return project;
}
use of org.sonar.db.issue.IssueDto in project sonarqube by SonarSource.
the class UpdateConflictResolver method resolve.
public void resolve(DefaultIssue issue, IssueMapper mapper) {
LOG.debug("Resolve conflict on issue {}", issue.key());
IssueDto dbIssue = mapper.selectByKey(issue.key());
if (dbIssue != null) {
mergeFields(dbIssue, issue);
mapper.update(IssueDto.toDtoForUpdate(issue, System.currentTimeMillis()));
}
}
use of org.sonar.db.issue.IssueDto in project sonarqube by SonarSource.
the class ServerIssueStorage method doInsert.
@Override
protected String doInsert(DbSession session, long now, DefaultIssue issue) {
ComponentDto component = component(session, issue);
ComponentDto project = project(session, issue);
int ruleId = rule(issue).getId();
IssueDto dto = IssueDto.toDtoForServerInsert(issue, component, project, ruleId, now);
getDbClient().issueDao().insert(session, dto);
return dto.getKey();
}
use of org.sonar.db.issue.IssueDto in project sonarqube by SonarSource.
the class ServerIssueStorage method doUpdate.
@Override
protected String doUpdate(DbSession session, long now, DefaultIssue issue) {
IssueDto dto = IssueDto.toDtoForUpdate(issue, now);
getDbClient().issueDao().update(session, dto);
return dto.getKey();
}
use of org.sonar.db.issue.IssueDto in project sonarqube by SonarSource.
the class SearchResponseFormat method formatIssues.
private List<Issues.Issue> formatIssues(Set<SearchAdditionalField> fields, SearchResponseData data) {
List<Issues.Issue> result = new ArrayList<>();
Issues.Issue.Builder issueBuilder = Issues.Issue.newBuilder();
for (IssueDto dto : data.getIssues()) {
issueBuilder.clear();
formatIssue(issueBuilder, dto, data);
if (fields.contains(SearchAdditionalField.ACTIONS)) {
formatIssueActions(data, issueBuilder, dto);
}
if (fields.contains(SearchAdditionalField.TRANSITIONS)) {
formatIssueTransitions(data, issueBuilder, dto);
}
if (fields.contains(SearchAdditionalField.COMMENTS)) {
formatIssueComments(data, issueBuilder, dto);
}
result.add(issueBuilder.build());
}
return result;
}
Aggregations