Class 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 Detail

      • 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 Detail

      • setCustomExtensionDomains

        public FhirInstanceValidator setCustomExtensionDomains​(List<String> extensionDomains)
        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

        public FhirInstanceValidator setCustomExtensionDomains​(String... extensionDomains)
        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.IResourceValidator.BestPracticeWarningLevel getBestPracticeWarningLevel()
        Returns the "best practice" warning level (default is IResourceValidator.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 IResourceValidator.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 IResourceValidator.BestPracticeWarningLevel.Ignore, best practice guielines will be ignored.

        See Also:
        setBestPracticeWarningLevel(BestPracticeWarningLevel)
      • setBestPracticeWarningLevel

        public void setBestPracticeWarningLevel​(org.hl7.fhir.r5.utils.IResourceValidator.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 IResourceValidator.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 IResourceValidator.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.
        Returns:
      • 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.
      • 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
      • validate

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

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

        public void setValidatorResourceFetcher​(org.hl7.fhir.r5.utils.IResourceValidator.IValidatorResourceFetcher validatorResourceFetcher)
      • 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