File inputOdfFile = DigitalObjectUtils.toFile(digitalObject);
inputOdfFile.deleteOnExit();
CoreOdfValidator odfValidator = new CoreOdfValidator();
OdfValidatorResult result = odfValidator.validate(inputOdfFile, parameters);
ValidateResult vr = null;
if(result.documentIsValid()) {
vr = new ValidateResult.Builder(format,
new ServiceReport(Type.INFO, Status.SUCCESS, result.getValidationResultAsString()))
.ofThisFormat(result.isOdfFile())
.validInRegardToThisFormat(result.documentIsValid()).build();
}
else {
vr = new ValidateResult.Builder(format, new ServiceReport(Type.INFO, Status.SUCCESS, result.getValidationResultAsString()))
.ofThisFormat(result.isOdfFile())
.validInRegardToThisFormat(result.documentIsValid()).build();
}
return vr;
}