Improve suport for enableWhen validation

This commit is contained in:
James Agnew 2019-04-29 14:46:55 -04:00
parent 99273c6e60
commit 6dfac49198
3 changed files with 15 additions and 3 deletions

View File

@ -87,7 +87,7 @@
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>org.hl7.fhir.r4.validation.Validator</mainClass>
<mainClass>org.hl7.fhir.r5.validation.Validator</mainClass>
</manifest>
</archive>
</configuration>

View File

@ -66,7 +66,10 @@ public class DefaultEnableWhenEvaluator implements IEnableWhenEvaluator {
return new EnableWhenResult(result, linkId, enableCondition, questionnaireResponse);
}
public Type convertToType(Element element) throws FHIRException {
private Type convertToType(Element element) throws FHIRException {
if (element.fhirType().equals("BackboneElement")) {
return null;
}
Type b = new Factory().create(element.fhirType());
if (b instanceof PrimitiveType) {
((PrimitiveType<?>) b).setValueAsString(element.primitiveValue());
@ -92,6 +95,9 @@ public class DefaultEnableWhenEvaluator implements IEnableWhenEvaluator {
}
try {
actualAnswer = convertToType(answer);
if (actualAnswer == null) {
return false;
}
} catch (FHIRException e) {
throw new UnprocessableEntityException("Unexpected answer type", e);
}

View File

@ -66,7 +66,10 @@ public class DefaultEnableWhenEvaluator implements IEnableWhenEvaluator {
return new EnableWhenResult(result, linkId, enableCondition, questionnaireResponse);
}
public Type convertToType(Element element) throws FHIRException {
private Type convertToType(Element element) throws FHIRException {
if (element.fhirType().equals("BackboneElement")) {
return null;
}
Type b = new Factory().create(element.fhirType());
if (b instanceof PrimitiveType) {
((PrimitiveType<?>) b).setValueAsString(element.primitiveValue());
@ -92,6 +95,9 @@ public class DefaultEnableWhenEvaluator implements IEnableWhenEvaluator {
}
try {
actualAnswer = convertToType(answer);
if (actualAnswer == null) {
return false;
}
} catch (FHIRException e) {
throw new UnprocessableEntityException("Unexpected answer type", e);
}