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> {
|
||||
|
||||
private final List<String> ignoredUrls = new ArrayList<>(Collections.singletonList("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"));
|
||||
|
||||
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,
|
||||
@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,
|
||||
@Nonnull org.hl7.fhir.dstu3.model.DomainResource tgt) throws FHIRException {
|
||||
resourceConvertor.copyDomainResource(src, tgt);
|
||||
public void copyDomainResource(
|
||||
@Nonnull org.hl7.fhir.dstu2.model.DomainResource src,
|
||||
@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,
|
||||
@Nonnull org.hl7.fhir.dstu2.model.DomainResource tgt) throws FHIRException {
|
||||
resourceConvertor.copyDomainResource(src, tgt);
|
||||
public void copyDomainResource(
|
||||
@Nonnull org.hl7.fhir.dstu3.model.DomainResource src,
|
||||
@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,
|
||||
|
|
|
@ -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.exceptions.FHIRException;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class Resource10_30 {
|
||||
|
||||
public final BaseAdvisor_10_30 advisor;
|
||||
|
@ -14,26 +16,34 @@ public class Resource10_30 {
|
|||
this.advisor = advisor;
|
||||
}
|
||||
|
||||
public void copyDomainResource(org.hl7.fhir.dstu2.model.DomainResource src,
|
||||
org.hl7.fhir.dstu3.model.DomainResource tgt) throws FHIRException {
|
||||
public void copyDomainResource(
|
||||
org.hl7.fhir.dstu2.model.DomainResource src,
|
||||
org.hl7.fhir.dstu3.model.DomainResource tgt,
|
||||
String ... extensionUrlsToIgnore) throws FHIRException {
|
||||
copyResource(src, tgt);
|
||||
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.Extension t : src.getExtension())
|
||||
tgt.addExtension(Extension10_30.convertExtension(t));
|
||||
for (org.hl7.fhir.dstu2.model.Extension t : src.getModifierExtension())
|
||||
tgt.addModifierExtension(Extension10_30.convertExtension(t));
|
||||
for (org.hl7.fhir.dstu2.model.Resource containedResource : src.getContained()) tgt.addContained(convertResource(containedResource));
|
||||
for (org.hl7.fhir.dstu2.model.Extension extension : src.getExtension())
|
||||
if (!Arrays.asList(extensionUrlsToIgnore).contains(extension.getUrl()))
|
||||
tgt.addExtension(Extension10_30.convertExtension(extension));
|
||||
|
||||
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,
|
||||
org.hl7.fhir.dstu2.model.DomainResource tgt) throws FHIRException {
|
||||
public void copyDomainResource(
|
||||
org.hl7.fhir.dstu3.model.DomainResource src,
|
||||
org.hl7.fhir.dstu2.model.DomainResource tgt,
|
||||
String ... extensionUrlsToIgnore
|
||||
) throws FHIRException {
|
||||
copyResource(src, tgt);
|
||||
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.Extension t : src.getExtension())
|
||||
tgt.addExtension(Extension10_30.convertExtension(t));
|
||||
for (org.hl7.fhir.dstu3.model.Extension t : src.getModifierExtension())
|
||||
tgt.addModifierExtension(Extension10_30.convertExtension(t));
|
||||
for (org.hl7.fhir.dstu3.model.Resource containedResource : src.getContained()) tgt.addContained(convertResource(containedResource));
|
||||
for (org.hl7.fhir.dstu3.model.Extension extension : src.getExtension())
|
||||
if (!Arrays.asList(extensionUrlsToIgnore).contains(extension.getUrl()))
|
||||
tgt.addExtension(Extension10_30.convertExtension(extension));
|
||||
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 {
|
||||
|
|
Loading…
Reference in New Issue