Package com.ibm.fhir.path.evaluator
Class FHIRPathEvaluator.EvaluationContext
- java.lang.Object
-
- com.ibm.fhir.path.evaluator.FHIRPathEvaluator.EvaluationContext
-
- Enclosing class:
- FHIRPathEvaluator
public static class FHIRPathEvaluator.EvaluationContext extends Object
A context object used to pass information to/from the FHIRPath evaluation engine
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
DEFAULT_RESOLVE_RELATIVE_REFERENCES
-
Constructor Summary
Constructors Constructor Description EvaluationContext()
Create an empty evaluation context, evaluating stand-alone expressionsEvaluationContext(Resource resource)
Create an evaluation context where the passed resource is the context root.EvaluationContext(Element element)
Create an evaluation context where the passed element is the context root.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearIssues()
Clear the list of supplemental issues that were generated during evaluationConstraint
getConstraint()
Get the constraint currently under evaluationCollection<FHIRPathNode>
getExternalConstant(String name)
Get an external constant with the given nameList<OperationOutcome.Issue>
getIssues()
Get the list of supplemental issues that were generated during evaluationFHIRPathTree
getTree()
Get the FHIRPath tree associated with this EvaluationContextboolean
hasConstraint()
Indicates whether this evaluation context has an associated constraintboolean
hasExternalConstant(String name)
Indicates whether this EvaluationContext has an external constant with the given nameboolean
hasIssues()
Indicates whether this evaluation context has supplemental issues that were generated during evaluationboolean
resolveRelativeReferences()
Indicates whether the evaluator using this evaluation context should resolve relative references (if possible)void
setConstraint(Constraint constraint)
Set the constraint currently under evaluationvoid
setExternalConstant(String name, FHIRPathNode node)
Set an external constant using a name and FHIRPath nodevoid
setExternalConstant(String name, Collection<FHIRPathNode> nodes)
Set an external constant using a name and a collection of FHIRPath nodevoid
setResolveRelativeReferences(boolean resolveRelativeReferences)
Set the resolve relative references indicatorvoid
unsetConstraint()
Unset the constraint currently under evaluationvoid
unsetExternalConstant(String name)
Unset an external constant with the given name
-
-
-
Field Detail
-
DEFAULT_RESOLVE_RELATIVE_REFERENCES
public static final boolean DEFAULT_RESOLVE_RELATIVE_REFERENCES
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
EvaluationContext
public EvaluationContext()
Create an empty evaluation context, evaluating stand-alone expressions
-
EvaluationContext
public EvaluationContext(Resource resource)
Create an evaluation context where the passed resource is the context root. Sets %resource and %rootResource external constants to the passed resource, but these can be overridden.- Parameters:
resource
- the resource
-
EvaluationContext
public EvaluationContext(Element element)
Create an evaluation context where the passed element is the context root.- Parameters:
element
- the element
-
-
Method Detail
-
getTree
public FHIRPathTree getTree()
Get the FHIRPath tree associated with this EvaluationContext- Returns:
- the FHIRPath tree associated with this EvaluationContext
-
setExternalConstant
public void setExternalConstant(String name, FHIRPathNode node)
Set an external constant using a name and FHIRPath node- Parameters:
name
- the namenode
- the FHIRPath node
-
setExternalConstant
public void setExternalConstant(String name, Collection<FHIRPathNode> nodes)
Set an external constant using a name and a collection of FHIRPath node- Parameters:
name
- the namenodes
- the collection of FHIRPath nodes
-
unsetExternalConstant
public void unsetExternalConstant(String name)
Unset an external constant with the given name- Parameters:
name
- the name
-
getExternalConstant
public Collection<FHIRPathNode> getExternalConstant(String name)
Get an external constant with the given name- Parameters:
name
- the name- Returns:
- the external constant as a collection of FHIRPath nodes or an empty collection
-
hasExternalConstant
public boolean hasExternalConstant(String name)
Indicates whether this EvaluationContext has an external constant with the given name- Parameters:
name
- the name- Returns:
- true if this EvaluationContext has an external constant with the given name, otherwise false
-
getIssues
public List<OperationOutcome.Issue> getIssues()
Get the list of supplemental issues that were generated during evaluationSupplemental issues are used to convey additional information about the evaluation to the client
- Returns:
- the list of supplemental issues that were generated during evaluation
-
clearIssues
public void clearIssues()
Clear the list of supplemental issues that were generated during evaluation
-
hasIssues
public boolean hasIssues()
Indicates whether this evaluation context has supplemental issues that were generated during evaluation- Returns:
- true if this evaluation context has supplemental issues that were generated during evaluation, otherwise false
-
setConstraint
public void setConstraint(Constraint constraint)
Set the constraint currently under evaluationIf a
Constraint
is the source of the expression under evaluation, then this method allows the client to make it available to the evaluation engine to access additional information about the constraint (e.g. id, level, location, description, etc.)- Parameters:
constraint
- the constraint currently under evaluation
-
unsetConstraint
public void unsetConstraint()
Unset the constraint currently under evaluation
-
getConstraint
public Constraint getConstraint()
Get the constraint currently under evaluation- Returns:
- the constraint currently under evaluation if exists, otherwise null
-
hasConstraint
public boolean hasConstraint()
Indicates whether this evaluation context has an associated constraint- Returns:
- true if this evaluation context has an associated constraint, otherwise false
-
setResolveRelativeReferences
public void setResolveRelativeReferences(boolean resolveRelativeReferences)
Set the resolve relative references indicator- Parameters:
resolveRelativeReferences
- the resolve relative references indicator
-
resolveRelativeReferences
public boolean resolveRelativeReferences()
Indicates whether the evaluator using this evaluation context should resolve relative references (if possible)- Returns:
- true if the evaluator using this evaluation context should resolve relative references (if possible), otherwise false
-
-