mirror of
https://github.com/hapifhir/org.hl7.fhir.core.git
synced 2025-02-10 06:44:44 +00:00
Fix problem with link resolution within Bundles - and add test case that checks it. (Also update Synthea test case to reflect new status codes for Encounter.)
This commit is contained in:
parent
6c4620996f
commit
7c1786279f
@ -2527,14 +2527,15 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||||||
String u = null;
|
String u = null;
|
||||||
if (fullUrl != null && fullUrl.endsWith(type+"/"+id))
|
if (fullUrl != null && fullUrl.endsWith(type+"/"+id))
|
||||||
// fullUrl = complex
|
// fullUrl = complex
|
||||||
u = fullUrl.substring((type+"/"+id).length())+ref;
|
u = fullUrl.substring(0, fullUrl.length() - (type+"/"+id).length())+ref;
|
||||||
|
// u = fullUrl.substring((type+"/"+id).length())+ref;
|
||||||
String[] parts = ref.split("\\/");
|
String[] parts = ref.split("\\/");
|
||||||
if (parts.length >= 2) {
|
if (parts.length >= 2) {
|
||||||
String t = parts[0];
|
String t = parts[0];
|
||||||
String i = parts[1];
|
String i = parts[1];
|
||||||
for (Element entry : entries) {
|
for (Element entry : entries) {
|
||||||
String fu = entry.getNamedChildValue("fullUrl");
|
String fu = entry.getNamedChildValue("fullUrl");
|
||||||
if (u != null && fullUrl.equals(u))
|
if (u != null && fu.equals(u))
|
||||||
return entry;
|
return entry;
|
||||||
if (u == null) {
|
if (u == null) {
|
||||||
Element resource = entry.getNamedChild("resource");
|
Element resource = entry.getNamedChild("resource");
|
||||||
|
@ -0,0 +1,45 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Bundle xmlns="http://hl7.org/fhir">
|
||||||
|
<id value="bundle-local-refs"/>
|
||||||
|
<meta>
|
||||||
|
<lastUpdated value="2019-07-21T11:01:00+05:00"/>
|
||||||
|
</meta>
|
||||||
|
<identifier>
|
||||||
|
<system value="http://example.org/documentIDs"/>
|
||||||
|
<value value="A12345"/>
|
||||||
|
</identifier>
|
||||||
|
<type value="document"/>
|
||||||
|
<timestamp value="2019-07-21T11:01:00+05:00"/>
|
||||||
|
<entry>
|
||||||
|
<fullUrl value="http://example.org/fhir/Composition/1"/>
|
||||||
|
<resource>
|
||||||
|
<Composition>
|
||||||
|
<id value="1"/>
|
||||||
|
<status value="final"/>
|
||||||
|
<type>
|
||||||
|
<text value="foo"/>
|
||||||
|
</type>
|
||||||
|
<subject>
|
||||||
|
<reference value="Patient/1"/>
|
||||||
|
</subject>
|
||||||
|
<date value="2019-07-21T23:09:00+07:00"/>
|
||||||
|
<author>
|
||||||
|
<display value="foo"/>
|
||||||
|
</author>
|
||||||
|
<title value="Example with local references"/>
|
||||||
|
</Composition>
|
||||||
|
</resource>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<fullUrl value="http://example.org/fhir/Patient/1"/>
|
||||||
|
<resource>
|
||||||
|
<Patient>
|
||||||
|
<id value="1"/>
|
||||||
|
<name>
|
||||||
|
<family value="SMITH"/>
|
||||||
|
<given value="JOE"/>
|
||||||
|
</name>
|
||||||
|
</Patient>
|
||||||
|
</resource>
|
||||||
|
</entry>
|
||||||
|
</Bundle>
|
@ -790,6 +790,10 @@
|
|||||||
"source": "azatadha/param-profile.xml",
|
"source": "azatadha/param-profile.xml",
|
||||||
"errorCount": 0
|
"errorCount": 0
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"bundle-local-refs.xml" : {
|
||||||
|
"errorCount": 0,
|
||||||
|
"warningCount": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
"value": "v6751"
|
"value": "v6751"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"status": "finished",
|
"status": "completed",
|
||||||
"subject": {
|
"subject": {
|
||||||
"reference": "Patient/f001",
|
"reference": "Patient/f001",
|
||||||
"display": "P. van de Heuvel"
|
"display": "P. van de Heuvel"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user