Search in sources :

Example 11 with IssueChangeContext

use of org.sonar.core.issue.IssueChangeContext in project sonarqube by SonarSource.

the class IssueService method setTags.

public Collection<String> setTags(String issueKey, Collection<String> tags) {
    userSession.checkLoggedIn();
    DbSession session = dbClient.openSession(false);
    try {
        DefaultIssue issue = issueFinder.getByKey(session, issueKey).toDefaultIssue();
        IssueChangeContext context = IssueChangeContext.createUser(new Date(), userSession.getLogin());
        if (issueFieldsSetter.setTags(issue, tags, context)) {
            issueUpdater.saveIssue(session, issue, context, null);
        }
        return issue.tags();
    } finally {
        session.close();
    }
}
Also used : DbSession(org.sonar.db.DbSession) IssueChangeContext(org.sonar.core.issue.IssueChangeContext) DefaultIssue(org.sonar.core.issue.DefaultIssue) Date(java.util.Date)

Aggregations

Date (java.util.Date)11 IssueChangeContext (org.sonar.core.issue.IssueChangeContext)11 DefaultIssue (org.sonar.core.issue.DefaultIssue)10 Test (org.junit.Test)5 DbSession (org.sonar.db.DbSession)3 ComponentDto (org.sonar.db.component.ComponentDto)2 IssueDto (org.sonar.db.issue.IssueDto)2 RuleDto (org.sonar.db.rule.RuleDto)2 RuleTesting.newRuleDto (org.sonar.db.rule.RuleTesting.newRuleDto)2 User (org.sonar.api.user.User)1 DefaultIssueComment (org.sonar.core.issue.DefaultIssueComment)1 MovedFilesRepository (org.sonar.server.computation.task.projectanalysis.filemove.MovedFilesRepository)1 IssueChangeNotification (org.sonar.server.issue.notification.IssueChangeNotification)1 AddCommentRequest (org.sonarqube.ws.client.issue.AddCommentRequest)1