Class FhirInstanceValidator

java.lang.Object
org.hl7.fhir.common.hapi.validation.validator.FhirInstanceValidator
All Implemented Interfaces:
ca.uhn.fhir.validation.IInstanceValidatorModule, ca.uhn.fhir.validation.IValidatorModule

public class FhirInstanceValidator extends Object implements ca.uhn.fhir.validation.IInstanceValidatorModule
  • Constructor Details

    • FhirInstanceValidator

      public FhirInstanceValidator(ca.uhn.fhir.context.FhirContext theContext)
      Constructor

      Uses DefaultProfileValidationSupport for validation support

    • FhirInstanceValidator

      public FhirInstanceValidator(ca.uhn.fhir.context.support.IValidationSupport theValidationSupport)
      Constructor which uses the given validation support
      Parameters:
      theValidationSupport - The validation support
  • Method Details

    • setCustomExtensionDomains

      Every element in a resource or data type includes an optional extension child element which is identified by it's url attribute. There exists a number of predefined extension urls or extension domains:
      • any url which contains example.org, nema.org, or acme.com.
      • any url which starts with http://hl7.org/fhir/StructureDefinition/.
      It is possible to extend this list of known extension by defining custom extensions: Any url which starts which one of the elements in the list of custom extension domains is considered as known.

      Any unknown extension domain will result in an information message when validating a resource.

    • setCustomExtensionDomains

      Every element in a resource or data type includes an optional extension child element which is identified by it's url attribute. There exists a number of predefined extension urls or extension domains:
      • any url which contains example.org, nema.org, or acme.com.
      • any url which starts with http://hl7.org/fhir/StructureDefinition/.
      It is possible to extend this list of known extension by defining custom extensions: Any url which starts which one of the elements in the list of custom extension domains is considered as known.

      Any unknown extension domain will result in an information message when validating a resource.

    • getBestPracticeWarningLevel

      public org.hl7.fhir.r5.utils.validation.constants.BestPracticeWarningLevel getBestPracticeWarningLevel()
      Returns the "best practice" warning level (default is BestPracticeWarningLevel.Hint).

      The FHIR Instance Validator has a number of checks for best practices in terms of FHIR usage. If this setting is set to BestPracticeWarningLevel.Error, any resource data which does not meet these best practices will be reported at the ERROR level. If this setting is set to BestPracticeWarningLevel.Ignore, best practice guielines will be ignored.

      See Also:
    • setBestPracticeWarningLevel

      public void setBestPracticeWarningLevel(org.hl7.fhir.r5.utils.validation.constants.BestPracticeWarningLevel theBestPracticeWarningLevel)
      Sets the "best practice warning level". When validating, any deviations from best practices will be reported at this level.

      The FHIR Instance Validator has a number of checks for best practices in terms of FHIR usage. If this setting is set to BestPracticeWarningLevel.Error, any resource data which does not meet these best practices will be reported at the ERROR level. If this setting is set to BestPracticeWarningLevel.Ignore, best practice guielines will be ignored.

      Parameters:
      theBestPracticeWarningLevel - The level, must not be null
    • getValidationSupport

      public ca.uhn.fhir.context.support.IValidationSupport getValidationSupport()
      Returns the validation support in use by this validator. Default is an instance of DefaultProfileValidationSupport if the no-arguments constructor for this object was used.
    • setValidationSupport

      public void setValidationSupport(ca.uhn.fhir.context.support.IValidationSupport theValidationSupport)
      Sets the validation support in use by this validator. Default is an instance of DefaultProfileValidationSupport if the no-arguments constructor for this object was used.
    • isAnyExtensionsAllowed

      public boolean isAnyExtensionsAllowed()
      If set to true (default is true) extensions which are not known to the validator (e.g. because they have not been explicitly declared in a profile) will be validated but will not cause an error.
    • setAnyExtensionsAllowed

      public void setAnyExtensionsAllowed(boolean theAnyExtensionsAllowed)
      If set to true (default is true) extensions which are not known to the validator (e.g. because they have not been explicitly declared in a profile) will be validated but will not cause an error.
    • isErrorForUnknownProfiles

      public boolean isErrorForUnknownProfiles()
    • setErrorForUnknownProfiles

      public void setErrorForUnknownProfiles(boolean errorForUnknownProfiles)
    • isNoTerminologyChecks

      public boolean isNoTerminologyChecks()
      If set to true (default is false) the valueSet will not be validate
    • setNoTerminologyChecks

      public void setNoTerminologyChecks(boolean theNoTerminologyChecks)
      If set to true (default is false) the valueSet will not be validate
    • isNoExtensibleWarnings

      public boolean isNoExtensibleWarnings()
      If set to true (default is false) no extensible warnings suppressed
    • setNoExtensibleWarnings

      public void setNoExtensibleWarnings(boolean theNoExtensibleWarnings)
      If set to true (default is false) no extensible warnings is suppressed
    • isNoBindingMsgSuppressed

      public boolean isNoBindingMsgSuppressed()
      If set to true (default is false) no binding message is suppressed
    • setNoBindingMsgSuppressed

      public void setNoBindingMsgSuppressed(boolean theNoBindingMsgSuppressed)
      If set to true (default is false) no binding message is suppressed
    • getExtensionDomains

    • validate

      protected List<org.hl7.fhir.utilities.validation.ValidationMessage> validate(ca.uhn.fhir.validation.IValidationContext<?> theValidationCtx)
    • provideWorkerContext

    • getValidatorPolicyAdvisor

      public org.hl7.fhir.r5.utils.validation.IValidationPolicyAdvisor getValidatorPolicyAdvisor()
    • setValidatorPolicyAdvisor

      public void setValidatorPolicyAdvisor(org.hl7.fhir.r5.utils.validation.IValidationPolicyAdvisor validatorPolicyAdvisor)
    • getValidatorResourceFetcher

      public org.hl7.fhir.r5.utils.validation.IValidatorResourceFetcher getValidatorResourceFetcher()
    • setValidatorResourceFetcher

      public void setValidatorResourceFetcher(org.hl7.fhir.r5.utils.validation.IValidatorResourceFetcher validatorResourceFetcher)
    • isAssumeValidRestReferences

      public boolean isAssumeValidRestReferences()
    • setAssumeValidRestReferences

      public void setAssumeValidRestReferences(boolean assumeValidRestReferences)
    • invalidateCaches

      public void invalidateCaches()
      Clear any cached data held by the validator or any of its internal stores. This is mostly intended for unit tests, but could be used for production uses too.
    • validateResource

      public void validateResource(ca.uhn.fhir.validation.IValidationContext<org.hl7.fhir.instance.model.api.IBaseResource> theCtx)
      Specified by:
      validateResource in interface ca.uhn.fhir.validation.IValidatorModule