mirror of
https://github.com/hapifhir/org.hl7.fhir.core.git
synced 2025-03-01 17:09:08 +00:00
some changes
This commit is contained in:
parent
c53db20879
commit
3eed00d2f7
@ -133,7 +133,8 @@ public class R2R3ConversionManager implements ITransformerServices {
|
||||
// set up ------------------------------------------------------------------
|
||||
public void setR2Definitions(InputStream stream) throws IOException, FHIRException {
|
||||
needPrepare = true;
|
||||
R2ToR3Loader ldr = new R2ToR3Loader().setPatchUrls(true).setKillPrimitives(true);
|
||||
R2ToR3Loader ldr = new R2ToR3Loader();
|
||||
ldr.setPatchUrls(true).setKillPrimitives(true);
|
||||
Map<String, InputStream> files = readInputStream(stream);
|
||||
contextR2 = new SimpleWorkerContext();
|
||||
contextR2.setAllowLoadingDuplicates(true);
|
||||
|
@ -1,7 +1,26 @@
|
||||
package org.hl7.fhir.convertors.loaders;
|
||||
|
||||
import org.hl7.fhir.r5.model.Bundle;
|
||||
import org.hl7.fhir.r5.model.CanonicalType;
|
||||
import org.hl7.fhir.r5.model.ElementDefinition;
|
||||
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class BaseLoader {
|
||||
|
||||
protected final String URL_BASE = "http://hl7.org/fhir/";
|
||||
protected final String URL_DSTU2 = "http://hl7.org/fhir/1.0/";
|
||||
protected final String URL_DSTU2016MAY = "http://hl7.org/fhir/1.4/";
|
||||
protected final String URL_DSTU3 = "http://hl7.org/fhir/3.0/";
|
||||
protected final String URL_R4 = "http://hl7.org/fhir/4.0/";
|
||||
|
||||
protected final String URL_ELEMENT_DEF_NAMESPACE = "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace";
|
||||
|
||||
protected boolean patchUrls;
|
||||
protected boolean killPrimitives;;
|
||||
|
||||
private String[] types;
|
||||
|
||||
public BaseLoader(String[] types) {
|
||||
@ -13,6 +32,23 @@ public abstract class BaseLoader {
|
||||
return types;
|
||||
}
|
||||
|
||||
public boolean isPatchUrls() {
|
||||
return patchUrls;
|
||||
}
|
||||
|
||||
public BaseLoader setPatchUrls(boolean patchUrls) {
|
||||
this.patchUrls = patchUrls;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isKillPrimitives() {
|
||||
return killPrimitives;
|
||||
}
|
||||
|
||||
public BaseLoader setKillPrimitives(boolean killPrimitives) {
|
||||
this.killPrimitives = killPrimitives;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -55,11 +55,13 @@ import org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind;
|
||||
import org.hl7.fhir.r4.model.UriType;
|
||||
import org.hl7.fhir.r4.model.ValueSet;
|
||||
|
||||
public class R2016MayToR4Loader implements IContextResourceLoader, VersionConvertorAdvisor40 {
|
||||
public class R2016MayToR4Loader extends BaseLoader implements IContextResourceLoader, VersionConvertorAdvisor40 {
|
||||
|
||||
private List<CodeSystem> cslist = new ArrayList<>();
|
||||
private boolean patchUrls;
|
||||
private boolean killPrimitives;;
|
||||
|
||||
public R2016MayToR4Loader() {
|
||||
super(new String[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Bundle loadBundle(InputStream stream, boolean isJson) throws FHIRException, IOException {
|
||||
@ -101,8 +103,8 @@ public class R2016MayToR4Loader implements IContextResourceLoader, VersionConver
|
||||
StructureDefinition sd = (StructureDefinition) be.getResource();
|
||||
new ProfileUtilities(null, null, null).setIds(sd, false);
|
||||
if (patchUrls) {
|
||||
sd.setUrl(sd.getUrl().replace("http://hl7.org/fhir/", "http://hl7.org/fhir/2016May/"));
|
||||
sd.addExtension().setUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").setValue(new UriType("http://hl7.org/fhir"));
|
||||
sd.setUrl(sd.getUrl().replace(URL_BASE, "http://hl7.org/fhir/2016May/"));
|
||||
sd.addExtension().setUrl(URL_ELEMENT_DEF_NAMESPACE).setValue(new UriType(URL_BASE));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -142,22 +144,4 @@ public class R2016MayToR4Loader implements IContextResourceLoader, VersionConver
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isPatchUrls() {
|
||||
return patchUrls;
|
||||
}
|
||||
|
||||
public R2016MayToR4Loader setPatchUrls(boolean patchUrls) {
|
||||
this.patchUrls = patchUrls;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isKillPrimitives() {
|
||||
return killPrimitives;
|
||||
}
|
||||
|
||||
public R2016MayToR4Loader setKillPrimitives(boolean killPrimitives) {
|
||||
this.killPrimitives = killPrimitives;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
@ -65,8 +65,6 @@ public class R2016MayToR5Loader extends BaseLoader implements IContextResourceLo
|
||||
}
|
||||
|
||||
private List<CodeSystem> cslist = new ArrayList<>();
|
||||
private boolean patchUrls;
|
||||
private boolean killPrimitives;;
|
||||
|
||||
@Override
|
||||
public Bundle loadBundle(InputStream stream, boolean isJson) throws FHIRException, IOException {
|
||||
@ -108,8 +106,8 @@ public class R2016MayToR5Loader extends BaseLoader implements IContextResourceLo
|
||||
StructureDefinition sd = (StructureDefinition) be.getResource();
|
||||
new ProfileUtilities(null, null, null).setIds(sd, false);
|
||||
if (patchUrls) {
|
||||
sd.setUrl(sd.getUrl().replace("http://hl7.org/fhir/", "http://hl7.org/fhir/2016May/"));
|
||||
sd.addExtension().setUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").setValue(new UriType("http://hl7.org/fhir"));
|
||||
sd.setUrl(sd.getUrl().replace(URL_BASE, URL_DSTU2016MAY));
|
||||
sd.addExtension().setUrl(URL_ELEMENT_DEF_NAMESPACE).setValue(new UriType(URL_BASE));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -133,8 +131,8 @@ public class R2016MayToR5Loader extends BaseLoader implements IContextResourceLo
|
||||
if (patchUrls) {
|
||||
if (r5 instanceof StructureDefinition) {
|
||||
StructureDefinition sd = (StructureDefinition) r5;
|
||||
sd.setUrl(sd.getUrl().replace("http://hl7.org/fhir/", "http://hl7.org/fhir/4.0/"));
|
||||
sd.addExtension().setUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").setValue(new UriType("http://hl7.org/fhir"));
|
||||
sd.setUrl(sd.getUrl().replace(URL_BASE, URL_R4));
|
||||
sd.addExtension().setUrl(URL_ELEMENT_DEF_NAMESPACE).setValue(new UriType(URL_BASE));
|
||||
for (ElementDefinition ed : sd.getSnapshot().getElement())
|
||||
patchUrl(ed);
|
||||
for (ElementDefinition ed : sd.getDifferential().getElement())
|
||||
@ -147,10 +145,10 @@ public class R2016MayToR5Loader extends BaseLoader implements IContextResourceLo
|
||||
private void patchUrl(ElementDefinition ed) {
|
||||
for (TypeRefComponent tr : ed.getType()) {
|
||||
for (CanonicalType s : tr.getTargetProfile()) {
|
||||
s.setValue(s.getValue().replace("http://hl7.org/fhir/", "http://hl7.org/fhir/1.4/"));
|
||||
s.setValue(s.getValue().replace(URL_BASE, URL_DSTU2016MAY));
|
||||
}
|
||||
for (CanonicalType s : tr.getProfile()) {
|
||||
s.setValue(s.getValue().replace("http://hl7.org/fhir/", "http://hl7.org/fhir/1.4/"));
|
||||
s.setValue(s.getValue().replace(URL_BASE, URL_DSTU2016MAY));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -188,24 +186,6 @@ public class R2016MayToR5Loader extends BaseLoader implements IContextResourceLo
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isPatchUrls() {
|
||||
return patchUrls;
|
||||
}
|
||||
|
||||
public R2016MayToR5Loader setPatchUrls(boolean patchUrls) {
|
||||
this.patchUrls = patchUrls;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isKillPrimitives() {
|
||||
return killPrimitives;
|
||||
}
|
||||
|
||||
public R2016MayToR5Loader setKillPrimitives(boolean killPrimitives) {
|
||||
this.killPrimitives = killPrimitives;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.hl7.fhir.r4.model.Resource convertR4(org.hl7.fhir.r5.model.Resource resource) throws FHIRException {
|
||||
return null;
|
||||
|
@ -30,7 +30,6 @@ package org.hl7.fhir.convertors.loaders;
|
||||
*/
|
||||
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
@ -54,11 +53,13 @@ import org.hl7.fhir.dstu3.model.UriType;
|
||||
import org.hl7.fhir.dstu3.model.ValueSet;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
|
||||
public class R2ToR3Loader implements IContextResourceLoader, VersionConvertorAdvisor30 {
|
||||
public class R2ToR3Loader extends BaseLoader implements IContextResourceLoader, VersionConvertorAdvisor30 {
|
||||
|
||||
private List<CodeSystem> cslist = new ArrayList<>();
|
||||
private boolean patchUrls;
|
||||
private boolean killPrimitives;;
|
||||
|
||||
public R2ToR3Loader() {
|
||||
super(new String[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Bundle loadBundle(InputStream stream, boolean isJson) throws FHIRException, IOException {
|
||||
@ -98,8 +99,8 @@ public class R2ToR3Loader implements IContextResourceLoader, VersionConvertorAdv
|
||||
for (BundleEntryComponent be : b.getEntry()) {
|
||||
if (be.hasResource() && be.getResource() instanceof StructureDefinition) {
|
||||
StructureDefinition sd = (StructureDefinition) be.getResource();
|
||||
sd.setUrl(sd.getUrl().replace("http://hl7.org/fhir/", "http://hl7.org/fhir/DSTU2/"));
|
||||
sd.addExtension().setUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").setValue(new UriType("http://hl7.org/fhir"));
|
||||
sd.setUrl(sd.getUrl().replace(URL_BASE, URL_DSTU2));
|
||||
sd.addExtension().setUrl(URL_ELEMENT_DEF_NAMESPACE).setValue(new UriType(URL_BASE));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -121,7 +122,6 @@ public class R2ToR3Loader implements IContextResourceLoader, VersionConvertorAdv
|
||||
cs.setId(vs.getId());
|
||||
cs.setValueSet(vs.getUrl());
|
||||
cslist.add(cs);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -129,22 +129,4 @@ public class R2ToR3Loader implements IContextResourceLoader, VersionConvertorAdv
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isPatchUrls() {
|
||||
return patchUrls;
|
||||
}
|
||||
|
||||
public R2ToR3Loader setPatchUrls(boolean patchUrls) {
|
||||
this.patchUrls = patchUrls;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isKillPrimitives() {
|
||||
return killPrimitives;
|
||||
}
|
||||
|
||||
public R2ToR3Loader setKillPrimitives(boolean killPrimitives) {
|
||||
this.killPrimitives = killPrimitives;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
@ -54,11 +54,13 @@ import org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind;
|
||||
import org.hl7.fhir.r4.model.UriType;
|
||||
import org.hl7.fhir.r4.model.ValueSet;
|
||||
|
||||
public class R2ToR4Loader implements IContextResourceLoader, VersionConvertorAdvisor40 {
|
||||
public class R2ToR4Loader extends BaseLoader implements IContextResourceLoader, VersionConvertorAdvisor40 {
|
||||
|
||||
private List<CodeSystem> cslist = new ArrayList<>();
|
||||
private boolean patchUrls;
|
||||
private boolean killPrimitives;;
|
||||
|
||||
public R2ToR4Loader() {
|
||||
super(new String[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Bundle loadBundle(InputStream stream, boolean isJson) throws FHIRException, IOException {
|
||||
@ -99,8 +101,8 @@ public class R2ToR4Loader implements IContextResourceLoader, VersionConvertorAdv
|
||||
for (BundleEntryComponent be : b.getEntry()) {
|
||||
if (be.hasResource() && be.getResource() instanceof StructureDefinition) {
|
||||
StructureDefinition sd = (StructureDefinition) be.getResource();
|
||||
sd.setUrl(sd.getUrl().replace("http://hl7.org/fhir/", "http://hl7.org/fhir/DSTU2/"));
|
||||
sd.addExtension().setUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").setValue(new UriType("http://hl7.org/fhir"));
|
||||
sd.setUrl(sd.getUrl().replace(URL_BASE, URL_DSTU2));
|
||||
sd.addExtension().setUrl(URL_ELEMENT_DEF_NAMESPACE).setValue(new UriType(URL_BASE));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -139,22 +141,4 @@ public class R2ToR4Loader implements IContextResourceLoader, VersionConvertorAdv
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isPatchUrls() {
|
||||
return patchUrls;
|
||||
}
|
||||
|
||||
public R2ToR4Loader setPatchUrls(boolean patchUrls) {
|
||||
this.patchUrls = patchUrls;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isKillPrimitives() {
|
||||
return killPrimitives;
|
||||
}
|
||||
|
||||
public R2ToR4Loader setKillPrimitives(boolean killPrimitives) {
|
||||
this.killPrimitives = killPrimitives;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
@ -59,14 +59,11 @@ import org.hl7.fhir.r5.model.ValueSet;
|
||||
|
||||
public class R2ToR5Loader extends BaseLoader implements IContextResourceLoader, VersionConvertorAdvisor50 {
|
||||
|
||||
|
||||
public R2ToR5Loader(String[] types) {
|
||||
super(types);
|
||||
}
|
||||
|
||||
private List<CodeSystem> cslist = new ArrayList<>();
|
||||
private boolean patchUrls;
|
||||
private boolean killPrimitives;;
|
||||
|
||||
@Override
|
||||
public Bundle loadBundle(InputStream stream, boolean isJson) throws FHIRException, IOException {
|
||||
@ -107,8 +104,8 @@ public class R2ToR5Loader extends BaseLoader implements IContextResourceLoader,
|
||||
for (BundleEntryComponent be : b.getEntry()) {
|
||||
if (be.hasResource() && be.getResource() instanceof StructureDefinition) {
|
||||
StructureDefinition sd = (StructureDefinition) be.getResource();
|
||||
sd.setUrl(sd.getUrl().replace("http://hl7.org/fhir/", "http://hl7.org/fhir/DSTU2/"));
|
||||
sd.addExtension().setUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").setValue(new UriType("http://hl7.org/fhir"));
|
||||
sd.setUrl(sd.getUrl().replace(URL_BASE, URL_DSTU2));
|
||||
sd.addExtension().setUrl(URL_ELEMENT_DEF_NAMESPACE).setValue(new UriType(URL_BASE));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -133,8 +130,8 @@ public class R2ToR5Loader extends BaseLoader implements IContextResourceLoader,
|
||||
if (patchUrls) {
|
||||
if (r5 instanceof StructureDefinition) {
|
||||
StructureDefinition sd = (StructureDefinition) r5;
|
||||
sd.setUrl(sd.getUrl().replace("http://hl7.org/fhir/", "http://hl7.org/fhir/4.0/"));
|
||||
sd.addExtension().setUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").setValue(new UriType("http://hl7.org/fhir"));
|
||||
sd.setUrl(sd.getUrl().replace(URL_BASE, URL_R4));
|
||||
sd.addExtension().setUrl(URL_ELEMENT_DEF_NAMESPACE).setValue(new UriType(URL_BASE));
|
||||
for (ElementDefinition ed : sd.getSnapshot().getElement())
|
||||
patchUrl(ed);
|
||||
for (ElementDefinition ed : sd.getDifferential().getElement())
|
||||
@ -147,10 +144,10 @@ public class R2ToR5Loader extends BaseLoader implements IContextResourceLoader,
|
||||
private void patchUrl(ElementDefinition ed) {
|
||||
for (TypeRefComponent tr : ed.getType()) {
|
||||
for (CanonicalType s : tr.getTargetProfile()) {
|
||||
s.setValue(s.getValue().replace("http://hl7.org/fhir/", "http://hl7.org/fhir/1.0/"));
|
||||
s.setValue(s.getValue().replace(URL_BASE, URL_DSTU2));
|
||||
}
|
||||
for (CanonicalType s : tr.getProfile()) {
|
||||
s.setValue(s.getValue().replace("http://hl7.org/fhir/", "http://hl7.org/fhir/1.0/"));
|
||||
s.setValue(s.getValue().replace(URL_BASE, URL_DSTU2));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -187,24 +184,6 @@ public class R2ToR5Loader extends BaseLoader implements IContextResourceLoader,
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isPatchUrls() {
|
||||
return patchUrls;
|
||||
}
|
||||
|
||||
public R2ToR5Loader setPatchUrls(boolean patchUrls) {
|
||||
this.patchUrls = patchUrls;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isKillPrimitives() {
|
||||
return killPrimitives;
|
||||
}
|
||||
|
||||
public R2ToR5Loader setKillPrimitives(boolean killPrimitives) {
|
||||
this.killPrimitives = killPrimitives;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.hl7.fhir.r4.model.Resource convertR4(org.hl7.fhir.r5.model.Resource resource) throws FHIRException {
|
||||
return null;
|
||||
|
@ -44,24 +44,19 @@ import org.hl7.fhir.dstu3.formats.XmlParser;
|
||||
import org.hl7.fhir.dstu3.model.Resource;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r4.context.SimpleWorkerContext.IContextResourceLoader;
|
||||
import org.hl7.fhir.r4.model.Bundle;
|
||||
import org.hl7.fhir.r4.model.*;
|
||||
import org.hl7.fhir.r4.model.Bundle.BundleEntryComponent;
|
||||
import org.hl7.fhir.r4.model.Bundle.BundleType;
|
||||
import org.hl7.fhir.r4.model.CanonicalType;
|
||||
import org.hl7.fhir.r4.model.CodeSystem;
|
||||
import org.hl7.fhir.r4.model.ElementDefinition;
|
||||
import org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent;
|
||||
import org.hl7.fhir.r4.model.MetadataResource;
|
||||
import org.hl7.fhir.r4.model.StructureDefinition;
|
||||
import org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind;
|
||||
import org.hl7.fhir.r4.model.UriType;
|
||||
import org.hl7.fhir.r4.model.ValueSet;
|
||||
|
||||
public class R3ToR4Loader implements IContextResourceLoader, VersionConvertorAdvisor40 {
|
||||
public class R3ToR4Loader extends BaseLoader implements IContextResourceLoader, VersionConvertorAdvisor40 {
|
||||
|
||||
private List<CodeSystem> cslist = new ArrayList<>();
|
||||
private boolean patchUrls;
|
||||
private boolean killPrimitives;;
|
||||
|
||||
public R3ToR4Loader() {
|
||||
super(new String[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Bundle loadBundle(InputStream stream, boolean isJson) throws FHIRException, IOException {
|
||||
@ -101,8 +96,8 @@ public class R3ToR4Loader implements IContextResourceLoader, VersionConvertorAdv
|
||||
for (BundleEntryComponent be : b.getEntry()) {
|
||||
if (be.hasResource() && be.getResource() instanceof StructureDefinition) {
|
||||
StructureDefinition sd = (StructureDefinition) be.getResource();
|
||||
sd.setUrl(sd.getUrl().replace("http://hl7.org/fhir/", "http://hl7.org/fhir/3.0/"));
|
||||
sd.addExtension().setUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").setValue(new UriType("http://hl7.org/fhir"));
|
||||
sd.setUrl(sd.getUrl().replace(URL_BASE, URL_DSTU3));
|
||||
sd.addExtension().setUrl(URL_ELEMENT_DEF_NAMESPACE).setValue(new UriType(URL_BASE));
|
||||
for (ElementDefinition ed : sd.getSnapshot().getElement())
|
||||
patchUrl(ed);
|
||||
for (ElementDefinition ed : sd.getDifferential().getElement())
|
||||
@ -116,10 +111,10 @@ public class R3ToR4Loader implements IContextResourceLoader, VersionConvertorAdv
|
||||
private void patchUrl(ElementDefinition ed) {
|
||||
for (TypeRefComponent tr : ed.getType()) {
|
||||
for (CanonicalType s : tr.getTargetProfile()) {
|
||||
s.setValue(s.getValue().replace("http://hl7.org/fhir/", "http://hl7.org/fhir/3.0/"));
|
||||
s.setValue(s.getValue().replace(URL_BASE, URL_DSTU3));
|
||||
}
|
||||
for (CanonicalType s : tr.getProfile()) {
|
||||
s.setValue(s.getValue().replace("http://hl7.org/fhir/", "http://hl7.org/fhir/3.0/"));
|
||||
s.setValue(s.getValue().replace(URL_BASE, URL_DSTU3));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -157,22 +152,4 @@ public class R3ToR4Loader implements IContextResourceLoader, VersionConvertorAdv
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isPatchUrls() {
|
||||
return patchUrls;
|
||||
}
|
||||
|
||||
public R3ToR4Loader setPatchUrls(boolean patchUrls) {
|
||||
this.patchUrls = patchUrls;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isKillPrimitives() {
|
||||
return killPrimitives;
|
||||
}
|
||||
|
||||
public R3ToR4Loader setKillPrimitives(boolean killPrimitives) {
|
||||
this.killPrimitives = killPrimitives;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
@ -64,8 +64,6 @@ public class R3ToR5Loader extends BaseLoader implements IContextResourceLoader,
|
||||
}
|
||||
|
||||
private List<CodeSystem> cslist = new ArrayList<>();
|
||||
private boolean patchUrls;
|
||||
private boolean killPrimitives;
|
||||
|
||||
@Override
|
||||
public Bundle loadBundle(InputStream stream, boolean isJson) throws FHIRException, IOException {
|
||||
@ -105,8 +103,8 @@ public class R3ToR5Loader extends BaseLoader implements IContextResourceLoader,
|
||||
for (BundleEntryComponent be : b.getEntry()) {
|
||||
if (be.hasResource() && be.getResource() instanceof StructureDefinition) {
|
||||
StructureDefinition sd = (StructureDefinition) be.getResource();
|
||||
sd.setUrl(sd.getUrl().replace("http://hl7.org/fhir/", "http://hl7.org/fhir/3.0/"));
|
||||
sd.addExtension().setUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").setValue(new UriType("http://hl7.org/fhir"));
|
||||
sd.setUrl(sd.getUrl().replace(URL_BASE, URL_DSTU3));
|
||||
sd.addExtension().setUrl(URL_ELEMENT_DEF_NAMESPACE).setValue(new UriType(URL_BASE));
|
||||
for (ElementDefinition ed : sd.getSnapshot().getElement())
|
||||
patchUrl(ed);
|
||||
for (ElementDefinition ed : sd.getDifferential().getElement())
|
||||
@ -134,8 +132,8 @@ public class R3ToR5Loader extends BaseLoader implements IContextResourceLoader,
|
||||
if (patchUrls) {
|
||||
if (r5 instanceof StructureDefinition) {
|
||||
StructureDefinition sd = (StructureDefinition) r5;
|
||||
sd.setUrl(sd.getUrl().replace("http://hl7.org/fhir/", "http://hl7.org/fhir/4.0/"));
|
||||
sd.addExtension().setUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").setValue(new UriType("http://hl7.org/fhir"));
|
||||
sd.setUrl(sd.getUrl().replace(URL_BASE, URL_R4));
|
||||
sd.addExtension().setUrl(URL_ELEMENT_DEF_NAMESPACE).setValue(new UriType(URL_BASE));
|
||||
for (ElementDefinition ed : sd.getSnapshot().getElement())
|
||||
patchUrl(ed);
|
||||
for (ElementDefinition ed : sd.getDifferential().getElement())
|
||||
@ -148,10 +146,10 @@ public class R3ToR5Loader extends BaseLoader implements IContextResourceLoader,
|
||||
private void patchUrl(ElementDefinition ed) {
|
||||
for (TypeRefComponent tr : ed.getType()) {
|
||||
for (CanonicalType s : tr.getTargetProfile()) {
|
||||
s.setValue(s.getValue().replace("http://hl7.org/fhir/", "http://hl7.org/fhir/3.0/"));
|
||||
s.setValue(s.getValue().replace(URL_BASE, URL_DSTU3));
|
||||
}
|
||||
for (CanonicalType s : tr.getProfile()) {
|
||||
s.setValue(s.getValue().replace("http://hl7.org/fhir/", "http://hl7.org/fhir/3.0/"));
|
||||
s.setValue(s.getValue().replace(URL_BASE, URL_DSTU3));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -189,27 +187,8 @@ public class R3ToR5Loader extends BaseLoader implements IContextResourceLoader,
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isPatchUrls() {
|
||||
return patchUrls;
|
||||
}
|
||||
|
||||
public R3ToR5Loader setPatchUrls(boolean patchUrls) {
|
||||
this.patchUrls = patchUrls;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isKillPrimitives() {
|
||||
return killPrimitives;
|
||||
}
|
||||
|
||||
public R3ToR5Loader setKillPrimitives(boolean killPrimitives) {
|
||||
this.killPrimitives = killPrimitives;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.hl7.fhir.r4.model.Resource convertR4(org.hl7.fhir.r5.model.Resource resource) throws FHIRException {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -64,8 +64,6 @@ public class R4ToR5Loader extends BaseLoader implements IContextResourceLoader,
|
||||
}
|
||||
|
||||
private List<CodeSystem> cslist = new ArrayList<>();
|
||||
private boolean patchUrls;
|
||||
private boolean killPrimitives;;
|
||||
|
||||
@Override
|
||||
public Bundle loadBundle(InputStream stream, boolean isJson) throws FHIRException, IOException {
|
||||
@ -105,8 +103,8 @@ public class R4ToR5Loader extends BaseLoader implements IContextResourceLoader,
|
||||
for (BundleEntryComponent be : b.getEntry()) {
|
||||
if (be.hasResource() && be.getResource() instanceof StructureDefinition) {
|
||||
StructureDefinition sd = (StructureDefinition) be.getResource();
|
||||
sd.setUrl(sd.getUrl().replace("http://hl7.org/fhir/", "http://hl7.org/fhir/4.0/"));
|
||||
sd.addExtension().setUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").setValue(new UriType("http://hl7.org/fhir"));
|
||||
sd.setUrl(sd.getUrl().replace(URL_BASE, URL_R4));
|
||||
sd.addExtension().setUrl(URL_ELEMENT_DEF_NAMESPACE).setValue(new UriType(URL_BASE));
|
||||
for (ElementDefinition ed : sd.getSnapshot().getElement())
|
||||
patchUrl(ed);
|
||||
for (ElementDefinition ed : sd.getDifferential().getElement())
|
||||
@ -117,7 +115,6 @@ public class R4ToR5Loader extends BaseLoader implements IContextResourceLoader,
|
||||
return b;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public org.hl7.fhir.r5.model.Resource loadResource(InputStream stream, boolean isJson) throws FHIRException, IOException {
|
||||
Resource r4 = null;
|
||||
@ -135,8 +132,8 @@ public class R4ToR5Loader extends BaseLoader implements IContextResourceLoader,
|
||||
if (patchUrls) {
|
||||
if (r5 instanceof StructureDefinition) {
|
||||
StructureDefinition sd = (StructureDefinition) r5;
|
||||
sd.setUrl(sd.getUrl().replace("http://hl7.org/fhir/", "http://hl7.org/fhir/4.0/"));
|
||||
sd.addExtension().setUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").setValue(new UriType("http://hl7.org/fhir"));
|
||||
sd.setUrl(sd.getUrl().replace(URL_BASE, "http://hl7.org/fhir/4.0/"));
|
||||
sd.addExtension().setUrl(URL_ELEMENT_DEF_NAMESPACE).setValue(new UriType("http://hl7.org/fhir"));
|
||||
for (ElementDefinition ed : sd.getSnapshot().getElement())
|
||||
patchUrl(ed);
|
||||
for (ElementDefinition ed : sd.getDifferential().getElement())
|
||||
@ -149,10 +146,10 @@ public class R4ToR5Loader extends BaseLoader implements IContextResourceLoader,
|
||||
private void patchUrl(ElementDefinition ed) {
|
||||
for (TypeRefComponent tr : ed.getType()) {
|
||||
for (CanonicalType s : tr.getTargetProfile()) {
|
||||
s.setValue(s.getValue().replace("http://hl7.org/fhir/", "http://hl7.org/fhir/4.0/"));
|
||||
s.setValue(s.getValue().replace(URL_BASE, "http://hl7.org/fhir/4.0/"));
|
||||
}
|
||||
for (CanonicalType s : tr.getProfile()) {
|
||||
s.setValue(s.getValue().replace("http://hl7.org/fhir/", "http://hl7.org/fhir/4.0/"));
|
||||
s.setValue(s.getValue().replace(URL_BASE, "http://hl7.org/fhir/4.0/"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -190,24 +187,6 @@ public class R4ToR5Loader extends BaseLoader implements IContextResourceLoader,
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isPatchUrls() {
|
||||
return patchUrls;
|
||||
}
|
||||
|
||||
public R4ToR5Loader setPatchUrls(boolean patchUrls) {
|
||||
this.patchUrls = patchUrls;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isKillPrimitives() {
|
||||
return killPrimitives;
|
||||
}
|
||||
|
||||
public R4ToR5Loader setKillPrimitives(boolean killPrimitives) {
|
||||
this.killPrimitives = killPrimitives;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.hl7.fhir.dstu3.model.Resource convertR3(org.hl7.fhir.r5.model.Resource resource) throws FHIRException {
|
||||
return null;
|
||||
|
@ -63,8 +63,6 @@ public class R5ToR5Loader extends BaseLoader implements IContextResourceLoader,
|
||||
}
|
||||
|
||||
private List<CodeSystem> cslist = new ArrayList<>();
|
||||
private boolean patchUrls;
|
||||
private boolean killPrimitives;;
|
||||
|
||||
@Override
|
||||
public Bundle loadBundle(InputStream stream, boolean isJson) throws FHIRException, IOException {
|
||||
@ -103,8 +101,8 @@ public class R5ToR5Loader extends BaseLoader implements IContextResourceLoader,
|
||||
for (BundleEntryComponent be : b.getEntry()) {
|
||||
if (be.hasResource() && be.getResource() instanceof StructureDefinition) {
|
||||
StructureDefinition sd = (StructureDefinition) be.getResource();
|
||||
sd.setUrl(sd.getUrl().replace("http://hl7.org/fhir/", "http://hl7.org/fhir/4.0/"));
|
||||
sd.addExtension().setUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").setValue(new UriType("http://hl7.org/fhir"));
|
||||
sd.setUrl(sd.getUrl().replace(URL_BASE, URL_R4));
|
||||
sd.addExtension().setUrl(URL_ELEMENT_DEF_NAMESPACE).setValue(new UriType(URL_BASE));
|
||||
for (ElementDefinition ed : sd.getSnapshot().getElement())
|
||||
patchUrl(ed);
|
||||
for (ElementDefinition ed : sd.getDifferential().getElement())
|
||||
@ -132,8 +130,8 @@ public class R5ToR5Loader extends BaseLoader implements IContextResourceLoader,
|
||||
if (patchUrls) {
|
||||
if (r5 instanceof StructureDefinition) {
|
||||
StructureDefinition sd = (StructureDefinition) r5;
|
||||
sd.setUrl(sd.getUrl().replace("http://hl7.org/fhir/", "http://hl7.org/fhir/4.0/"));
|
||||
sd.addExtension().setUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").setValue(new UriType("http://hl7.org/fhir"));
|
||||
sd.setUrl(sd.getUrl().replace(URL_BASE, URL_R4));
|
||||
sd.addExtension().setUrl(URL_ELEMENT_DEF_NAMESPACE).setValue(new UriType(URL_BASE));
|
||||
for (ElementDefinition ed : sd.getSnapshot().getElement())
|
||||
patchUrl(ed);
|
||||
for (ElementDefinition ed : sd.getDifferential().getElement())
|
||||
@ -143,14 +141,13 @@ public class R5ToR5Loader extends BaseLoader implements IContextResourceLoader,
|
||||
return r5;
|
||||
}
|
||||
|
||||
|
||||
private void patchUrl(ElementDefinition ed) {
|
||||
for (TypeRefComponent tr : ed.getType()) {
|
||||
for (CanonicalType s : tr.getTargetProfile()) {
|
||||
s.setValue(s.getValue().replace("http://hl7.org/fhir/", "http://hl7.org/fhir/4.0/"));
|
||||
s.setValue(s.getValue().replace(URL_BASE, URL_R4));
|
||||
}
|
||||
for (CanonicalType s : tr.getProfile()) {
|
||||
s.setValue(s.getValue().replace("http://hl7.org/fhir/", "http://hl7.org/fhir/4.0/"));
|
||||
s.setValue(s.getValue().replace(URL_BASE, URL_R4));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -188,24 +185,6 @@ public class R5ToR5Loader extends BaseLoader implements IContextResourceLoader,
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isPatchUrls() {
|
||||
return patchUrls;
|
||||
}
|
||||
|
||||
public R5ToR5Loader setPatchUrls(boolean patchUrls) {
|
||||
this.patchUrls = patchUrls;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isKillPrimitives() {
|
||||
return killPrimitives;
|
||||
}
|
||||
|
||||
public R5ToR5Loader setKillPrimitives(boolean killPrimitives) {
|
||||
this.killPrimitives = killPrimitives;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.hl7.fhir.dstu3.model.Resource convertR3(org.hl7.fhir.r5.model.Resource resource) throws FHIRException {
|
||||
return null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user