public boolean setManualSeverity( DefaultIssue issue, String severity, IssueChangeContext context) { if (!issue.manualSeverity() || !Objects.equal(severity, issue.severity())) { issue.setFieldChange(context, SEVERITY, issue.severity(), severity); issue.setSeverity(severity); issue.setManualSeverity(true); issue.setUpdateDate(context.date()); issue.setChanged(true); issue.setSendNotifications(true); return true; } return false; }
public boolean setSeverity(DefaultIssue issue, String severity, IssueChangeContext context) { if (issue.manualSeverity()) { throw new IllegalStateException("Severity can't be changed"); } if (!Objects.equal(severity, issue.severity())) { issue.setFieldChange(context, SEVERITY, issue.severity(), severity); issue.setSeverity(severity); issue.setUpdateDate(context.date()); issue.setChanged(true); return true; } return false; }
public boolean setPastSeverity( DefaultIssue issue, @Nullable String previousSeverity, IssueChangeContext context) { String currentSeverity = issue.severity(); issue.setSeverity(previousSeverity); return setSeverity(issue, currentSeverity, context); }