Package org.hl7.fhir.dstu2.utils
Class SimpleWorkerContext
java.lang.Object
org.hl7.fhir.utilities.i18n.I18nBase
org.hl7.fhir.dstu2.utils.BaseWorkerContext
org.hl7.fhir.dstu2.utils.SimpleWorkerContext
- All Implemented Interfaces:
IWorkerContext,ProfileUtilities.ProfileKnowledgeProvider
public class SimpleWorkerContext
extends BaseWorkerContext
implements IWorkerContext, ProfileUtilities.ProfileKnowledgeProvider
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.hl7.fhir.dstu2.utils.IWorkerContext
IWorkerContext.ValidationResultNested classes/interfaces inherited from interface org.hl7.fhir.dstu2.utils.ProfileUtilities.ProfileKnowledgeProvider
ProfileUtilities.ProfileKnowledgeProvider.BindingResolution -
Field Summary
Fields inherited from class org.hl7.fhir.dstu2.utils.BaseWorkerContext
cacheValidation, codeSystems, expansionCache, maps, txServer, validationCache, valueSets -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconnectToTSServer(String url, String userAgent)<T extends Resource>
TfetchResource(Class<T> class_, String uri)Find an identified resource.static SimpleWorkerContextstatic SimpleWorkerContextfromDefinitions(Map<String,byte[]> source)static SimpleWorkerContextLoad the working context from the validation packgetAbbreviation(String name)returns the recommended tla for the typegetLinkFor(String typeSimple)getLinkForProfile(StructureDefinition profile, String url)getNarrativeGenerator(String prefix, String basePath)Get a generator that can generate narrative for the instanceGet a parser to read/write instances.getParser(ParserType type)Get a parser to read/write instances.booleanhasLinkFor(String typeSimple)<T extends Resource>
booleanhasResource(Class<T> class_, String uri)find whether a resource is available.booleanisDatatype(String typeSimple)booleanisResource(String t)Get a JSON parserGet a validator that can check whether a resource is validGet an XML parservoidseeResource(String url, Resource r)voidsetCache(ValueSetExpansionCache cache)intMethods inherited from class org.hl7.fhir.dstu2.utils.BaseWorkerContext
expandVS, expandVS, fetchCodeSystem, fetchTypeDefinition, findMapsForSource, supportsSystem, validateCode, validateCode, validateCode, validateCode, validateCodeMethods 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.dstu2.utils.IWorkerContext
expandVS, expandVS, fetchCodeSystem, fetchTypeDefinition, findMapsForSource, formatMessage, getLocale, setLocale, setValidationMessageLanguage, supportsSystem, validateCode, validateCode, validateCode, validateCode, validateCode
-
Constructor Details
-
SimpleWorkerContext
public SimpleWorkerContext()
-
-
Method Details
-
fromPack
public static SimpleWorkerContext fromPack(String path) throws FileNotFoundException, IOException, org.hl7.fhir.exceptions.FHIRExceptionLoad the working context from the validation pack- Parameters:
path- filename of the validation pack- Returns:
- Throws:
IOExceptionFileNotFoundExceptionorg.hl7.fhir.exceptions.FHIRExceptionException
-
fromClassPath
public static SimpleWorkerContext fromClassPath() throws IOException, org.hl7.fhir.exceptions.FHIRException- Throws:
IOExceptionorg.hl7.fhir.exceptions.FHIRException
-
fromDefinitions
public static SimpleWorkerContext fromDefinitions(Map<String,byte[]> source) throws IOException, org.hl7.fhir.exceptions.FHIRException- Throws:
IOExceptionorg.hl7.fhir.exceptions.FHIRException
-
connectToTSServer
- Throws:
URISyntaxException
-
seeResource
- Throws:
org.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:
-
hasResource
Description copied from interface:IWorkerContextfind whether a resource is available. Implementations of the interface can assume that if hasResource ruturns true, the resource will usually be fetched subsequently- Specified by:
hasResourcein interfaceIWorkerContext- Returns:
-
getNarrativeGenerator
Description copied from interface:IWorkerContextGet a generator that can generate narrative for the instance- Specified by:
getNarrativeGeneratorin interfaceIWorkerContext- Returns:
- a prepared generator
-
newValidator
Description copied from interface:IWorkerContextGet a validator that can check whether a resource is valid- Specified by:
newValidatorin interfaceIWorkerContext- Returns:
- a prepared generator
-
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- Returns:
-
totalCount
-
setCache
-
getResourceNames
- Specified by:
getResourceNamesin interfaceIWorkerContext
-
getAbbreviation
Description copied from interface:IWorkerContextreturns the recommended tla for the type- 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(ElementDefinition.ElementDefinitionBindingComponent binding)- Specified by:
resolveBindingin interfaceProfileUtilities.ProfileKnowledgeProvider
-
getLinkForProfile
- Specified by:
getLinkForProfilein interfaceProfileUtilities.ProfileKnowledgeProvider
-
allStructures
- Specified by:
allStructuresin interfaceIWorkerContext
-