Class CompositeDataProvider

java.lang.Object
org.opencds.cqf.cql.engine.data.CompositeDataProvider
All Implemented Interfaces:
DataProvider, ModelResolver, RetrieveProvider

public class CompositeDataProvider extends Object implements DataProvider
  • Field Details

  • Constructor Details

  • Method Details

    • getPackageName

      public String getPackageName()
      Specified by:
      getPackageName in interface ModelResolver
    • setPackageName

      public void setPackageName(String packageName)
      Specified by:
      setPackageName in interface ModelResolver
    • getPackageNames

      public List<String> getPackageNames()
      Description copied from interface: ModelResolver
      Return the package names of Java objects supported by this model
      Specified by:
      getPackageNames in interface ModelResolver
      Returns:
      list of Java package names for model objects that support this model.
    • setPackageNames

      public void setPackageNames(List<String> packageNames)
      Description copied from interface: ModelResolver
      Set the package names of Java objects supported by this model
      Specified by:
      setPackageNames in interface ModelResolver
      Parameters:
      packageNames - list of Java package names for model objects that support this model.
    • resolvePath

      public Object resolvePath(Object target, String path)
      Description copied from interface: ModelResolver
      Resolve the provided path expression for the provided target. Paths can be things like simple dotted property notation (e.g. Patient.id) or more complex things like list indexed property expressions (e.g. Patient.name[0].given). The exact details are configued in the model definition and passed to the ELM file during CQL to ELM translation.
      Specified by:
      resolvePath in interface ModelResolver
      Returns:
      result of the provided expression. Null is expected whenever a path doesn't exist on the target.
    • getContextPath

      public Object getContextPath(String contextType, String targetType)
      Description copied from interface: ModelResolver
      Get the path expression that expresses the relationship between the targetType and the given contextType. For example, in a FHIR model, with context type Patient and targetType Condition, the resulting path is subject because that is the model property on the Condition object that links the Condition to the Patient.
      Specified by:
      getContextPath in interface ModelResolver
    • resolveType

      public Class<?> resolveType(String typeName)
      Description copied from interface: ModelResolver
      Resolve the Java class that corresponds to the given model type
      Specified by:
      resolveType in interface ModelResolver
      Parameters:
      typeName - Model type name. In the ELM, model objects are namespaced (e.g. FHIR.Patient), but the namespace is removed prior to calling this method, so the input would just be Patient.
      Returns:
      Class object that represents the specified model type
    • resolveType

      public Class<?> resolveType(Object value)
      Description copied from interface: ModelResolver
      Resolve the Java class that corresponds to the given model object instance.
      Specified by:
      resolveType in interface ModelResolver
      Parameters:
      value - Object instance
      Returns:
      Class object that represents the specified value
    • is

      public Boolean is(Object value, Class<?> type)
      Description copied from interface: ModelResolver
      Check whether or not a specified value instance is of the specified type.
      Specified by:
      is in interface ModelResolver
      Returns:
      true when the value is of the specified type, otherwise false.
    • as

      public Object as(Object value, Class<?> type, boolean isStrict)
      Description copied from interface: ModelResolver
      Cast the specified value to the specified type. When type conversion is not possible, null should be returned unless the isStrict flag is set to true wherein an Exception will be thrown.
      Specified by:
      as in interface ModelResolver
      Parameters:
      value - model object instance
      type - type to which the value should be case
      isStrict - flag indicating how to handle invalid type conversion
      Returns:
      the result of the value conversion or null if conversion is not possible.
    • createInstance

      public Object createInstance(String typeName)
      Description copied from interface: ModelResolver
      Create an instance of the model object that corresponds to the specified type.
      Specified by:
      createInstance in interface ModelResolver
      Parameters:
      typeName - Model type to create
      Returns:
      new instance of the specified model type
    • setValue

      public void setValue(Object target, String path, Object value)
      Description copied from interface: ModelResolver
      Set the value of a particular property on the given model object.
      Specified by:
      setValue in interface ModelResolver
      Parameters:
      target - model object
      path - path to the property that will be set
      value - value to set to the property indicated by the path expression
    • objectEqual

      public Boolean objectEqual(Object left, Object right)
      Description copied from interface: ModelResolver
      Compare two objects for equality
      Specified by:
      objectEqual in interface ModelResolver
      Parameters:
      left - left hand side of the equality expression
      right - right hand side of the equality expression
      Returns:
      flag indicating whether the objects are equal
    • objectEquivalent

      public Boolean objectEquivalent(Object left, Object right)
      Description copied from interface: ModelResolver
      Compare two objects for equivalence
      Specified by:
      objectEquivalent in interface ModelResolver
      Parameters:
      left - left hand side of the equivalence expression
      right - right hand side of the equivalence expression
      Returns:
      flag indicating whether the objects are equal
    • retrieve

      public Iterable<Object> retrieve(String context, String contextPath, Object contextValue, String dataType, String templateId, String codePath, Iterable<Code> codes, String valueSet, String datePath, String dateLowPath, String dateHighPath, Interval dateRange)
      Specified by:
      retrieve in interface RetrieveProvider