Package org.hl7.fhir.r5.context
Class SimpleWorkerContext
java.lang.Object
org.hl7.fhir.utilities.i18n.I18nBase
org.hl7.fhir.r5.context.BaseWorkerContext
org.hl7.fhir.r5.context.SimpleWorkerContext
- All Implemented Interfaces:
ProfileUtilities.ProfileKnowledgeProvider,IWorkerContext
public class SimpleWorkerContext
extends BaseWorkerContext
implements IWorkerContext, ProfileUtilities.ProfileKnowledgeProvider
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interfacestatic classstatic classNested classes/interfaces inherited from class org.hl7.fhir.r5.context.BaseWorkerContext
BaseWorkerContext.MetadataResourceVersionComparator<T extends CanonicalResource>, BaseWorkerContext.NullTranslator, BaseWorkerContext.ResourceProxyNested classes/interfaces inherited from interface org.hl7.fhir.r5.context.IWorkerContext
IWorkerContext.CodingValidationRequest, IWorkerContext.ICanonicalResourceLocator, IWorkerContext.IContextResourceLoader, IWorkerContext.ILoggingService, IWorkerContext.PackageDetails, IWorkerContext.PackageVersion, IWorkerContext.ValidationResultNested classes/interfaces inherited from interface org.hl7.fhir.r5.conformance.ProfileUtilities.ProfileKnowledgeProvider
ProfileUtilities.ProfileKnowledgeProvider.BindingResolution -
Field Summary
Fields inherited from class org.hl7.fhir.r5.context.BaseWorkerContext
binaries, clock, expParameters, logger, name, noTerminologyServer, oidCache, transforms, tsServer, txCache, txClient, txLog, userAgent, validationCache, version -
Method Summary
Modifier and TypeMethodDescriptionvoidcachePackage(IWorkerContext.PackageDetails packageDetails, List<IWorkerContext.PackageVersion> dependencies) Inform the cache about package dependencies.voidcachePackage(IWorkerContext.PackageVersion packageDetails, List<IWorkerContext.PackageVersion> dependencies) connectToTSServer(TerminologyClient client, String log) protected voidcopy(SimpleWorkerContext other) static String[]fetchRawProfile(String uri) <T extends Resource>
TfetchResource(Class<T> class_, String uri) Find an identified resource.voidGiven a structure definition, generate a snapshot (or regenerate it)voidgenerateSnapshot(StructureDefinition p, boolean logical) getAbbreviation(String name) returns the recommended tla for the type (from the structure definitions)getLinkFor(String corePath, String typeSimple) getLinkForProfile(StructureDefinition profile, String url) Get a parser to read/write instances.getParser(ParserType type) Get a parser to read/write instances.Get the versions of the definitions loaded in contextgetXVer()booleanhasCache()booleanhasLinkFor(String typeSimple) booleanhasPackage(String idAndver) booleanhasPackage(String id, String ver) booleanbooleanbooleanisDatatype(String typeSimple) booleanbooleanbooleanisResource(String t) voidloadBinariesFromFolder(String folder) voidloadBinariesFromFolder(org.hl7.fhir.utilities.npm.NpmPackage pi) voidloadFromFile(InputStream stream, String name, IWorkerContext.IContextResourceLoader loader) voidloadFromFile(InputStream stream, String name, IWorkerContext.IContextResourceLoader loader, SimpleWorkerContext.ILoadFilter filter) voidloadFromFile(String file, IWorkerContext.IContextResourceLoader loader) voidloadFromFolder(String folder) intloadFromPackage(org.hl7.fhir.utilities.npm.NpmPackage pi, IWorkerContext.IContextResourceLoader loader) Load relevant resources of the appropriate types (as specified by the loader) from the nominated package note that the package system uses lazy loading; the loader will be called later when the classes that use the context need the relevant resourceintloadFromPackage(org.hl7.fhir.utilities.npm.NpmPackage pi, IWorkerContext.IContextResourceLoader loader, String[] types) Load relevant resources of the appropriate types (as specified by the loader) from the nominated package note that the package system uses lazy loading; the loader will be called later when the classes that use the context need the relevant resource Deprecated - use the simpler method where the types come from the loader.intloadFromPackageAndDependencies(org.hl7.fhir.utilities.npm.NpmPackage pi, IWorkerContext.IContextResourceLoader loader, org.hl7.fhir.utilities.npm.BasePackageCacheManager pcm) Load relevant resources of the appropriate types (as specified by the loader) from the nominated package note that the package system uses lazy loading; the loader will be called later when the classes that use the context need the relevant resource This method also loads all the packages that the package depends on (recursively)intloadFromPackageAndDependenciesInt(org.hl7.fhir.utilities.npm.NpmPackage pi, IWorkerContext.IContextResourceLoader loader, org.hl7.fhir.utilities.npm.BasePackageCacheManager pcm, String path) intloadFromPackageInt(org.hl7.fhir.utilities.npm.NpmPackage pi, IWorkerContext.IContextResourceLoader loader, String... types) Get a JSON parserGet a validator that can check whether a resource is validGet an XML parserbooleanresolveBinding(StructureDefinition profile, String url, String path) resolveBinding(StructureDefinition profile, ElementDefinition.ElementDefinitionBindingComponent binding, String path) voidsetCanNoTS(boolean canNoTS) voidsetClock(org.hl7.fhir.utilities.TimeTracker tt) voidsetIgnoreProfileErrors(boolean ignoreProfileErrors) voidsetProgress(boolean progress) voidsetQuestionnaire(Questionnaire questionnaire) voidsetValidatorFactory(SimpleWorkerContext.IValidatorFactory validatorFactory) Methods inherited from class org.hl7.fhir.r5.context.BaseWorkerContext
allConformanceResources, allImplementationGuides, cacheResource, cacheResourceFromPackage, cacheVS, clearTS, clearTSCache, clock, constructParameters, constructParameters, constructParameters, constructParameters, constructValueSetCheckerSimple, constructValueSetCheckerSimple, constructValueSetExpanderSimple, copy, countAllCaches, dropResource, dropResource, expandVS, expandVS, expandVS, expandVS, expandVS, fetchCodeSystem, fetchCodeSystem, fetchResource, fetchResource, fetchResourceById, fetchResourceWithException, fetchResourceWithException, fetchResourceWithException, fetchResourceWithException, fetchResourceWithException, fetchTypeDefinition, findMapsForSource, finishLoading, fixOldSD, getBinaries, getCacheId, getClientRetryCount, getCodeSystemsUsed, getExpandCodesLimit, getExpansionParameters, getLinkForUrl, getLocator, getLogger, getName, getOverrideVersionNs, getPackageForUrl, getResourceNamesAsSet, getSearchParameter, getSpecUrl, getStructure, getStructures, getTransform, getTxCaps, getTxClient, getUcumService, getUserAgent, hasResource, hasResource, initTS, isAllowLoadingDuplicates, isCanRunWithoutTerminology, isNoTerminologyServer, isTlogging, listMaps, listStructures, listSupportedSystems, listTransforms, oid2Uri, processValidationResult, registerResourceFromPackage, reportStatus, seeMetadataResource, setAllowLoadingDuplicates, setCacheId, setCanRunWithoutTerminology, setClientRetryCount, setExpandCodesLimit, setExpansionProfile, setLocator, setLogger, setName, setNoTerminologyServer, setOverrideVersionNs, setTlogging, setTranslator, setTxCaps, setUcumService, setUserAgent, supportsSystem, tail, tlog, totalCount, translator, validateCode, validateCode, validateCode, validateCode, validateCode, validateCode, validateCodeBatch, validateOnServerMethods inherited from class org.hl7.fhir.utilities.i18n.I18nBase
formatMessage, getLocale, isWarnAboutMissingMessages, setLocale, setValidationMessageLanguage, setWarnAboutMissingMessagesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hl7.fhir.r5.context.IWorkerContext
allConformanceResources, cacheResource, cacheResourceFromPackage, clock, expandVS, expandVS, expandVS, expandVS, fetchCodeSystem, fetchCodeSystem, fetchResource, fetchResource, fetchResourceById, fetchResourceWithException, fetchTypeDefinition, findMapsForSource, formatMessage, getBinaries, getClientRetryCount, getCodeSystemsUsed, getExpansionParameters, getLinkForUrl, getLocale, getLogger, getOverrideVersionNs, getPackageForUrl, getResourceNamesAsSet, getSpecUrl, getStructures, getTransform, getUcumService, hasResource, isNoTerminologyServer, listTransforms, oid2Uri, setClientRetryCount, setExpansionProfile, setLocale, setLogger, setOverrideVersionNs, setUcumService, setValidationMessageLanguage, supportsSystem, translator, validateCode, validateCode, validateCode, validateCode, validateCode, validateCode, validateCodeBatchMethods inherited from interface org.hl7.fhir.r5.conformance.ProfileUtilities.ProfileKnowledgeProvider
getLinkForUrl
-
Method Details
-
copy
-
getLoadedPackages
-
connectToTSServer
-
loadFromFile
public void loadFromFile(InputStream stream, String name, IWorkerContext.IContextResourceLoader loader) throws org.hl7.fhir.exceptions.FHIRException - Throws:
org.hl7.fhir.exceptions.FHIRException
-
loadFromFile
public void loadFromFile(InputStream stream, String name, IWorkerContext.IContextResourceLoader loader, SimpleWorkerContext.ILoadFilter filter) throws org.hl7.fhir.exceptions.FHIRException - Throws:
org.hl7.fhir.exceptions.FHIRException
-
loadFromPackage
public int loadFromPackage(org.hl7.fhir.utilities.npm.NpmPackage pi, IWorkerContext.IContextResourceLoader loader) throws IOException, org.hl7.fhir.exceptions.FHIRException Description copied from interface:IWorkerContextLoad relevant resources of the appropriate types (as specified by the loader) from the nominated package note that the package system uses lazy loading; the loader will be called later when the classes that use the context need the relevant resource- Specified by:
loadFromPackagein interfaceIWorkerContext- Parameters:
pi- - the package to loadloader- - an implemenation of IContextResourceLoader that knows how to read the resources in the package (e.g. for the appropriate version).- Returns:
- the number of resources loaded
- Throws:
IOExceptionorg.hl7.fhir.exceptions.FHIRException
-
defaultTypesToLoad
-
loadFromPackage
public int loadFromPackage(org.hl7.fhir.utilities.npm.NpmPackage pi, IWorkerContext.IContextResourceLoader loader, String[] types) throws IOException, org.hl7.fhir.exceptions.FHIRException Description copied from interface:IWorkerContextLoad relevant resources of the appropriate types (as specified by the loader) from the nominated package note that the package system uses lazy loading; the loader will be called later when the classes that use the context need the relevant resource Deprecated - use the simpler method where the types come from the loader.- Specified by:
loadFromPackagein interfaceIWorkerContext- Parameters:
pi- - the package to loadloader- - an implemenation of IContextResourceLoader that knows how to read the resources in the package (e.g. for the appropriate version).types- - which types of resources to load- Returns:
- the number of resources loaded
- Throws:
IOExceptionorg.hl7.fhir.exceptions.FHIRException
-
loadFromPackageAndDependencies
public int loadFromPackageAndDependencies(org.hl7.fhir.utilities.npm.NpmPackage pi, IWorkerContext.IContextResourceLoader loader, org.hl7.fhir.utilities.npm.BasePackageCacheManager pcm) throws IOException, org.hl7.fhir.exceptions.FHIRException Description copied from interface:IWorkerContextLoad relevant resources of the appropriate types (as specified by the loader) from the nominated package note that the package system uses lazy loading; the loader will be called later when the classes that use the context need the relevant resource This method also loads all the packages that the package depends on (recursively)- Specified by:
loadFromPackageAndDependenciesin interfaceIWorkerContext- Parameters:
pi- - the package to loadloader- - an implemenation of IContextResourceLoader that knows how to read the resources in the package (e.g. for the appropriate version).pcm- - used to find and load additional dependencies- Returns:
- the number of resources loaded
- Throws:
IOExceptionorg.hl7.fhir.exceptions.FHIRException
-
loadFromPackageAndDependenciesInt
public int loadFromPackageAndDependenciesInt(org.hl7.fhir.utilities.npm.NpmPackage pi, IWorkerContext.IContextResourceLoader loader, org.hl7.fhir.utilities.npm.BasePackageCacheManager pcm, String path) throws IOException, org.hl7.fhir.exceptions.FHIRException - Throws:
IOExceptionorg.hl7.fhir.exceptions.FHIRException
-
loadFromPackageInt
public int loadFromPackageInt(org.hl7.fhir.utilities.npm.NpmPackage pi, IWorkerContext.IContextResourceLoader loader, String... types) throws IOException, org.hl7.fhir.exceptions.FHIRException - Throws:
IOExceptionorg.hl7.fhir.exceptions.FHIRException
-
loadFromFile
public void loadFromFile(String file, IWorkerContext.IContextResourceLoader loader) throws IOException, org.hl7.fhir.exceptions.FHIRException - Throws:
IOExceptionorg.hl7.fhir.exceptions.FHIRException
-
getParser
Description copied from interface:IWorkerContextGet a parser to read/write instances. Use the defined type (will be extended as further types are added, though the only currently anticipate type is RDF) XML/JSON - the standard renderers XHTML - render the narrative only (generate it if necessary)- Specified by:
getParserin interfaceIWorkerContext- Returns:
-
getParser
Description copied from interface:IWorkerContextGet a parser to read/write instances. Determine the type from the stated type. Supported value for type: - the recommended MIME types - variants of application/xml and application/json - _format values xml, json- Specified by:
getParserin interfaceIWorkerContext- Returns:
-
newJsonParser
Description copied from interface:IWorkerContextGet a JSON parser- Specified by:
newJsonParserin interfaceIWorkerContext- Returns:
-
newXmlParser
Description copied from interface:IWorkerContextGet an XML parser- Specified by:
newXmlParserin interfaceIWorkerContext- Returns:
-
newValidator
Description copied from interface:IWorkerContextGet a validator that can check whether a resource is valid- Specified by:
newValidatorin interfaceIWorkerContext- Returns:
- a prepared generator
- Throws:
org.hl7.fhir.exceptions.FHIRException
-
getResourceNames
- Specified by:
getResourceNamesin interfaceIWorkerContext- Returns:
- a list of the resource names defined for this version
-
getTypeNames
- Specified by:
getTypeNamesin interfaceIWorkerContext- Returns:
- a list of the resource and type names defined for this version
-
getAbbreviation
Description copied from interface:IWorkerContextreturns the recommended tla for the type (from the structure definitions)- Specified by:
getAbbreviationin interfaceIWorkerContext- Returns:
-
isDatatype
- Specified by:
isDatatypein interfaceProfileUtilities.ProfileKnowledgeProvider
-
isResource
- Specified by:
isResourcein interfaceProfileUtilities.ProfileKnowledgeProvider
-
hasLinkFor
- Specified by:
hasLinkForin interfaceProfileUtilities.ProfileKnowledgeProvider
-
getLinkFor
- Specified by:
getLinkForin interfaceProfileUtilities.ProfileKnowledgeProvider
-
resolveBinding
public ProfileUtilities.ProfileKnowledgeProvider.BindingResolution resolveBinding(StructureDefinition profile, ElementDefinition.ElementDefinitionBindingComponent binding, String path) - Specified by:
resolveBindingin interfaceProfileUtilities.ProfileKnowledgeProvider
-
resolveBinding
public ProfileUtilities.ProfileKnowledgeProvider.BindingResolution resolveBinding(StructureDefinition profile, String url, String path) - Specified by:
resolveBindingin interfaceProfileUtilities.ProfileKnowledgeProvider
-
getLinkForProfile
- Specified by:
getLinkForProfilein interfaceProfileUtilities.ProfileKnowledgeProvider
-
getQuestionnaire
-
setQuestionnaire
-
allStructures
- Specified by:
allStructuresin interfaceIWorkerContext- Returns:
- a list of all structure definitions, with snapshots generated (if possible)
-
loadBinariesFromFolder
- Throws:
IOException
-
loadBinariesFromFolder
- Throws:
IOException
-
loadFromFolder
- Throws:
IOException
-
prependLinks
- Specified by:
prependLinksin interfaceProfileUtilities.ProfileKnowledgeProvider
-
hasCache
- Specified by:
hasCachein interfaceIWorkerContext- Returns:
- true if the contxt has a terminology caching service internally
-
getVersion
Description copied from interface:IWorkerContextGet the versions of the definitions loaded in context- Specified by:
getVersionin interfaceIWorkerContext- Returns:
-
findTransformsforSource
-
getValidatorFactory
-
setValidatorFactory
-
fetchResource
Description copied from interface:IWorkerContextFind an identified resource. The most common use of this is to access the the standard conformance resources that are part of the standard - structure definitions, value sets, concept maps, etc. Also, the narrative generator uses this, and may access any kind of resource The URI is called speculatively for things that might exist, so not finding a matching resouce, return null, not an error The URI can have one of 3 formats: - a full URL e.g. http://acme.org/fhir/ValueSet/[id] - a relative URL e.g. ValueSet/[id] - a logical id e.g. [id] It's an error if the second form doesn't agree with class_. It's an error if class_ is null for the last form- Specified by:
fetchResourcein interfaceIWorkerContext- Overrides:
fetchResourcein classBaseWorkerContext- Returns:
-
fetchRawProfile
- Specified by:
fetchRawProfilein interfaceIWorkerContext
-
generateSnapshot
Description copied from interface:IWorkerContextGiven a structure definition, generate a snapshot (or regenerate it)- Specified by:
generateSnapshotin interfaceIWorkerContext- Throws:
org.hl7.fhir.exceptions.DefinitionExceptionorg.hl7.fhir.exceptions.FHIRException
-
generateSnapshot
public void generateSnapshot(StructureDefinition p, boolean logical) throws org.hl7.fhir.exceptions.FHIRException - Specified by:
generateSnapshotin interfaceIWorkerContext- Throws:
org.hl7.fhir.exceptions.FHIRException
-
isIgnoreProfileErrors
-
setIgnoreProfileErrors
-
listMapUrls
-
isProgress
-
setProgress
-
setClock
-
isCanNoTS
-
setCanNoTS
-
getXVer
-
cachePackage
public void cachePackage(IWorkerContext.PackageVersion packageDetails, List<IWorkerContext.PackageVersion> dependencies) -
hasPackage
- Specified by:
hasPackagein interfaceIWorkerContext
-
hasPackage
-
cachePackage
public void cachePackage(IWorkerContext.PackageDetails packageDetails, List<IWorkerContext.PackageVersion> dependencies) Description copied from interface:IWorkerContextInform the cache about package dependencies. This can be used to help resolve references Note that the cache doesn't load dependencies- Specified by:
cachePackagein interfaceIWorkerContext
-
hasPackage
- Specified by:
hasPackagein interfaceIWorkerContext
-
getPackage
- Specified by:
getPackagein interfaceIWorkerContext
-