Improve suport for enableWhen validation
This commit is contained in:
parent
99273c6e60
commit
6dfac49198
|
@ -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>
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue