fix problem with composition library reference in R4
This commit is contained in:
parent
7ea1e5197d
commit
98a7f26b84
|
@ -127,7 +127,7 @@ public class R4ToR5Loader extends BaseLoaderR5 implements IContextResourceLoader
|
||||||
if (killPrimitives) {
|
if (killPrimitives) {
|
||||||
throw new FHIRException("Cannot kill primitives when using deferred loading");
|
throw new FHIRException("Cannot kill primitives when using deferred loading");
|
||||||
}
|
}
|
||||||
if (r5 instanceof StructureDefinition && VersionUtilities.isR4BVer(version)) {
|
if (r5 instanceof StructureDefinition && VersionUtilities.isR4Ver(version)) {
|
||||||
r5 = new StructureDefinitionHacker(version).fixSD((StructureDefinition) r5);
|
r5 = new StructureDefinitionHacker(version).fixSD((StructureDefinition) r5);
|
||||||
}
|
}
|
||||||
if (patchUrls) {
|
if (patchUrls) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.hl7.fhir.r5.conformance;
|
package org.hl7.fhir.r5.conformance;
|
||||||
|
|
||||||
|
import org.hl7.fhir.r5.model.CanonicalType;
|
||||||
import org.hl7.fhir.r5.model.ElementDefinition;
|
import org.hl7.fhir.r5.model.ElementDefinition;
|
||||||
import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent;
|
import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent;
|
||||||
import org.hl7.fhir.r5.model.Resource;
|
import org.hl7.fhir.r5.model.Resource;
|
||||||
|
@ -22,8 +23,25 @@ public class StructureDefinitionHacker {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Resource fixSD(StructureDefinition sd) {
|
public Resource fixSD(StructureDefinition sd) {
|
||||||
|
if (VersionUtilities.isR4Ver(version) && "http://hl7.org/fhir/StructureDefinition/example-composition".equals(sd.getUrl())) {
|
||||||
|
for (ElementDefinition ed : sd.getSnapshot().getElement()) {
|
||||||
|
fixDocSecURL(ed);
|
||||||
|
} for (ElementDefinition ed : sd.getDifferential().getElement()) {
|
||||||
|
fixDocSecURL(ed);
|
||||||
|
}
|
||||||
|
}
|
||||||
return sd;
|
return sd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void fixDocSecURL(ElementDefinition ed) {
|
||||||
|
for (TypeRefComponent tr : ed.getType()) {
|
||||||
|
for (CanonicalType c : tr.getProfile()) {
|
||||||
|
if ("http://hl7.org/fhir/StructureDefinition/document-section-library".equals(c.getValue())) {
|
||||||
|
c.setValue("http://hl7.org/fhir/StructureDefinition/example-section-library");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue