Package org.opencds.cqf.cql.engine.data
Class CompositeDataProvider
- java.lang.Object
-
- org.opencds.cqf.cql.engine.data.CompositeDataProvider
-
- All Implemented Interfaces:
DataProvider,ModelResolver,RetrieveProvider
public class CompositeDataProvider extends java.lang.Object implements DataProvider
-
-
Field Summary
Fields Modifier and Type Field Description protected ModelResolvermodelResolverprotected RetrieveProviderretrieveProvider
-
Constructor Summary
Constructors Constructor Description CompositeDataProvider(ModelResolver modelResolver, RetrieveProvider retrieveProvider)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectas(java.lang.Object value, java.lang.Class<?> type, boolean isStrict)Cast the specified value to the specified type.java.lang.ObjectcreateInstance(java.lang.String typeName)Create an instance of the model object that corresponds to the specified type.java.lang.ObjectgetContextPath(java.lang.String contextType, java.lang.String targetType)Get the path expression that expresses the relationship between thetargetTypeand the givencontextType.java.lang.StringgetPackageName()java.util.List<java.lang.String>getPackageNames()Return the package names of Java objects supported by this modeljava.lang.Booleanis(java.lang.Object value, java.lang.Class<?> type)Check whether or not a specified value instance is of the specified type.java.lang.BooleanobjectEqual(java.lang.Object left, java.lang.Object right)Compare two objects for equalityjava.lang.BooleanobjectEquivalent(java.lang.Object left, java.lang.Object right)Compare two objects for equivalencejava.lang.ObjectresolvePath(java.lang.Object target, java.lang.String path)Resolve the provided path expression for the provided target.java.lang.Class<?>resolveType(java.lang.Object value)Resolve the Java class that corresponds to the given model object instance.java.lang.Class<?>resolveType(java.lang.String typeName)Resolve the Java class that corresponds to the given model typejava.lang.Iterable<java.lang.Object>retrieve(java.lang.String context, java.lang.String contextPath, java.lang.Object contextValue, java.lang.String dataType, java.lang.String templateId, java.lang.String codePath, java.lang.Iterable<Code> codes, java.lang.String valueSet, java.lang.String datePath, java.lang.String dateLowPath, java.lang.String dateHighPath, Interval dateRange)voidsetPackageName(java.lang.String packageName)voidsetPackageNames(java.util.List<java.lang.String> packageNames)Set the package names of Java objects supported by this modelvoidsetValue(java.lang.Object target, java.lang.String path, java.lang.Object value)Set the value of a particular property on the given model object.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.opencds.cqf.cql.engine.data.DataProvider
phiObfuscationSupplier
-
-
-
-
Field Detail
-
modelResolver
protected ModelResolver modelResolver
-
retrieveProvider
protected RetrieveProvider retrieveProvider
-
-
Constructor Detail
-
CompositeDataProvider
public CompositeDataProvider(ModelResolver modelResolver, RetrieveProvider retrieveProvider)
-
-
Method Detail
-
getPackageName
public java.lang.String getPackageName()
- Specified by:
getPackageNamein interfaceModelResolver
-
setPackageName
public void setPackageName(java.lang.String packageName)
- Specified by:
setPackageNamein interfaceModelResolver
-
getPackageNames
public java.util.List<java.lang.String> getPackageNames()
Description copied from interface:ModelResolverReturn the package names of Java objects supported by this model- Specified by:
getPackageNamesin interfaceModelResolver- Returns:
- list of Java package names for model objects that support this model.
-
setPackageNames
public void setPackageNames(java.util.List<java.lang.String> packageNames)
Description copied from interface:ModelResolverSet the package names of Java objects supported by this model- Specified by:
setPackageNamesin interfaceModelResolver- Parameters:
packageNames- list of Java package names for model objects that support this model.
-
resolvePath
public java.lang.Object resolvePath(java.lang.Object target, java.lang.String path)Description copied from interface:ModelResolverResolve 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:
resolvePathin interfaceModelResolver- Returns:
- result of the provided expression. Null is expected whenever a path doesn't exist on the target.
-
getContextPath
public java.lang.Object getContextPath(java.lang.String contextType, java.lang.String targetType)Description copied from interface:ModelResolverGet the path expression that expresses the relationship between thetargetTypeand the givencontextType. For example, in a FHIR model, with context typePatientand targetType Condition, the resulting path issubjectbecause that is the model property on the Condition object that links the Condition to the Patient.- Specified by:
getContextPathin interfaceModelResolver
-
resolveType
public java.lang.Class<?> resolveType(java.lang.String typeName)
Description copied from interface:ModelResolverResolve the Java class that corresponds to the given model type- Specified by:
resolveTypein interfaceModelResolver- 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 java.lang.Class<?> resolveType(java.lang.Object value)
Description copied from interface:ModelResolverResolve the Java class that corresponds to the given model object instance.- Specified by:
resolveTypein interfaceModelResolver- Parameters:
value- Object instance- Returns:
- Class object that represents the specified value
-
is
public java.lang.Boolean is(java.lang.Object value, java.lang.Class<?> type)Description copied from interface:ModelResolverCheck whether or not a specified value instance is of the specified type.- Specified by:
isin interfaceModelResolver- Returns:
- true when the value is of the specified type, otherwise false.
-
as
public java.lang.Object as(java.lang.Object value, java.lang.Class<?> type, boolean isStrict)Description copied from interface:ModelResolverCast 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:
asin interfaceModelResolver- Parameters:
value- model object instancetype- type to which the value should be caseisStrict- flag indicating how to handle invalid type conversion- Returns:
- the result of the value conversion or null if conversion is not possible.
-
createInstance
public java.lang.Object createInstance(java.lang.String typeName)
Description copied from interface:ModelResolverCreate an instance of the model object that corresponds to the specified type.- Specified by:
createInstancein interfaceModelResolver- Parameters:
typeName- Model type to create- Returns:
- new instance of the specified model type
-
setValue
public void setValue(java.lang.Object target, java.lang.String path, java.lang.Object value)Description copied from interface:ModelResolverSet the value of a particular property on the given model object.- Specified by:
setValuein interfaceModelResolver- Parameters:
target- model objectpath- path to the property that will be setvalue- value to set to the property indicated by the path expression
-
objectEqual
public java.lang.Boolean objectEqual(java.lang.Object left, java.lang.Object right)Description copied from interface:ModelResolverCompare two objects for equality- Specified by:
objectEqualin interfaceModelResolver- Parameters:
left- left hand side of the equality expressionright- right hand side of the equality expression- Returns:
- flag indicating whether the objects are equal
-
objectEquivalent
public java.lang.Boolean objectEquivalent(java.lang.Object left, java.lang.Object right)Description copied from interface:ModelResolverCompare two objects for equivalence- Specified by:
objectEquivalentin interfaceModelResolver- Parameters:
left- left hand side of the equivalence expressionright- right hand side of the equivalence expression- Returns:
- flag indicating whether the objects are equal
-
retrieve
public java.lang.Iterable<java.lang.Object> retrieve(java.lang.String context, java.lang.String contextPath, java.lang.Object contextValue, java.lang.String dataType, java.lang.String templateId, java.lang.String codePath, java.lang.Iterable<Code> codes, java.lang.String valueSet, java.lang.String datePath, java.lang.String dateLowPath, java.lang.String dateHighPath, Interval dateRange)- Specified by:
retrievein interfaceRetrieveProvider
-
-