Move ignore extension logic in 10_30 convertors
This commit is contained in:
parent
5f18101686
commit
9ca316bb2f
|
@ -10,8 +10,6 @@ import org.hl7.fhir.convertors.advisors.interfaces.BaseAdvisor30;
|
||||||
|
|
||||||
public class BaseAdvisor_10_30 extends BaseAdvisor30<org.hl7.fhir.dstu2.model.Extension> {
|
public class BaseAdvisor_10_30 extends BaseAdvisor30<org.hl7.fhir.dstu2.model.Extension> {
|
||||||
|
|
||||||
private final List<String> ignoredUrls = new ArrayList<>(Collections.singletonList("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"));
|
|
||||||
|
|
||||||
public BaseAdvisor_10_30() {
|
public BaseAdvisor_10_30() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +19,7 @@ public class BaseAdvisor_10_30 extends BaseAdvisor30<org.hl7.fhir.dstu2.model.Ex
|
||||||
|
|
||||||
public boolean ignoreExtension(@Nonnull String path,
|
public boolean ignoreExtension(@Nonnull String path,
|
||||||
@Nonnull String url) {
|
@Nonnull String url) {
|
||||||
return this.ignoredUrls.contains(url);
|
// no globally ignored extensions here.
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,14 +113,19 @@ public class VersionConvertor_10_30 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void copyDomainResource(@Nonnull org.hl7.fhir.dstu2.model.DomainResource src,
|
public void copyDomainResource(
|
||||||
@Nonnull org.hl7.fhir.dstu3.model.DomainResource tgt) throws FHIRException {
|
@Nonnull org.hl7.fhir.dstu2.model.DomainResource src,
|
||||||
resourceConvertor.copyDomainResource(src, tgt);
|
@Nonnull org.hl7.fhir.dstu3.model.DomainResource tgt,
|
||||||
|
String ... extensionUrlsToIgnore
|
||||||
|
) throws FHIRException {
|
||||||
|
resourceConvertor.copyDomainResource(src, tgt,extensionUrlsToIgnore);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void copyDomainResource(@Nonnull org.hl7.fhir.dstu3.model.DomainResource src,
|
public void copyDomainResource(
|
||||||
@Nonnull org.hl7.fhir.dstu2.model.DomainResource tgt) throws FHIRException {
|
@Nonnull org.hl7.fhir.dstu3.model.DomainResource src,
|
||||||
resourceConvertor.copyDomainResource(src, tgt);
|
@Nonnull org.hl7.fhir.dstu2.model.DomainResource tgt,
|
||||||
|
String ... extensionUrlsToIgnore) throws FHIRException {
|
||||||
|
resourceConvertor.copyDomainResource(src, tgt, extensionUrlsToIgnore);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void copyElement(@Nonnull org.hl7.fhir.dstu2.model.Element src,
|
public void copyElement(@Nonnull org.hl7.fhir.dstu2.model.Element src,
|
||||||
|
|
|
@ -6,6 +6,8 @@ import org.hl7.fhir.convertors.conv10_30.datatypes10_30.Meta10_30;
|
||||||
import org.hl7.fhir.convertors.conv10_30.datatypes10_30.Narrative10_30;
|
import org.hl7.fhir.convertors.conv10_30.datatypes10_30.Narrative10_30;
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
public class Resource10_30 {
|
public class Resource10_30 {
|
||||||
|
|
||||||
public final BaseAdvisor_10_30 advisor;
|
public final BaseAdvisor_10_30 advisor;
|
||||||
|
@ -14,26 +16,34 @@ public class Resource10_30 {
|
||||||
this.advisor = advisor;
|
this.advisor = advisor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void copyDomainResource(org.hl7.fhir.dstu2.model.DomainResource src,
|
public void copyDomainResource(
|
||||||
org.hl7.fhir.dstu3.model.DomainResource tgt) throws FHIRException {
|
org.hl7.fhir.dstu2.model.DomainResource src,
|
||||||
|
org.hl7.fhir.dstu3.model.DomainResource tgt,
|
||||||
|
String ... extensionUrlsToIgnore) throws FHIRException {
|
||||||
copyResource(src, tgt);
|
copyResource(src, tgt);
|
||||||
tgt.setText(Narrative10_30.convertNarrative(src.getText()));
|
tgt.setText(Narrative10_30.convertNarrative(src.getText()));
|
||||||
for (org.hl7.fhir.dstu2.model.Resource t : src.getContained()) tgt.addContained(convertResource(t));
|
for (org.hl7.fhir.dstu2.model.Resource containedResource : src.getContained()) tgt.addContained(convertResource(containedResource));
|
||||||
for (org.hl7.fhir.dstu2.model.Extension t : src.getExtension())
|
for (org.hl7.fhir.dstu2.model.Extension extension : src.getExtension())
|
||||||
tgt.addExtension(Extension10_30.convertExtension(t));
|
if (!Arrays.asList(extensionUrlsToIgnore).contains(extension.getUrl()))
|
||||||
for (org.hl7.fhir.dstu2.model.Extension t : src.getModifierExtension())
|
tgt.addExtension(Extension10_30.convertExtension(extension));
|
||||||
tgt.addModifierExtension(Extension10_30.convertExtension(t));
|
|
||||||
|
for (org.hl7.fhir.dstu2.model.Extension modifierExtension : src.getModifierExtension())
|
||||||
|
tgt.addModifierExtension(Extension10_30.convertExtension(modifierExtension));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void copyDomainResource(org.hl7.fhir.dstu3.model.DomainResource src,
|
public void copyDomainResource(
|
||||||
org.hl7.fhir.dstu2.model.DomainResource tgt) throws FHIRException {
|
org.hl7.fhir.dstu3.model.DomainResource src,
|
||||||
|
org.hl7.fhir.dstu2.model.DomainResource tgt,
|
||||||
|
String ... extensionUrlsToIgnore
|
||||||
|
) throws FHIRException {
|
||||||
copyResource(src, tgt);
|
copyResource(src, tgt);
|
||||||
tgt.setText(Narrative10_30.convertNarrative(src.getText()));
|
tgt.setText(Narrative10_30.convertNarrative(src.getText()));
|
||||||
for (org.hl7.fhir.dstu3.model.Resource t : src.getContained()) tgt.addContained(convertResource(t));
|
for (org.hl7.fhir.dstu3.model.Resource containedResource : src.getContained()) tgt.addContained(convertResource(containedResource));
|
||||||
for (org.hl7.fhir.dstu3.model.Extension t : src.getExtension())
|
for (org.hl7.fhir.dstu3.model.Extension extension : src.getExtension())
|
||||||
tgt.addExtension(Extension10_30.convertExtension(t));
|
if (!Arrays.asList(extensionUrlsToIgnore).contains(extension.getUrl()))
|
||||||
for (org.hl7.fhir.dstu3.model.Extension t : src.getModifierExtension())
|
tgt.addExtension(Extension10_30.convertExtension(extension));
|
||||||
tgt.addModifierExtension(Extension10_30.convertExtension(t));
|
for (org.hl7.fhir.dstu3.model.Extension modifierExtension : src.getModifierExtension())
|
||||||
|
tgt.addModifierExtension(Extension10_30.convertExtension(modifierExtension));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void copyResource(org.hl7.fhir.dstu2.model.Resource src, org.hl7.fhir.dstu3.model.Resource tgt) throws FHIRException {
|
public void copyResource(org.hl7.fhir.dstu2.model.Resource src, org.hl7.fhir.dstu3.model.Resource tgt) throws FHIRException {
|
||||||
|
|
Loading…
Reference in New Issue