Skip to content

Commit d111d04

Browse files
Merge pull request hapifhir#1852 from sebg-mio42/fix-issue-1848
Fix issue 1848
2 parents aef45e0 + 5c1fac1 commit d111d04

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/BaseValidator.java

+27-1
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ public IssueSeverity getLevel() {
168168
protected final String TYPE = "type";
169169
protected final String BUNDLE = "Bundle";
170170
protected final String LAST_UPDATED = "lastUpdated";
171+
protected final String VERSION_ID = "versionId";
171172

172173
protected BaseValidator parent;
173174
protected IWorkerContext context;
@@ -1048,15 +1049,40 @@ protected Element resolveInBundle(Element bundle, List<Element> entries, String
10481049
if (resource != null) {
10491050
String et = resource.getType();
10501051
String eid = resource.getNamedChildValue(ID, false);
1052+
String rl = null;
10511053
if (eid != null) {
1052-
String rl = et+"/"+eid;
1054+
rl = et+"/"+eid;
10531055
list = relMap.get(rl);
10541056
if (list == null) {
10551057
list = new ArrayList<Element>();
10561058
relMap.put(rl, list);
10571059
}
10581060
list.add(entry);
10591061
}
1062+
boolean versionIdPresent = resource.hasChild(META, false)
1063+
&& resource.getNamedChild(META, false).hasChild(VERSION_ID, false)
1064+
&& resource.getNamedChild(META, false).getNamedChild(VERSION_ID, false).hasValue();
1065+
if (versionIdPresent){
1066+
String versionId = resource.getNamedChild(META).getNamedChild(VERSION_ID).getValue();
1067+
String fullUrlVersioned = fu + "/_history/" + versionId;
1068+
List<Element> listMapVersioned = null;
1069+
listMapVersioned = map.get(fullUrlVersioned);
1070+
if (listMapVersioned == null) {
1071+
listMapVersioned = new ArrayList<Element>();
1072+
map.put(fullUrlVersioned, listMapVersioned);
1073+
}
1074+
listMapVersioned.add(entry);
1075+
if (rl != null) {
1076+
String relativePathVersioned = rl + "/_history/" + versionId;
1077+
List<Element> listRelMapVersioned = null;
1078+
listRelMapVersioned = relMap.get(relativePathVersioned);
1079+
if (listRelMapVersioned == null) {
1080+
listRelMapVersioned = new ArrayList<Element>();
1081+
relMap.put(relativePathVersioned, listRelMapVersioned);
1082+
}
1083+
listRelMapVersioned.add(entry);
1084+
}
1085+
}
10601086
}
10611087
}
10621088
}

0 commit comments

Comments
 (0)