Class Runner

java.lang.Object
org.hl7.fhir.r4.utils.sql.Runner
All Implemented Interfaces:
IHostApplicationServices

public class Runner extends Object implements IHostApplicationServices
How to use the Runner: create a resource, and fill out: the context (supports the FHIRPathEngine) a store that handles the output a tracker - if you want Once it's created, you either run it as a batch, or in trickle mode (1) Batch Mode * provide a provider * call execute() with a ViewDefinition * wait... (watch with an observer if you want to track progress) (2) Trickle Mode * call 'prepare', and keep the WorkContext that's returned * each time there's a resource to process, call processResource and pass in the workContext and the resource * when done, call finish(WorkContext)
  • Constructor Details

  • Method Details

    • getContext

    • setContext

      public void setContext(IWorkerContext context)
    • getProvider

    • setProvider

      public void setProvider(Provider provider)
    • getStorage

      public Storage getStorage()
    • setStorage

      public void setStorage(Storage storage)
    • getProhibitedNames

    • execute

      public void execute(org.hl7.fhir.utilities.json.model.JsonObject viewDefinition)
    • execute

      public void execute(String path, org.hl7.fhir.utilities.json.model.JsonObject viewDefinition)
    • prepare

      public Runner.WorkContext prepare(String path, org.hl7.fhir.utilities.json.model.JsonObject viewDefinition)
    • processResource

      public void processResource(Runner.WorkContext wc, Base b)
    • finish

      public void finish(Runner.WorkContext wc)
    • resolveConstant

      public List<Base> resolveConstant(FHIRPathEngine engine, Object appContext, String name, org.hl7.fhir.utilities.fhirpath.FHIRPathConstantEvaluationMode mode) throws org.hl7.fhir.exceptions.PathEngineException
      Description copied from interface: IHostApplicationServices
      A constant reference - e.g. a reference to a name that must be resolved in context. resolveConstant is invoked under 3 different circumstances, which are reflected in the mode parameter: * an explicit constant of the form %{token}, where the token isn't a known internal constant * every evaluation of any expression to allow the Host Application to decide whether to interpret the expression as a constant even if it is not explicitly a constant * at the start of evaluating an expression if the focus provided by the application when invoking the expression is {} The return value is a List - a collection, though most constants are singleton values note that variables created using defineVariable() in the FHIRPath expressions will not be processed by resolveConstant (or resolveConstantType)
      Specified by:
      resolveConstant in interface IHostApplicationServices
      Parameters:
      appContext - - application context passed into the FHIRPath engine when first executed
      name - - name reference to resolve. if mode = EXPLICIT, the % will NOT be in the name
      mode - - what situation the reference comes from - see the documentation for @FHIRPathConstantEvaluationMode
      Returns:
      the value of the constant , or an empty list, though the host application can choose to throw an exception
      Throws:
      org.hl7.fhir.exceptions.PathEngineException
    • resolveConstantType

      public TypeDetails resolveConstantType(FHIRPathEngine engine, Object appContext, String name, org.hl7.fhir.utilities.fhirpath.FHIRPathConstantEvaluationMode mode) throws org.hl7.fhir.exceptions.PathEngineException
      Description copied from interface: IHostApplicationServices
      Compile time support for a constant reference - e.g. a reference to a name that must be resolved in context. resolveConstant is invoked under 3 different circumstances, which are reflected in the mode parameter: * an explicit constant of the form %{token}, where the token isn't a known internal constant * every evaluation of any expression to allow the Host Application to decide whether to interpret the expression as a constant even if it is not explicitly a constant * at the start of evaluating an expression if the focus provided by the application when invoking the expression is {} The return value is a TypeDetails - a collection, though most constants are singleton values note that variables created using defineVariable() in the FHIRPath expressions will not be processed by resolveConstant (or resolveConstantType)
      Specified by:
      resolveConstantType in interface IHostApplicationServices
      Parameters:
      appContext - - application context passed into the FHIRPath engine when first executed
      name - - name reference to resolve. if mode = EXPLICIT, the % will NOT be in the name
      mode - - what situation the reference comes from - see the documentation for @FHIRPathConstantEvaluationMode
      Returns:
      the type of the constant, or null, though the host application can choose to throw an exception
      Throws:
      org.hl7.fhir.exceptions.PathEngineException
    • log

      public boolean log(String argument, List<Base> focus)
      Description copied from interface: IHostApplicationServices
      when the .log() function is called
      Specified by:
      log in interface IHostApplicationServices
      Parameters:
      argument -
      focus -
      Returns:
    • resolveFunction

      Specified by:
      resolveFunction in interface IHostApplicationServices
      Parameters:
      functionName -
      Returns:
      null if the function is not known
    • checkFunction

      public TypeDetails checkFunction(FHIRPathEngine engine, Object appContext, String functionName, TypeDetails focus, List<TypeDetails> parameters) throws org.hl7.fhir.exceptions.PathEngineException
      Description copied from interface: IHostApplicationServices
      Check the function parameters, and throw an error if they are incorrect, or return the type for the function
      Specified by:
      checkFunction in interface IHostApplicationServices
      Parameters:
      functionName -
      parameters -
      Returns:
      Throws:
      org.hl7.fhir.exceptions.PathEngineException
    • executeFunction

      public List<Base> executeFunction(FHIRPathEngine engine, Object appContext, List<Base> focus, String functionName, List<List<Base>> parameters)
      Specified by:
      executeFunction in interface IHostApplicationServices
      Parameters:
      appContext -
      functionName -
      parameters -
      Returns:
    • resolveReference

      public Base resolveReference(FHIRPathEngine engine, Object appContext, String url, Base refContext) throws org.hl7.fhir.exceptions.FHIRException
      Description copied from interface: IHostApplicationServices
      Implementation of resolve() function. Passed a string, return matching resource, if one is known - else null
      Specified by:
      resolveReference in interface IHostApplicationServices
      Parameters:
      url - the reference (Reference.reference or the value of the canonical
      Returns:
      Throws:
      org.hl7.fhir.exceptions.FHIRException
    • conformsToProfile

      public boolean conformsToProfile(FHIRPathEngine engine, Object appContext, Base item, String url) throws org.hl7.fhir.exceptions.FHIRException
      Specified by:
      conformsToProfile in interface IHostApplicationServices
      Throws:
      org.hl7.fhir.exceptions.FHIRException
    • resolveValueSet

      public ValueSet resolveValueSet(FHIRPathEngine engine, Object appContext, String url)
      Specified by:
      resolveValueSet in interface IHostApplicationServices
    • paramIsType

      public boolean paramIsType(String name, int index)
      Description copied from interface: IHostApplicationServices
      For the moment, there can only be one parameter if it's a type parameter
      Specified by:
      paramIsType in interface IHostApplicationServices
      Parameters:
      name -
      Returns:
      true if it's a type parameter
    • getIssues

      public List<org.hl7.fhir.utilities.validation.ValidationMessage> getIssues()