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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFhirInstanceValidator.NullEvaluationContext
-
Constructor Summary
Constructors Constructor Description FhirInstanceValidator(ca.uhn.fhir.context.FhirContext theContext)ConstructorFhirInstanceValidator(ca.uhn.fhir.context.support.IValidationSupport theValidationSupport)Constructor which uses the given validation support
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.hl7.fhir.r5.utils.IResourceValidator.BestPracticeWarningLevelgetBestPracticeWarningLevel()Returns the "best practice" warning level (default isIResourceValidator.BestPracticeWarningLevel.Hint).List<String>getExtensionDomains()ca.uhn.fhir.context.support.IValidationSupportgetValidationSupport()Returns thevalidation supportin use by this validator.org.hl7.fhir.r5.utils.IResourceValidator.IValidatorResourceFetchergetValidatorResourceFetcher()voidinvalidateCaches()Clear any cached data held by the validator or any of its internal stores.booleanisAnyExtensionsAllowed()If set to true (default is true) extensions which are not known to the validator (e.g.booleanisAssumeValidRestReferences()booleanisErrorForUnknownProfiles()booleanisNoTerminologyChecks()If set to true (default is false) the valueSet will not be validateprotected VersionSpecificWorkerContextWrapperprovideWorkerContext()voidsetAnyExtensionsAllowed(boolean theAnyExtensionsAllowed)If set to true (default is true) extensions which are not known to the validator (e.g.voidsetAssumeValidRestReferences(boolean assumeValidRestReferences)voidsetBestPracticeWarningLevel(org.hl7.fhir.r5.utils.IResourceValidator.BestPracticeWarningLevel theBestPracticeWarningLevel)Sets the "best practice warning level".FhirInstanceValidatorsetCustomExtensionDomains(String... extensionDomains)Every element in a resource or data type includes an optionalextension child element which is identified by it'surl attribute.FhirInstanceValidatorsetCustomExtensionDomains(List<String> extensionDomains)Every element in a resource or data type includes an optionalextension child element which is identified by it'surl attribute.voidsetErrorForUnknownProfiles(boolean errorForUnknownProfiles)voidsetNoTerminologyChecks(boolean theNoTerminologyChecks)If set to true (default is false) the valueSet will not be validatevoidsetValidationSupport(ca.uhn.fhir.context.support.IValidationSupport theValidationSupport)Sets thevalidation supportin use by this validator.voidsetValidatorResourceFetcher(org.hl7.fhir.r5.utils.IResourceValidator.IValidatorResourceFetcher validatorResourceFetcher)protected List<org.hl7.fhir.utilities.validation.ValidationMessage>validate(ca.uhn.fhir.validation.IValidationContext<?> theValidationCtx)voidvalidateResource(ca.uhn.fhir.validation.IValidationContext<org.hl7.fhir.instance.model.api.IBaseResource> theCtx)
-
-
-
Constructor Detail
-
FhirInstanceValidator
public FhirInstanceValidator(ca.uhn.fhir.context.FhirContext theContext)
ConstructorUses
DefaultProfileValidationSupportforvalidation 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 optionalextension child element which is identified by it'surl attribute. There exists a number of predefined extension urls or extension domains:- any url which contains
example.org,nema.org, oracme.com. - any url which starts with
http://hl7.org/fhir/StructureDefinition/.
Any unknown extension domain will result in an information message when validating a resource.
- any url which contains
-
setCustomExtensionDomains
public FhirInstanceValidator setCustomExtensionDomains(String... extensionDomains)
Every element in a resource or data type includes an optionalextension child element which is identified by it'surl attribute. There exists a number of predefined extension urls or extension domains:- any url which contains
example.org,nema.org, oracme.com. - any url which starts with
http://hl7.org/fhir/StructureDefinition/.
Any unknown extension domain will result in an information message when validating a resource.
- any url which contains
-
getBestPracticeWarningLevel
public org.hl7.fhir.r5.utils.IResourceValidator.BestPracticeWarningLevel getBestPracticeWarningLevel()
Returns the "best practice" warning level (default isIResourceValidator.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 toIResourceValidator.BestPracticeWarningLevel.Ignore, best practice guielines will be ignored.
-
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 toIResourceValidator.BestPracticeWarningLevel.Ignore, best practice guielines will be ignored.- Parameters:
theBestPracticeWarningLevel- The level, must not benull
-
getValidationSupport
public ca.uhn.fhir.context.support.IValidationSupport getValidationSupport()
Returns thevalidation supportin 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 thevalidation supportin 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
-
getExtensionDomains
public List<String> getExtensionDomains()
-
validate
protected List<org.hl7.fhir.utilities.validation.ValidationMessage> validate(ca.uhn.fhir.validation.IValidationContext<?> theValidationCtx)
-
provideWorkerContext
@Nonnull protected VersionSpecificWorkerContextWrapper provideWorkerContext()
-
getValidatorResourceFetcher
public org.hl7.fhir.r5.utils.IResourceValidator.IValidatorResourceFetcher getValidatorResourceFetcher()
-
setValidatorResourceFetcher
public void setValidatorResourceFetcher(org.hl7.fhir.r5.utils.IResourceValidator.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:
validateResourcein interfaceca.uhn.fhir.validation.IValidatorModule
-
-