From fc646043bfb7c3bcbf9c9efeba333f931718d240 Mon Sep 17 00:00:00 2001 From: Jonathan Percival Date: Wed, 30 Oct 2024 14:18:30 -0600 Subject: [PATCH] Fixes for Tuples --- .../parameters/CqlFhirParametersConverter.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cqf-fhir-cql/src/main/java/org/opencds/cqf/fhir/cql/engine/parameters/CqlFhirParametersConverter.java b/cqf-fhir-cql/src/main/java/org/opencds/cqf/fhir/cql/engine/parameters/CqlFhirParametersConverter.java index fa75958eb..3b500ac42 100644 --- a/cqf-fhir-cql/src/main/java/org/opencds/cqf/fhir/cql/engine/parameters/CqlFhirParametersConverter.java +++ b/cqf-fhir-cql/src/main/java/org/opencds/cqf/fhir/cql/engine/parameters/CqlFhirParametersConverter.java @@ -94,13 +94,12 @@ protected IParametersParameterComponentAdapter addPart(IParametersAdapter pa, St @SuppressWarnings("unchecked") protected void addPart(IParametersAdapter pa, String name, Object value) { - IParametersParameterComponentAdapter ppca = this.addPart(pa, name); - if (value == null) { return; } if (value instanceof Iterable) { + var ppca = this.addPart(pa, name); Iterable values = (Iterable) value; for (Object o : values) { this.addSubPart(ppca, "element", o); @@ -113,9 +112,16 @@ protected void addPart(IParametersAdapter pa, String name, Object value) { value = this.fhirTypeConverter.toFhirType(value); } - if (value instanceof IBaseDatatype) { + // Likely already a parameter part + if (value instanceof IBaseBackboneElement) { + var ppca = this.adapterFactory.createParametersParameters((IBaseBackboneElement) value); + ppca.setName(name); + pa.addParameter(ppca.get()); + } else if (value instanceof IBaseDatatype) { + var ppca = this.addPart(pa, name); ppca.setValue((IBaseDatatype) value); } else if (value instanceof IBaseResource) { + var ppca = this.addPart(pa, name); ppca.setResource((IBaseResource) value); } else { throw new IllegalArgumentException(String.format(