}
public Violation toViolation(DefaultIssue issue) {
Rule rule = ruleFinder.findByKey(issue.ruleKey());
Resource resource = resourceCache.get(issue.componentKey());
Violation violation = new Violation(rule, resource);
violation.setNew(issue.isNew());
violation.setChecksum(issue.checksum());
violation.setMessage(issue.message());
violation.setCost(issue.effortToFix());
violation.setLineId(issue.line());
violation.setCreatedAt(issue.creationDate());
violation.setManual(issue.reporter() != null);
violation.setSeverity(RulePriority.valueOf(issue.severity()));
violation.setSwitchedOff(issue.resolution() != null);
return violation;
}