Class ChEmedEprHapiValidator

java.lang.Object
org.projecthusky.fhir.emed.ch.epr.validator.ChEmedEprHapiValidator
All Implemented Interfaces:
ChEmedEprValidator

public class ChEmedEprHapiValidator extends Object implements ChEmedEprValidator
A HAPI based implementation of the ChEmedEprValidator.
  • Constructor Details

    • ChEmedEprHapiValidator

      public ChEmedEprHapiValidator(ca.uhn.fhir.context.FhirContext context) throws IOException
      Creates an instance of an offline ChEmedEprValidator, 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 based ChEmedEprValidator.
      Parameters:
      context - The FHIR context to be used.
      txServer - The URL of the terminology server to be used. If null or 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: ChEmedEprValidator
      Validates a CH-EMED-EPR document Bundle AND performs a logic validation of the content as well.
      Specified by:
      validateDocumentBundle in interface ChEmedEprValidator
      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

      public ValidationResult validateDocumentBundle(org.hl7.fhir.r4.model.Bundle bundle, String profile)
      Description copied from interface: ChEmedEprValidator
      Validates a CH-EMED-EPR document Bundle. No logic validation is performed on the content.
      Specified by:
      validateDocumentBundle in interface ChEmedEprValidator
      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

      protected void logValidationResult(ValidationResult validationResult)
      Logs a validation result as info messages, to loosely imitate matchbox-engine behaviour.
      Parameters:
      validationResult - The validation result to be logged.