@Test public void testOdfValidate() { for (File currentFile : testFiles) { if(currentFile.isHidden() ) { continue; } printTestTitle("Testing OdfValidator with input file: " + currentFile.getName()); DigitalObject testIn = new DigitalObject.Builder(Content.byReference(currentFile)).title(currentFile.getName()).build(); URI format = techReg.createExtensionUri(FilenameUtils.getExtension(currentFile.getName())); ValidateResult vr = validator.validate(testIn, format, null); assertTrue("ValidateResult should not be NULL!", vr!=null); ServiceReport sr = vr.getReport(); System.out.println(sr); } }
public ValidateResult validate(DigitalObject digitalObject, URI format, List<Parameter> parameters) { if(digitalObject==null || digitalObject.getContent() == null) { return this.returnWithErrorMessage(format, "[OdfValidator] ERROR: No input file found!", null); } String name = DigitalObjectUtils.getFileNameFromDigObject(digitalObject, format); 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; }
OdfValidator implements Validate { public ValidateResult validate(DigitalObject digitalObject, URI format, List<Parameter> parameters) { if(digitalObject==null || digitalObject.getContent() == null) { return this.returnWithErrorMessage(format, "[OdfValidator] ERROR: No input file found!", null); } String name = DigitalObjectUtils.getFileNameFromDigObject(digitalObject, format); 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; } }
OdfValidator implements Validate { public ValidateResult validate(DigitalObject digitalObject, URI format, List<Parameter> parameters) { if(digitalObject==null || digitalObject.getContent() == null) { return this.returnWithErrorMessage(format, "[OdfValidator] ERROR: No input file found!", null); } String name = DigitalObjectUtils.getFileNameFromDigObject(digitalObject, format); 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; }  }
OdfValidator implements Validate { public ValidateResult validate(DigitalObject digitalObject, URI format, List<Parameter> parameters) { if(digitalObject==null || digitalObject.getContent() == null) { return this.returnWithErrorMessage(format, "[OdfValidator] ERROR: No input file found!", null); } String name = DigitalObjectUtils.getFileNameFromDigObject(digitalObject, format); 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; }  ServiceDescription describe(); ValidateResult validate(DigitalObject digitalObject, URI format,
			List<Parameter> parameters); }
OdfValidator implements Validate { public ValidateResult validate(DigitalObject digitalObject, URI format, List<Parameter> parameters) { if(digitalObject==null || digitalObject.getContent() == null) { return this.returnWithErrorMessage(format, "[OdfValidator] ERROR: No input file found!", null); } String name = DigitalObjectUtils.getFileNameFromDigObject(digitalObject, format); 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; }  ServiceDescription describe(); ValidateResult validate(DigitalObject digitalObject, URI format,
			List<Parameter> parameters); static final String NAME; }