APISonar


org.sonar.core.issue.IssueChangeContext.date

> org > sonar > core > issue > IssueChangeContext > date
org APIs sonar APIs core APIs issue APIs IssueChangeContext APIs date APIs

Example 1
public void setCreationDate(DefaultIssue issue, Date d, IssueChangeContext context) {
    if (relevantDateDifference(d, issue.creationDate())) {
      issue.setCreationDate(d);
      issue.setUpdateDate(context.date());
      issue.setChanged(true);
    }
  }
Example 2
public boolean setEffort(DefaultIssue issue, @Nullable Duration value, IssueChangeContext context) {
    Duration oldValue = issue.effort();
    if (!Objects.equals(value, oldValue)) {
      issue.setEffort(value);
      issue.setFieldChange(context, TECHNICAL_DEBT, oldValue != null ? oldValue.toMinutes() : null, value != null ? value.toMinutes() : null);
      issue.setUpdateDate(context.date());
      issue.setChanged(true);
      return true;
    }
    return false;
  }
Example 3
public boolean setSeverity(DefaultIssue issue, String severity, IssueChangeContext context) {
    checkState(!issue.manualSeverity(), "Severity can't be changed");
    if (!Objects.equals(severity, issue.severity())) {
      issue.setFieldChange(context, SEVERITY, issue.severity(), severity);
      issue.setSeverity(severity);
      issue.setUpdateDate(context.date());
      issue.setChanged(true);
      return true;
    }
    return false;
  }
Example 4
public boolean assign(DefaultIssue issue, @Nullable UserDto user, IssueChangeContext context) {
    String assigneeUuid = user != null ? user.getUuid() : null;
    if (!Objects.equals(assigneeUuid, issue.assignee())) {
      String newAssigneeName = user == null ? null : user.getName();
      issue.setFieldChange(context, ASSIGNEE, UNUSED, newAssigneeName);
      issue.setAssigneeUuid(user != null ? user.getUuid() : null);
      issue.setUpdateDate(context.date());
      issue.setChanged(true);
      issue.setSendNotifications(true);
      return true;
    }
    return false;
  }