
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:
IOIDServices,IWorkerContext,IWorkerContextManager
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interfaceclassstatic interfacestatic classstatic classNested classes/interfaces inherited from class org.hl7.fhir.r5.context.BaseWorkerContext
BaseWorkerContext.BytesFromFileProvider, BaseWorkerContext.BytesFromPackageProvider, BaseWorkerContext.BytesProvider, BaseWorkerContext.IByteProvider, BaseWorkerContext.MetadataResourceVersionComparator<T extends CanonicalResource>, BaseWorkerContext.ResourceProxyNested classes/interfaces inherited from interface org.hl7.fhir.r5.context.IOIDServices
IOIDServices.OIDDefinition, IOIDServices.OIDDefinitionComparer, IOIDServices.OIDSummaryNested classes/interfaces inherited from interface org.hl7.fhir.r5.context.IWorkerContext
IWorkerContext.SystemSupportInformationNested classes/interfaces inherited from interface org.hl7.fhir.r5.context.IWorkerContextManager
IWorkerContextManager.ICanonicalResourceLocator, IWorkerContextManager.IPackageLoadingTracker -
Field Summary
Fields inherited from class org.hl7.fhir.r5.context.BaseWorkerContext
binaries, canRunWithoutTerminology, clock, cutils, expansionParameters, logger, name, noTerminologyServer, oidCacheManual, oidSources, packageTracker, terminologyClientManager, transforms, txCache, txLog, userAgent, validationCache, versionFields inherited from class org.hl7.fhir.utilities.i18n.I18nBase
KEY_DELIMITER, uncontainedKeys -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcachePackage(PackageInformation packageInfo) Inform the cache about package dependencies.voidconnectToTSServer(TerminologyClientManager.ITerminologyClientFactory factory, String address, String software, String log, boolean useEcosystem) voidconnectToTSServer(TerminologyClientManager.ITerminologyClientFactory factory, ITerminologyClient client, boolean useEcosystem) protected voidcopy(SimpleWorkerContext other) <T extends Resource>
TfetchResource(Class<T> class_, String uri) Fetch (load if necessary) an identified resource.<T extends Resource>
TfetchResource(Class<T> class_, String uri, String version, Resource source) Fetch (load if necessary) an identified resource.<T extends Resource>
TfetchResourceRaw(Class<T> class_, String uri) Find an identified resource, but do not do any processing on it.getPackage(String id, String ver) The version loaded *does not* have to be 5.0 (R5) - the context can load other versions, though the definitions need to be converted to R5 first Note that more than one version might be loaded at once, but one version is always the default / mastergetXVer()booleanhasPackage(String idAndver) booleanhasPackage(String id, String ver) booleanhasPackage(PackageInformation pack) booleanbooleanbooleanvoidloadBinariesFromFolder(String folder) voidloadBinariesFromFolder(org.hl7.fhir.utilities.npm.NpmPackage pi) voidloadFromFile(InputStream stream, String name, IContextResourceLoader loader) loadFromFile(InputStream stream, String name, IContextResourceLoader loader, SimpleWorkerContext.ILoadFilter filter) voidloadFromFile(String file, IContextResourceLoader loader) voidloadFromFolder(String folder) intloadFromPackage(org.hl7.fhir.utilities.npm.NpmPackage npm, IContextResourceLoader loader) Load relevant resources of the appropriate types (as specified by the loader) from the nominated package note that the package system may use lazy loading; the loader will be called later when the classes that use the context need the relevant resourceintloadFromPackageAndDependencies(org.hl7.fhir.utilities.npm.NpmPackage pi, 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, IContextResourceLoader loader, org.hl7.fhir.utilities.npm.BasePackageCacheManager pcm, String path) intloadFromPackageInt(org.hl7.fhir.utilities.npm.NpmPackage pi, IContextResourceLoader loader, Set<String> types) intloadPackage(String idAndVer) Load relevant resources of the appropriate types (as specified by the loader) from the nominated package note that the package system may use lazy loading; the loader will be called later when the classes that use the context need the relevant resourceintloadPackage(org.hl7.fhir.utilities.npm.NpmPackage npm) Load relevant resources of the appropriate types (as specified by the loader) from the nominated package note that the package system may use lazy loading; the loader will be called later when the classes that use the context need the relevant resourceGet a validator that can check whether a resource is valid this is deprecated because there's lots of properties to set on the validator; the functions using this need to be changed to use the validator directlyorg.hl7.fhir.utilities.npm.IPackageCacheManagervoidsetAllowLazyLoading(boolean allowLazyLoading) voidsetCanNoTS(boolean canNoTS) voidsetClock(org.hl7.fhir.utilities.TimeTracker tt) voidsetPackageManager(org.hl7.fhir.utilities.npm.IPackageCacheManager packageCacheManager) voidsetProgress(boolean progress) voidsetQuestionnaire(Questionnaire questionnaire) voidsetValidatorFactory(SimpleWorkerContext.IValidatorFactory validatorFactory) voidMethods inherited from class org.hl7.fhir.r5.context.BaseWorkerContext
addDependentCodeSystem, addServerValidationParameters, addServerValidationParameters, allImplementationGuides, cacheResource, cacheResourceFromPackage, cacheVS, clearTSCache, clock, constructParameters, constructParameters, constructParameters, constructParameters, constructValueSetCheckerSimple, constructValueSetCheckerSimple, constructValueSetExpanderSimple, copy, countAllCaches, dropResource, dropResource, expandVS, expandVS, expandVS, expandVS, expandVS, expandVS, expandVS, expandVS, fetchCodeSystem, fetchCodeSystem, fetchCodeSystem, fetchResource, fetchResourceById, fetchResourceById, fetchResourceByVersionWithException, fetchResourcesByType, fetchResourcesByType, fetchResourceVersions, fetchResourceVersionsByTypeAndUrl, fetchResourceWithException, fetchResourceWithException, fetchResourceWithException, fetchResourceWithExceptionByVersion, fetchResourceWithExceptionByVersion, fetchSupplementedCodeSystem, fetchSupplementedCodeSystem, fetchTypeDefinition, fetchTypeDefinition, fetchTypeDefinitions, findTxResource, findTxResource, findTxResource, finishLoading, fixOldSD, getBinaryForKey, getBinaryKeysAsSet, getCacheId, getClientRetryCount, getCodeSystemsUsed, getCutils, getExpandCodesLimit, getExpansionParameters, getLinkForUrl, getLocator, getLogger, getManager, getName, getNSUrlMap, getPackageForUrl, getPackageTracker, getProfiledElementBuilder, getResourceNames, getResourceNamesAsSet, getResourceNamesAsSet, getSearchParameter, getStructure, getSuppressedMappings, getTxClientManager, getTxSupportInfo, getUcumService, getUserAgent, hasBinaryKey, hasResource, hasResource, hasResource, hasResource, hasResourceVersion, hasResourceVersion, hasResourceVersion, initTxCache, initTxCache, isAllowedToIterateTerminologyResources, isCachingAllowed, isCanRunWithoutTerminology, isDataType, isForPublication, isNoTerminologyServer, isPrimitiveType, isTlogging, listCodeSystems, listMaps, listStructures, listSupportedSystems, listValueSets, oidServices, processSubsumesResult, processValidationResult, registerResourceFromPackage, reportStatus, seeMetadataResource, setAllowedToIterateTerminologyResources, setCachingAllowed, setCanRunWithoutTerminology, setClientRetryCount, setExpandCodesLimit, setExpansionParameters, setForPublication, setLocale, setLocator, setLogger, setName, setNoTerminologyServer, setPackageTracker, setSuppressedMappings, setTlogging, setUcumService, setUserAgent, subsumes, tail, totalCount, txCacheReport, txLog, unload, urlsForOid, urlsForOid, validateCode, validateCode, validateCode, validateCode, validateCode, validateCode, validateCode, validateCode, validateCodeBatch, validateOnServer, validateOnServer2, validateTxResourceMethods inherited from class org.hl7.fhir.utilities.i18n.I18nBase
formatMessage, formatMessagePlural, getLocale, getMessages, getMessagesSourceFileName, getPluralKey, getPluralKeys, getPluralRules, getPluralSuffixes, getRootKeyFromPlural, isWarnAboutMissingMessages, logUncontainedMessage, messageKeyExistsForLocale, setValidationMessageLanguage, setWarnAboutMissingMessages, typeOfStringMethods 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
clock, expandVS, expandVS, expandVS, expandVS, expandVS, fetchCodeSystem, fetchCodeSystem, fetchResourceById, fetchResourcesByType, fetchResourceVersions, fetchResourceWithException, fetchResourceWithException, fetchSupplementedCodeSystem, fetchSupplementedCodeSystem, fetchTypeDefinition, fetchTypeDefinitions, findTxResource, findTxResource, formatMessage, formatMessagePlural, getBinaryForKey, getBinaryKeysAsSet, getClientRetryCount, getCodeSystemsUsed, getExpansionParameters, getLocale, getLogger, getManager, getNSUrlMap, getPackageForUrl, getPackageTracker, getProfiledElementBuilder, getResourceNamesAsSet, getTxSupportInfo, getUcumService, hasBinaryKey, hasResource, hasResource, isDataType, isForPublication, isNoTerminologyServer, isPrimitiveType, oidServices, setClientRetryCount, setForPublication, setPackageTracker, subsumes, validateCode, validateCode, validateCode, validateCode, validateCode, validateCode, validateCodeBatch, validateTxResource
-
Constructor Details
-
SimpleWorkerContext
public SimpleWorkerContext(SimpleWorkerContext other) throws IOException, org.hl7.fhir.exceptions.FHIRException - Throws:
IOExceptionorg.hl7.fhir.exceptions.FHIRException
-
-
Method Details
-
copy
-
getLoadedPackages
-
connectToTSServer
public void connectToTSServer(TerminologyClientManager.ITerminologyClientFactory factory, ITerminologyClient client, boolean useEcosystem) -
connectToTSServer
public void connectToTSServer(TerminologyClientManager.ITerminologyClientFactory factory, String address, String software, String log, boolean useEcosystem) -
loadFromFile
public void loadFromFile(InputStream stream, String name, IContextResourceLoader loader) throws org.hl7.fhir.exceptions.FHIRException - Throws:
org.hl7.fhir.exceptions.FHIRException
-
loadFromFile
public Resource loadFromFile(InputStream stream, String name, 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 npm, IContextResourceLoader loader) throws IOException, org.hl7.fhir.exceptions.FHIRException Description copied from interface:IWorkerContextManagerLoad relevant resources of the appropriate types (as specified by the loader) from the nominated package note that the package system may use lazy loading; the loader will be called later when the classes that use the context need the relevant resource- Specified by:
loadFromPackagein interfaceIWorkerContextManager- Parameters:
npm- - 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
-
loadPackage
public int loadPackage(org.hl7.fhir.utilities.npm.NpmPackage npm) throws IOException, org.hl7.fhir.exceptions.FHIRException Description copied from interface:IWorkerContextManagerLoad relevant resources of the appropriate types (as specified by the loader) from the nominated package note that the package system may use lazy loading; the loader will be called later when the classes that use the context need the relevant resource- Specified by:
loadPackagein interfaceIWorkerContextManager- Parameters:
npm- - the package to load- Returns:
- the number of resources loaded
- Throws:
IOExceptionorg.hl7.fhir.exceptions.FHIRException
-
loadPackage
Description copied from interface:IWorkerContextManagerLoad relevant resources of the appropriate types (as specified by the loader) from the nominated package note that the package system may use lazy loading; the loader will be called later when the classes that use the context need the relevant resource- Specified by:
loadPackagein interfaceIWorkerContextManager- Parameters:
idAndVer- - the package to load- Returns:
- the number of resources loaded
- Throws:
IOExceptionorg.hl7.fhir.exceptions.FHIRException
-
defaultTypesToLoad
-
loadFromPackageAndDependencies
public int loadFromPackageAndDependencies(org.hl7.fhir.utilities.npm.NpmPackage pi, IContextResourceLoader loader, org.hl7.fhir.utilities.npm.BasePackageCacheManager pcm) throws IOException, org.hl7.fhir.exceptions.FHIRException Description copied from interface:IWorkerContextManagerLoad 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 interfaceIWorkerContextManager- 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, 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, IContextResourceLoader loader, Set<String> types) throws IOException, org.hl7.fhir.exceptions.FHIRException - Throws:
IOExceptionorg.hl7.fhir.exceptions.FHIRException
-
loadFromFile
public void loadFromFile(String file, IContextResourceLoader loader) throws IOException, org.hl7.fhir.exceptions.FHIRException - Throws:
IOExceptionorg.hl7.fhir.exceptions.FHIRException
-
newValidator
Description copied from interface:IWorkerContextGet a validator that can check whether a resource is valid this is deprecated because there's lots of properties to set on the validator; the functions using this need to be changed to use the validator directly- 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 (sorted alphabetically)
-
getQuestionnaire
-
setQuestionnaire
-
loadBinariesFromFolder
- Throws:
IOException
-
loadBinariesFromFolder
- Throws:
IOException
-
loadFromFolder
- Throws:
IOException
-
getVersion
Description copied from interface:IWorkerContextThe version loaded *does not* have to be 5.0 (R5) - the context can load other versions, though the definitions need to be converted to R5 first Note that more than one version might be loaded at once, but one version is always the default / master- Specified by:
getVersionin interfaceIWorkerContext- Returns:
- the version of the base definitions loaded in context
-
findTransformsforSource
-
getValidatorFactory
-
setValidatorFactory
-
fetchResource
Description copied from interface:IWorkerContextFetch (load if necessary) an identified resource. The most common use of this is to access the standard conformance resources that are part of the standard - structure definitions, value sets, concept maps, etc. 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 class can be Resource, DomainResource or CanonicalResource, which means resource of all kinds- Specified by:
fetchResourcein interfaceIWorkerContext- Overrides:
fetchResourcein classBaseWorkerContext- Parameters:
class_- the type of resourceuri- the URL of the resource, optionally with a |version suffix- Returns:
- the resource if known (or null)
-
fetchResourceRaw
Description copied from interface:IWorkerContextFind an identified resource, but do not do any processing on it. The usual processing that happens is ensuring that the snapshot is generated before returning it; This routine is used in the snapshot generation routines to avoid circular dependency challenges generating snapshots. 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 class can be Resource, DomainResource or CanonicalResource, which means resource of all kinds- Specified by:
fetchResourceRawin interfaceIWorkerContext- Parameters:
class_- the type of resourceuri- the URL of the resource, optionally with a |version suffix- Returns:
- the resource if known (or an exception will be thrown)
-
fetchResource
public <T extends Resource> T fetchResource(Class<T> class_, String uri, String version, Resource source) Description copied from interface:IWorkerContextFetch (load if necessary) an identified resource. The most common use of this is to access the standard conformance resources that are part of the standard - structure definitions, value sets, concept maps, etc. 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 class can be Resource, DomainResource or CanonicalResource, which means resource of all kinds- Specified by:
fetchResourcein interfaceIWorkerContext- Overrides:
fetchResourcein classBaseWorkerContext- Parameters:
class_- the type of resourceuri- the URL of the resource, optionally with a |version suffixversion- the version. Don't provide both a version and a |version suffixsource- where the reference was found (if the reference is in a resource)- Returns:
- if the resource is known
-
listMapUrls
-
isProgress
-
setProgress
-
setClock
-
isCanNoTS
-
setCanNoTS
-
getXVer
-
packageManager
- Specified by:
packageManagerin interfaceIWorkerContextManager
-
setPackageManager
- Specified by:
setPackageManagerin interfaceIWorkerContextManager
-
cachePackage
Description copied from interface:IWorkerContextManagerInform the cache about package dependencies. This can be used to help resolve references Note that the cache doesn't load dependencies- Specified by:
cachePackagein interfaceIWorkerContextManager- Parameters:
packageInfo-
-
hasPackage
- Specified by:
hasPackagein interfaceIWorkerContext- Returns:
- true if the nominated package has been loaded
-
hasPackage
-
hasPackage
- Specified by:
hasPackagein interfaceIWorkerContext- Returns:
- true if the nominated package has been loaded (by id and version)
-
getPackage
- Specified by:
getPackagein interfaceIWorkerContext- Returns:
- package information for nominated package
-
isAllowLazyLoading
-
setAllowLazyLoading
-
loadedPackageSummary
-
getSpecUrl
- Specified by:
getSpecUrlin interfaceIWorkerContext- Returns:
- The URL that points to the specification for the version loaded
-
setXVerManager
-