fix problem with rootResource and Bundles and contained resources
This commit is contained in:
parent
8ce2a8f760
commit
fb8974efd5
|
@ -189,6 +189,15 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ValidatorHostContext forEntry(Element element) {
|
||||||
|
ValidatorHostContext res = new ValidatorHostContext(appContext);
|
||||||
|
res.rootResource = element;
|
||||||
|
res.resource = element;
|
||||||
|
res.container = resource;
|
||||||
|
res.profile = profile;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
public ValidatorHostContext forProfile(StructureDefinition profile) {
|
public ValidatorHostContext forProfile(StructureDefinition profile) {
|
||||||
ValidatorHostContext res = new ValidatorHostContext(appContext);
|
ValidatorHostContext res = new ValidatorHostContext(appContext);
|
||||||
res.resource = resource;
|
res.resource = resource;
|
||||||
|
@ -3917,10 +3926,15 @@ private boolean isAnswerRequirementFulfilled(QuestionnaireItemComponent qItem, L
|
||||||
StructureDefinition profile = this.context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + resourceName);
|
StructureDefinition profile = this.context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + resourceName);
|
||||||
sdTime = sdTime + (System.nanoTime() - t);
|
sdTime = sdTime + (System.nanoTime() - t);
|
||||||
// special case: resource wrapper is reset if we're crossing a bundle boundary, but not otherwise
|
// special case: resource wrapper is reset if we're crossing a bundle boundary, but not otherwise
|
||||||
if (element.getSpecial() == SpecialElement.BUNDLE_ENTRY || element.getSpecial() == SpecialElement.BUNDLE_OUTCOME || element.getSpecial() == SpecialElement.PARAMETER )
|
ValidatorHostContext hc = null;
|
||||||
|
if (element.getSpecial() == SpecialElement.BUNDLE_ENTRY || element.getSpecial() == SpecialElement.BUNDLE_OUTCOME || element.getSpecial() == SpecialElement.PARAMETER ) {
|
||||||
resource = element;
|
resource = element;
|
||||||
|
hc = hostContext.forEntry(element);
|
||||||
|
} else {
|
||||||
|
hc = hostContext.forContained(element);
|
||||||
|
}
|
||||||
if (rule(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), profile != null, "No profile found for contained resource of type '" + resourceName + "'"))
|
if (rule(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), profile != null, "No profile found for contained resource of type '" + resourceName + "'"))
|
||||||
validateResource(hostContext.forContained(element), errors, resource, element, profile, null, idstatus, stack, false);
|
validateResource(hc, errors, resource, element, profile, null, idstatus, stack, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateDocument(List<ValidationMessage> errors, List<Element> entries, Element composition, NodeStack stack, String fullUrl, String id) {
|
private void validateDocument(List<ValidationMessage> errors, List<Element> entries, Element composition, NodeStack stack, String fullUrl, String id) {
|
||||||
|
|
Loading…
Reference in New Issue