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:
IWorkerContext
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static interface
static class
static class
Nested classes/interfaces inherited from class org.hl7.fhir.r5.context.BaseWorkerContext
BaseWorkerContext.MetadataResourceVersionComparator<T extends CanonicalResource>, BaseWorkerContext.ResourceProxy
Nested classes/interfaces inherited from interface org.hl7.fhir.r5.context.IWorkerContext
IWorkerContext.ILoggingService, IWorkerContext.OIDDefinition, IWorkerContext.OIDDefinitionComparer, IWorkerContext.OIDSummary
-
Field Summary
Fields inherited from class org.hl7.fhir.r5.context.BaseWorkerContext
binaries, canRunWithoutTerminology, clock, expParameters, logger, name, noTerminologyServer, oidCacheManual, oidSources, packageTracker, terminologyClientManager, transforms, txCache, txLog, userAgent, validationCache, version
Fields inherited from class org.hl7.fhir.utilities.i18n.I18nBase
KEY_DELIMITER, locale, PLURAL_SUFFIX
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
cachePackage
(PackageInformation packageInfo) Inform the cache about package dependencies.void
connectToTSServer
(TerminologyClientManager.ITerminologyClientFactory factory, String address, String software, String log, boolean useEcosystem) void
connectToTSServer
(TerminologyClientManager.ITerminologyClientFactory factory, ITerminologyClient client, boolean useEcosystem) protected void
copy
(SimpleWorkerContext other) <T extends Resource>
TfetchResource
(Class<T> class_, String uri) Find an identified resource.<T extends Resource>
TfetchResource
(Class<T> class_, String uri, Resource source) has the same functionality as fetchResource, but passes in information about the source of the reference (this may affect resolution of version)<T extends Resource>
TfetchResourceRaw
(Class<T> class_, String uri) getPackage
(String id, String ver) Get the version of the base definitions loaded in context This *does not* have to be 5.0 (R5) - the context can load other versions Note that more than one version might be loaded at once, but one version is always the default / mastergetXVer()
boolean
hasPackage
(String idAndver) boolean
hasPackage
(String id, String ver) boolean
hasPackage
(PackageInformation pack) boolean
boolean
boolean
void
loadBinariesFromFolder
(String folder) void
loadBinariesFromFolder
(org.hl7.fhir.utilities.npm.NpmPackage pi) void
loadFromFile
(InputStream stream, String name, IContextResourceLoader loader) void
loadFromFile
(InputStream stream, String name, IContextResourceLoader loader, SimpleWorkerContext.ILoadFilter filter) void
loadFromFile
(String file, IContextResourceLoader loader) void
loadFromFolder
(String folder) int
loadFromPackage
(org.hl7.fhir.utilities.npm.NpmPackage pi, 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 resourceint
loadFromPackage
(org.hl7.fhir.utilities.npm.NpmPackage pi, IContextResourceLoader loader, List<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.int
loadFromPackageAndDependencies
(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)int
loadFromPackageAndDependenciesInt
(org.hl7.fhir.utilities.npm.NpmPackage pi, IContextResourceLoader loader, org.hl7.fhir.utilities.npm.BasePackageCacheManager pcm, String path) int
loadFromPackageInt
(org.hl7.fhir.utilities.npm.NpmPackage pi, IContextResourceLoader loader, List<String> types) Get a validator that can check whether a resource is validvoid
setAllowLazyLoading
(boolean allowLazyLoading) void
setCanNoTS
(boolean canNoTS) void
setClock
(org.hl7.fhir.utilities.TimeTracker tt) void
setProgress
(boolean progress) void
setQuestionnaire
(Questionnaire questionnaire) void
setValidatorFactory
(SimpleWorkerContext.IValidatorFactory validatorFactory) Methods inherited from class org.hl7.fhir.r5.context.BaseWorkerContext
addServerValidationParameters, allImplementationGuides, cacheResource, cacheResourceFromPackage, cacheVS, clearTSCache, clock, constructParameters, constructParameters, constructParameters, constructParameters, constructParameters, constructValueSetCheckerSimple, constructValueSetCheckerSimple, constructValueSetExpanderSimple, copy, countAllCaches, dropResource, dropResource, expandVS, expandVS, expandVS, expandVS, expandVS, expandVS, fetchCodeSystem, fetchCodeSystem, fetchCodeSystem, fetchCodeSystem, fetchResource, fetchResource, fetchResource, fetchResourceById, fetchResourceById, fetchResourcesByType, fetchResourcesByType, fetchResourcesByUrl, fetchResourceWithException, fetchResourceWithException, fetchResourceWithException, fetchResourceWithExceptionByVersion, fetchResourceWithExceptionByVersion, fetchSupplementedCodeSystem, fetchSupplementedCodeSystem, fetchSupplementedCodeSystem, fetchSupplementedCodeSystem, fetchTypeDefinition, fetchTypeDefinition, fetchTypeDefinitions, fetchTypeDefinitions, findTxResource, findTxResource, findTxResource, finishLoading, fixOldSD, getBinaryForKey, getBinaryKeysAsSet, getCacheId, getClientRetryCount, getCodeSystemsUsed, getExpandCodesLimit, getExpansionParameters, getLinkForUrl, getLocator, getLogger, getName, getNSUrlMap, getPackageForUrl, getPackageTracker, getProfiledElementBuilder, getResourceNames, getResourceNamesAsSet, getResourceNamesAsSet, getSearchParameter, getStructure, getTxClientManager, getUcumService, getUserAgent, hasBinaryKey, hasResource, hasResource, hasResource, hasResource, hasResource, hasResourceVersion, hasResourceVersion, hasResourceVersion, hasResourceVersion, initTxCache, initTxCache, isAllowLoadingDuplicates, isCachingAllowed, isCanRunWithoutTerminology, isDataType, isForPublication, isNoTerminologyServer, isPrimitiveType, isServerSideSystem, isTlogging, listMaps, listStructures, listSupportedSystems, processSubsumesResult, processValidationResult, registerResourceFromPackage, reportStatus, seeMetadataResource, setAllowLoadingDuplicates, setCachingAllowed, setCanRunWithoutTerminology, setClientRetryCount, setExpandCodesLimit, setExpansionParameters, setForPublication, setLocator, setLogger, setName, setNoTerminologyServer, setPackageTracker, setTlogging, setUcumService, setUserAgent, subsumes, supportsSystem, supportsSystem, tail, totalCount, txLog, unload, urlsForOid, urlsForOid, validateCode, validateCode, validateCode, validateCode, validateCode, validateCode, validateCode, validateCode, validateCodeBatch, validateCodeBatchByRef, validateOnServer
Methods inherited from class org.hl7.fhir.utilities.i18n.I18nBase
formatMessage, formatMessagePlural, getLocale, getMessagesSourceFileName, getPluralKey, getPluralKeys, getPluralSuffixes, getRootKeyFromPlural, isWarnAboutMissingMessages, messageKeyExistsForLocale, setLocale, setPluralRules, setValidationMessageLanguage, setWarnAboutMissingMessages, typeOfString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.hl7.fhir.r5.context.IWorkerContext
cacheResource, cacheResourceFromPackage, clock, expandVS, expandVS, expandVS, expandVS, fetchCodeSystem, fetchCodeSystem, fetchCodeSystem, fetchCodeSystem, fetchResource, fetchResource, fetchResource, fetchResourceById, fetchResourceById, fetchResourcesByType, fetchResourcesByType, fetchResourcesByUrl, fetchResourceWithException, fetchResourceWithException, fetchSupplementedCodeSystem, fetchSupplementedCodeSystem, fetchSupplementedCodeSystem, fetchSupplementedCodeSystem, fetchTypeDefinition, fetchTypeDefinition, fetchTypeDefinitions, fetchTypeDefinitions, findTxResource, findTxResource, findTxResource, formatMessage, formatMessagePlural, getBinaryForKey, getBinaryKeysAsSet, getClientRetryCount, getCodeSystemsUsed, getExpansionParameters, getLocale, getLogger, getNSUrlMap, getPackageForUrl, getPackageTracker, getProfiledElementBuilder, getResourceNames, getResourceNamesAsSet, getResourceNamesAsSet, getUcumService, hasBinaryKey, hasResource, hasResource, hasResource, isDataType, isForPublication, isNoTerminologyServer, isPrimitiveType, isServerSideSystem, setClientRetryCount, setExpansionParameters, setForPublication, setLocale, setLogger, setPackageTracker, setUcumService, setValidationMessageLanguage, subsumes, supportsSystem, supportsSystem, urlsForOid, validateCode, validateCode, validateCode, validateCode, validateCode, validateCode, validateCodeBatch, validateCodeBatchByRef
-
Constructor Details
-
SimpleWorkerContext
public SimpleWorkerContext(SimpleWorkerContext other) throws IOException, org.hl7.fhir.exceptions.FHIRException - Throws:
IOException
org.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 void 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 pi, IContextResourceLoader loader) throws IOException, org.hl7.fhir.exceptions.FHIRException Description copied from interface:IWorkerContext
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- Specified by:
loadFromPackage
in 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:
IOException
org.hl7.fhir.exceptions.FHIRException
-
defaultTypesToLoad
-
loadFromPackage
public int loadFromPackage(org.hl7.fhir.utilities.npm.NpmPackage pi, IContextResourceLoader loader, List<String> types) throws IOException, org.hl7.fhir.exceptions.FHIRException Description copied from interface:IWorkerContext
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.- Specified by:
loadFromPackage
in 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:
IOException
org.hl7.fhir.exceptions.FHIRException
-
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:IWorkerContext
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)- Specified by:
loadFromPackageAndDependencies
in 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:
IOException
org.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:
IOException
org.hl7.fhir.exceptions.FHIRException
-
loadFromPackageInt
public int loadFromPackageInt(org.hl7.fhir.utilities.npm.NpmPackage pi, IContextResourceLoader loader, List<String> types) throws IOException, org.hl7.fhir.exceptions.FHIRException - Throws:
IOException
org.hl7.fhir.exceptions.FHIRException
-
loadFromFile
public void loadFromFile(String file, IContextResourceLoader loader) throws IOException, org.hl7.fhir.exceptions.FHIRException - Throws:
IOException
org.hl7.fhir.exceptions.FHIRException
-
newValidator
Description copied from interface:IWorkerContext
Get a validator that can check whether a resource is valid- Specified by:
newValidator
in interfaceIWorkerContext
- Returns:
- a prepared generator
- Throws:
org.hl7.fhir.exceptions.FHIRException
-
getResourceNames
- Specified by:
getResourceNames
in interfaceIWorkerContext
- Returns:
- a list of the resource names defined for this version
-
getQuestionnaire
-
setQuestionnaire
-
loadBinariesFromFolder
- Throws:
IOException
-
loadBinariesFromFolder
- Throws:
IOException
-
loadFromFolder
- Throws:
IOException
-
getVersion
Description copied from interface:IWorkerContext
Get the version of the base definitions loaded in context This *does not* have to be 5.0 (R5) - the context can load other versions Note that more than one version might be loaded at once, but one version is always the default / master- Specified by:
getVersion
in interfaceIWorkerContext
- Returns:
-
findTransformsforSource
-
getValidatorFactory
-
setValidatorFactory
-
fetchResource
Description copied from interface:IWorkerContext
Find 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 resource, 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 class can be Resource, DomainResource or CanonicalResource, which means resource of all kinds- Specified by:
fetchResource
in interfaceIWorkerContext
- Overrides:
fetchResource
in classBaseWorkerContext
- Returns:
-
fetchResourceRaw
- Specified by:
fetchResourceRaw
in interfaceIWorkerContext
-
fetchResource
Description copied from interface:IWorkerContext
has the same functionality as fetchResource, but passes in information about the source of the reference (this may affect resolution of version)- Specified by:
fetchResource
in interfaceIWorkerContext
- Overrides:
fetchResource
in classBaseWorkerContext
- Type Parameters:
T
-- Parameters:
class_
-uri
-- Returns:
-
listMapUrls
-
isProgress
-
setProgress
-
setClock
-
isCanNoTS
-
setCanNoTS
-
getXVer
-
cachePackage
Description copied from interface:IWorkerContext
Inform the cache about package dependencies. This can be used to help resolve references Note that the cache doesn't load dependencies- Specified by:
cachePackage
in interfaceIWorkerContext
- Parameters:
packageInfo
-
-
hasPackage
- Specified by:
hasPackage
in interfaceIWorkerContext
-
hasPackage
-
hasPackage
- Specified by:
hasPackage
in interfaceIWorkerContext
-
getPackage
- Specified by:
getPackage
in interfaceIWorkerContext
-
isAllowLazyLoading
-
setAllowLazyLoading
-
loadedPackageSummary
-
getSpecUrl
- Specified by:
getSpecUrl
in interfaceIWorkerContext
-