Class ChEmedEprHapiValidator
java.lang.Object
org.projecthusky.fhir.emed.ch.epr.validator.ChEmedEprHapiValidator
- All Implemented Interfaces:
ChEmedEprValidator
A HAPI based implementation of the
ChEmedEprValidator.-
Field Summary
Fields inherited from interface org.projecthusky.fhir.emed.ch.epr.validator.ChEmedEprValidator
packageResourceList -
Constructor Summary
ConstructorsConstructorDescriptionChEmedEprHapiValidator(ca.uhn.fhir.context.FhirContext context) Creates an instance of an offlineChEmedEprValidator, that is, a validator that will not try to use external terminology services, and that uses HAPI's validation engine.ChEmedEprHapiValidator(ca.uhn.fhir.context.FhirContext context, @Nullable String txServer) Creates an instance of a HAPI basedChEmedEprValidator. -
Method Summary
Modifier and TypeMethodDescriptionaddValidationMessagePostProcessingInterceptor(ca.uhn.fhir.rest.server.interceptor.validation.ValidationMessagePostProcessingInterceptor interceptor) Adds an interceptor to the list of validation message post-processing interceptors.List<@NonNull ca.uhn.fhir.rest.server.interceptor.validation.ValidationMessagePostProcessingInterceptor> Gets the list of validation message post-processing interceptors to be processed after validation.protected voidhandleValidationResult(ca.uhn.fhir.validation.ValidationResult result) Handles the HAPI FHIR validation result by having all registered post-processors handle it.protected voidlogValidationResult(ValidationResult validationResult) Logs a validation result as info messages, to loosely imitate matchbox-engine behaviour.validateDocumentBundle(InputStream documentStream, ChEmedEprDocument document) Validates a CH-EMED-EPR document Bundle AND performs a logic validation of the content as well.validateDocumentBundle(org.hl7.fhir.r4.model.Bundle bundle, String profile) Validates a CH-EMED-EPR document Bundle.
-
Constructor Details
-
ChEmedEprHapiValidator
Creates an instance of an offlineChEmedEprValidator, that is, a validator that will not try to use external terminology services, and that uses HAPI's validation engine.- Parameters:
context- The FHIR context to be used.- Throws:
IOException- if the NPM packages can't be found in the classpath.
-
ChEmedEprHapiValidator
public ChEmedEprHapiValidator(ca.uhn.fhir.context.FhirContext context, @Nullable String txServer) throws IOException Creates an instance of a HAPI basedChEmedEprValidator.- Parameters:
context- The FHIR context to be used.txServer- The URL of the terminology server to be used. Ifnullor blank, no external terminology services will be used for validation.- Throws:
IOException- if the NPM packages can't be found in the classpath.
-
-
Method Details
-
getInterceptors
public List<@NonNull ca.uhn.fhir.rest.server.interceptor.validation.ValidationMessagePostProcessingInterceptor> getInterceptors()Gets the list of validation message post-processing interceptors to be processed after validation. -
addValidationMessagePostProcessingInterceptor
public ChEmedEprHapiValidator addValidationMessagePostProcessingInterceptor(ca.uhn.fhir.rest.server.interceptor.validation.ValidationMessagePostProcessingInterceptor interceptor) Adds an interceptor to the list of validation message post-processing interceptors. -
validateDocumentBundle
public ValidationResult validateDocumentBundle(InputStream documentStream, ChEmedEprDocument document) throws IOException Description copied from interface:ChEmedEprValidatorValidates a CH-EMED-EPR document Bundle AND performs a logic validation of the content as well.- Specified by:
validateDocumentBundlein interfaceChEmedEprValidator- Parameters:
documentStream- The document Bundle to validate as a stream.document- The parsed CH EMED EPR document, for the logic validator.- Returns:
- the validation result.
- Throws:
IOException
-
validateDocumentBundle
Description copied from interface:ChEmedEprValidatorValidates a CH-EMED-EPR document Bundle. No logic validation is performed on the content.- Specified by:
validateDocumentBundlein interfaceChEmedEprValidator- Parameters:
bundle- The document Bundle to be validated.profile- The profile to match the bundle against.- Returns:
- the validation result.
-
handleValidationResult
protected void handleValidationResult(ca.uhn.fhir.validation.ValidationResult result) Handles the HAPI FHIR validation result by having all registered post-processors handle it. The result is expected to be potentially modified by the handling. No new instance will be kept, results must be modified. -
logValidationResult
Logs a validation result as info messages, to loosely imitate matchbox-engine behaviour.- Parameters:
validationResult- The validation result to be logged.
-