Move ignore extension logic in 14_30 convertors
This commit is contained in:
parent
9a70ebb2c9
commit
bcef732576
|
@ -10,8 +10,6 @@ import org.hl7.fhir.convertors.advisors.interfaces.BaseAdvisor30;
|
|||
|
||||
public class BaseAdvisor_14_30 extends BaseAdvisor30<org.hl7.fhir.dstu2016may.model.Extension> {
|
||||
|
||||
private final List<String> ignoredUrls = new ArrayList<>(Collections.singletonList("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"));
|
||||
|
||||
public BaseAdvisor_14_30() {
|
||||
}
|
||||
|
||||
|
@ -22,6 +20,7 @@ public class BaseAdvisor_14_30 extends BaseAdvisor30<org.hl7.fhir.dstu2016may.mo
|
|||
@Override
|
||||
public boolean ignoreExtension(@Nonnull String path,
|
||||
@Nonnull String url) {
|
||||
return this.ignoredUrls.contains(url);
|
||||
// no globally ignored extensions here.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,14 +113,18 @@ public class VersionConvertor_14_30 {
|
|||
}
|
||||
}
|
||||
|
||||
public void copyDomainResource(@Nonnull org.hl7.fhir.dstu2016may.model.DomainResource src,
|
||||
@Nonnull org.hl7.fhir.dstu3.model.DomainResource tgt) throws FHIRException {
|
||||
resourceConvertor.copyDomainResource(src, tgt);
|
||||
public void copyDomainResource(
|
||||
@Nonnull org.hl7.fhir.dstu2016may.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.dstu2016may.model.DomainResource tgt) throws FHIRException {
|
||||
resourceConvertor.copyDomainResource(src, tgt);
|
||||
public void copyDomainResource(
|
||||
@Nonnull org.hl7.fhir.dstu3.model.DomainResource src,
|
||||
@Nonnull org.hl7.fhir.dstu2016may.model.DomainResource tgt,
|
||||
String... extensionUrlsToIgnore) throws FHIRException {
|
||||
resourceConvertor.copyDomainResource(src, tgt, extensionUrlsToIgnore);
|
||||
}
|
||||
|
||||
public void copyElement(@Nonnull org.hl7.fhir.dstu2016may.model.Element src,
|
||||
|
|
|
@ -7,6 +7,8 @@ import org.hl7.fhir.convertors.conv14_30.datatypes14_30.Meta14_30;
|
|||
import org.hl7.fhir.convertors.conv14_30.datatypes14_30.Narrative14_30;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class Resource14_30 {
|
||||
|
||||
public final BaseAdvisor_14_30 advisor;
|
||||
|
@ -115,8 +117,10 @@ public class Resource14_30 {
|
|||
}
|
||||
}
|
||||
|
||||
public void copyDomainResource(org.hl7.fhir.dstu2016may.model.DomainResource src,
|
||||
org.hl7.fhir.dstu3.model.DomainResource tgt) throws FHIRException {
|
||||
public void copyDomainResource(
|
||||
org.hl7.fhir.dstu2016may.model.DomainResource src,
|
||||
org.hl7.fhir.dstu3.model.DomainResource tgt,
|
||||
String... extensionUrlsToIgnore) throws FHIRException {
|
||||
copyResource(src, tgt);
|
||||
if (src.hasText()) tgt.setText(Narrative14_30.convertNarrative(src.getText()));
|
||||
src.getContained().stream()
|
||||
|
@ -127,7 +131,7 @@ public class Resource14_30 {
|
|||
org.hl7.fhir.dstu3.model.Extension convertExtension = new org.hl7.fhir.dstu3.model.Extension();
|
||||
advisor.handleExtension(ConversionContext14_30.INSTANCE.path(), extension, convertExtension);
|
||||
tgt.addExtension(convertExtension);
|
||||
} else if (!advisor.ignoreExtension(ConversionContext14_30.INSTANCE.path(), extension)) {
|
||||
} else if (!advisor.ignoreExtension(ConversionContext14_30.INSTANCE.path(), extension) && !Arrays.asList(extensionUrlsToIgnore).contains(extension.getUrl())) {
|
||||
tgt.addExtension(Extension14_30.convertExtension(extension));
|
||||
}
|
||||
});
|
||||
|
@ -137,8 +141,11 @@ public class Resource14_30 {
|
|||
.forEach(tgt::addModifierExtension);
|
||||
}
|
||||
|
||||
public void copyDomainResource(org.hl7.fhir.dstu3.model.DomainResource src,
|
||||
org.hl7.fhir.dstu2016may.model.DomainResource tgt) throws FHIRException {
|
||||
public void copyDomainResource(
|
||||
org.hl7.fhir.dstu3.model.DomainResource src,
|
||||
org.hl7.fhir.dstu2016may.model.DomainResource tgt,
|
||||
String... extensionUrlsToIgnore) throws FHIRException {
|
||||
|
||||
copyResource(src, tgt);
|
||||
if (src.hasText()) tgt.setText(Narrative14_30.convertNarrative(src.getText()));
|
||||
src.getContained().stream()
|
||||
|
@ -149,7 +156,7 @@ public class Resource14_30 {
|
|||
org.hl7.fhir.dstu2016may.model.Extension convertExtension = new org.hl7.fhir.dstu2016may.model.Extension();
|
||||
advisor.handleExtension(ConversionContext14_30.INSTANCE.path(), extension, convertExtension);
|
||||
tgt.addExtension(convertExtension);
|
||||
} else if (!advisor.ignoreExtension(ConversionContext14_30.INSTANCE.path(), extension)) {
|
||||
} else if (!advisor.ignoreExtension(ConversionContext14_30.INSTANCE.path(), extension) && !Arrays.asList(extensionUrlsToIgnore).contains(extension.getUrl())) {
|
||||
tgt.addExtension(Extension14_30.convertExtension(extension));
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue