private WCAGValidationResult toWCAGResult(ValidatorResults validatorResults) {
if (validatorResults.isEmpty()) {
return WCAGValidationResult.OK;
}
WCAGValidationResult wcagResult = new WCAGValidationResult();
for (Result result : validatorResults.getErrors()) {
wcagResult.getErrors().add(new WCAGViolation(result.getType().toString(), result.getMessage(), result.getContext(), StringEscapeUtils.escapeXml(result.getCode()), result.getExample(), Integer.valueOf(result.getLine()), Integer.valueOf(result.getColumn())));
}
for (Result result : validatorResults.getWarnings()) {
wcagResult.getWarnings().add(new WCAGViolation(result.getType().toString(), result.getMessage(), result.getContext(), StringEscapeUtils.escapeXml(result.getCode()), result.getExample(), Integer.valueOf(result.getLine()), Integer.valueOf(result.getColumn())));
}
for (Result result : validatorResults.getInfos()) {
wcagResult.getInfos().add(new WCAGViolation(result.getType().toString(), result.getMessage(), result.getContext(), StringEscapeUtils.escapeXml(result.getCode()), result.getExample(), Integer.valueOf(result.getLine()), Integer.valueOf(result.getColumn())));
}
return wcagResult;
}