Move ignore extension logic in 40_50 convertors

This commit is contained in:
dotasek 2023-05-01 15:58:38 -04:00
parent 9b1d46f488
commit 3e5a63e0f2
5 changed files with 203 additions and 120 deletions

View File

@ -34,11 +34,8 @@ public class BaseAdvisor_40_50 extends BaseAdvisor50<org.hl7.fhir.r4.model.Exten
final String lastPath = paths.get(paths.size() - 1); final String lastPath = paths.get(paths.size() - 1);
if ((lastPath.equals("TestScript")) && (TestScriptIgnoredUrls.contains(url))) { if ((lastPath.equals("TestScript")) && (TestScriptIgnoredUrls.contains(url))) {
return true; return true;
} else if (lastPath.equals("Basic") && url.startsWith("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.")) { }
return true; else
} else if (lastPath.equals("Basic") && url.startsWith("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.")) {
return true;
} else
return false; return false;
} }

View File

@ -108,13 +108,13 @@ public class VersionConvertor_40_50 {
} }
public void copyDomainResource(@Nonnull org.hl7.fhir.r4.model.DomainResource src, public void copyDomainResource(@Nonnull org.hl7.fhir.r4.model.DomainResource src,
@Nonnull org.hl7.fhir.r5.model.DomainResource tgt) throws FHIRException { @Nonnull org.hl7.fhir.r5.model.DomainResource tgt, String... ignoredExtensionUrls) throws FHIRException {
resourceConvertor.copyDomainResource(src, tgt); resourceConvertor.copyDomainResource(src, tgt, ignoredExtensionUrls);
} }
public void copyDomainResource(@Nonnull org.hl7.fhir.r5.model.DomainResource src, public void copyDomainResource(@Nonnull org.hl7.fhir.r5.model.DomainResource src,
@Nonnull org.hl7.fhir.r4.model.DomainResource tgt) throws FHIRException { @Nonnull org.hl7.fhir.r4.model.DomainResource tgt, String... ignoredExtensionUrls) throws FHIRException {
resourceConvertor.copyDomainResource(src, tgt); resourceConvertor.copyDomainResource(src, tgt, ignoredExtensionUrls);
} }
public void copyElement(@Nonnull org.hl7.fhir.r4.model.Element src, public void copyElement(@Nonnull org.hl7.fhir.r4.model.Element src,

View File

@ -52,6 +52,50 @@ import org.hl7.fhir.r5.model.UsageContext;
// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 // Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
public class ActorDefinition40_50 { public class ActorDefinition40_50 {
public static final String URL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.url";
public static final String VERSION_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.version";
public static final String NAME_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.name";
public static final String TITLE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.title";
public static final String STATUS_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.status";
public static final String EXPERIMENTAL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.experimental";
public static final String DATE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.date";
public static final String PUBLISHER_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.publisher";
public static final String CONTACT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.contact";
public static final String DESCRIPTION_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.description";
public static final String USE_CONTEXT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.useContext";
public static final String JURISDICTION_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.jurisdiction";
public static final String PURPOSE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.purpose";
public static final String COPYRIGHT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.copyright";
public static final String COPYRIGHT_LABEL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.copyrightLabel";
public static final String TYPE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.type";
public static final String DOCUMENTATION_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.documentation";
public static final String REFERENCE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.reference";
public static final String CAPABILITIES_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.capabilities";
public static final String DERIVED_FROM_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.derivedFrom";
private static final String[] IGNORED_EXTENSION_URLS = new String[]{
URL_EXTENSION_URL,
VERSION_EXTENSION_URL,
NAME_EXTENSION_URL,
TITLE_EXTENSION_URL,
STATUS_EXTENSION_URL,
EXPERIMENTAL_EXTENSION_URL,
DATE_EXTENSION_URL,
PUBLISHER_EXTENSION_URL,
CONTACT_EXTENSION_URL,
DESCRIPTION_EXTENSION_URL,
USE_CONTEXT_EXTENSION_URL,
JURISDICTION_EXTENSION_URL,
PURPOSE_EXTENSION_URL,
COPYRIGHT_EXTENSION_URL,
COPYRIGHT_LABEL_EXTENSION_URL,
TYPE_EXTENSION_URL,
DOCUMENTATION_EXTENSION_URL,
REFERENCE_EXTENSION_URL,
CAPABILITIES_EXTENSION_URL,
DERIVED_FROM_EXTENSION_URL
};
public static org.hl7.fhir.r5.model.ActorDefinition convertActorDefinition(org.hl7.fhir.r4.model.Basic src) throws FHIRException { public static org.hl7.fhir.r5.model.ActorDefinition convertActorDefinition(org.hl7.fhir.r4.model.Basic src) throws FHIRException {
if (src == null) if (src == null)
return null; return null;
@ -59,70 +103,70 @@ public class ActorDefinition40_50 {
throw new FHIRException("Error in logic: this basic resource is not an ActorDefinition"); throw new FHIRException("Error in logic: this basic resource is not an ActorDefinition");
} }
org.hl7.fhir.r5.model.ActorDefinition tgt = new org.hl7.fhir.r5.model.ActorDefinition(); org.hl7.fhir.r5.model.ActorDefinition tgt = new org.hl7.fhir.r5.model.ActorDefinition();
//FIXME add ignore
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt); ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt, IGNORED_EXTENSION_URLS);
for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
tgt.addIdentifier(Identifier40_50.convertIdentifier(t)); tgt.addIdentifier(Identifier40_50.convertIdentifier(t));
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.url")) { if (src.hasExtension(URL_EXTENSION_URL)) {
tgt.setUrlElement(Uri40_50.convertUri((org.hl7.fhir.r4.model.UriType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.url").getValue())); tgt.setUrlElement(Uri40_50.convertUri((org.hl7.fhir.r4.model.UriType) src.getExtensionByUrl(URL_EXTENSION_URL).getValue()));
} }
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.version")) { if (src.hasExtension(VERSION_EXTENSION_URL)) {
tgt.setVersionElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.version").getValue())); tgt.setVersionElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl(VERSION_EXTENSION_URL).getValue()));
} }
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.name")) { if (src.hasExtension(NAME_EXTENSION_URL)) {
tgt.setNameElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.name").getValue())); tgt.setNameElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl(NAME_EXTENSION_URL).getValue()));
} }
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.title")) { if (src.hasExtension(TITLE_EXTENSION_URL)) {
tgt.setTitleElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.title").getValue())); tgt.setTitleElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl(TITLE_EXTENSION_URL).getValue()));
} }
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.status")) { if (src.hasExtension(STATUS_EXTENSION_URL)) {
tgt.setStatus(PublicationStatus.fromCode(src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.status").getValue().primitiveValue())); tgt.setStatus(PublicationStatus.fromCode(src.getExtensionByUrl(STATUS_EXTENSION_URL).getValue().primitiveValue()));
} }
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.experimental")) { if (src.hasExtension(EXPERIMENTAL_EXTENSION_URL)) {
tgt.setExperimentalElement(Boolean40_50.convertBoolean((org.hl7.fhir.r4.model.BooleanType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.experimental").getValue())); tgt.setExperimentalElement(Boolean40_50.convertBoolean((org.hl7.fhir.r4.model.BooleanType) src.getExtensionByUrl(EXPERIMENTAL_EXTENSION_URL).getValue()));
} }
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.date")) { if (src.hasExtension(DATE_EXTENSION_URL)) {
tgt.setDateElement(DateTime40_50.convertDateTime((org.hl7.fhir.r4.model.DateTimeType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.date").getValue())); tgt.setDateElement(DateTime40_50.convertDateTime((org.hl7.fhir.r4.model.DateTimeType) src.getExtensionByUrl(DATE_EXTENSION_URL).getValue()));
} }
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.publisher")) { if (src.hasExtension(PUBLISHER_EXTENSION_URL)) {
tgt.setPublisherElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.publisher").getValue())); tgt.setPublisherElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl(PUBLISHER_EXTENSION_URL).getValue()));
} }
for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.contact")) { for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl(CONTACT_EXTENSION_URL)) {
tgt.addContact(ContactDetail40_50.convertContactDetail((org.hl7.fhir.r4.model.ContactDetail) ext.getValue())); tgt.addContact(ContactDetail40_50.convertContactDetail((org.hl7.fhir.r4.model.ContactDetail) ext.getValue()));
} }
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.description")) { if (src.hasExtension(DESCRIPTION_EXTENSION_URL)) {
tgt.setPublisherElement(MarkDown40_50.convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.description").getValue())); tgt.setPublisherElement(MarkDown40_50.convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src.getExtensionByUrl(DESCRIPTION_EXTENSION_URL).getValue()));
} }
for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.useContext")) { for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl(USE_CONTEXT_EXTENSION_URL)) {
tgt.addUseContext(UsageContext40_50.convertUsageContext((org.hl7.fhir.r4.model.UsageContext) ext.getValue())); tgt.addUseContext(UsageContext40_50.convertUsageContext((org.hl7.fhir.r4.model.UsageContext) ext.getValue()));
} }
for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.jurisdiction")) { for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl(JURISDICTION_EXTENSION_URL)) {
tgt.addJurisdiction(CodeableConcept40_50.convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) ext.getValue())); tgt.addJurisdiction(CodeableConcept40_50.convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) ext.getValue()));
} }
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.purpose")) { if (src.hasExtension(PURPOSE_EXTENSION_URL)) {
tgt.setPurposeElement(MarkDown40_50.convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.purpose").getValue())); tgt.setPurposeElement(MarkDown40_50.convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src.getExtensionByUrl(PURPOSE_EXTENSION_URL).getValue()));
} }
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.copyright")) { if (src.hasExtension(COPYRIGHT_EXTENSION_URL)) {
tgt.setCopyrightElement(MarkDown40_50.convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.copyright").getValue())); tgt.setCopyrightElement(MarkDown40_50.convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src.getExtensionByUrl(COPYRIGHT_EXTENSION_URL).getValue()));
} }
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.copyrightLabel")) { if (src.hasExtension(COPYRIGHT_LABEL_EXTENSION_URL)) {
tgt.setCopyrightLabelElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.copyrightLabel").getValue())); tgt.setCopyrightLabelElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl(COPYRIGHT_LABEL_EXTENSION_URL).getValue()));
} }
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.type")) { if (src.hasExtension(TYPE_EXTENSION_URL)) {
tgt.setType(ExampleScenarioActorType.fromCode(src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.type").getValue().primitiveValue())); tgt.setType(ExampleScenarioActorType.fromCode(src.getExtensionByUrl(TYPE_EXTENSION_URL).getValue().primitiveValue()));
} }
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.documentation")) { if (src.hasExtension(DOCUMENTATION_EXTENSION_URL)) {
tgt.setDocumentationElement(MarkDown40_50.convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.documentation").getValue())); tgt.setDocumentationElement(MarkDown40_50.convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src.getExtensionByUrl(DOCUMENTATION_EXTENSION_URL).getValue()));
} }
for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.reference")) { for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl(REFERENCE_EXTENSION_URL)) {
tgt.getReference().add(Url40_50.convertUrl((org.hl7.fhir.r4.model.UrlType) ext.getValue())); tgt.getReference().add(Url40_50.convertUrl((org.hl7.fhir.r4.model.UrlType) ext.getValue()));
} }
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.capabilities")) { if (src.hasExtension(CAPABILITIES_EXTENSION_URL)) {
tgt.setCapabilitiesElement(Canonical40_50.convertCanonical((org.hl7.fhir.r4.model.CanonicalType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.capabilities").getValue())); tgt.setCapabilitiesElement(Canonical40_50.convertCanonical((org.hl7.fhir.r4.model.CanonicalType) src.getExtensionByUrl(CAPABILITIES_EXTENSION_URL).getValue()));
} }
for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.derivedFrom")) { for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl(DERIVED_FROM_EXTENSION_URL)) {
tgt.getDerivedFrom().add(Canonical40_50.convertCanonical((org.hl7.fhir.r4.model.CanonicalType) ext.getValue())); tgt.getDerivedFrom().add(Canonical40_50.convertCanonical((org.hl7.fhir.r4.model.CanonicalType) ext.getValue()));
} }
return tgt; return tgt;
@ -138,64 +182,64 @@ public class ActorDefinition40_50 {
for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
tgt.addIdentifier(Identifier40_50.convertIdentifier(t)); tgt.addIdentifier(Identifier40_50.convertIdentifier(t));
if (src.hasUrl()) { if (src.hasUrl()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.url", Uri40_50.convertUri(src.getUrlElement())); tgt.addExtension(URL_EXTENSION_URL, Uri40_50.convertUri(src.getUrlElement()));
} }
if (src.hasVersion()) { if (src.hasVersion()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.version", String40_50.convertString(src.getVersionElement())); tgt.addExtension(VERSION_EXTENSION_URL, String40_50.convertString(src.getVersionElement()));
} }
if (src.hasName()) { if (src.hasName()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.name", String40_50.convertString(src.getNameElement())); tgt.addExtension(NAME_EXTENSION_URL, String40_50.convertString(src.getNameElement()));
} }
if (src.hasTitle()) { if (src.hasTitle()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.title", String40_50.convertString(src.getTitleElement())); tgt.addExtension(TITLE_EXTENSION_URL, String40_50.convertString(src.getTitleElement()));
} }
if (src.hasStatus()) { if (src.hasStatus()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.status", new org.hl7.fhir.r4.model.CodeType(src.getStatus().toCode())); tgt.addExtension(STATUS_EXTENSION_URL, new org.hl7.fhir.r4.model.CodeType(src.getStatus().toCode()));
} }
if (src.hasExperimental()) { if (src.hasExperimental()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.experimental", Boolean40_50.convertBoolean(src.getExperimentalElement())); tgt.addExtension(EXPERIMENTAL_EXTENSION_URL, Boolean40_50.convertBoolean(src.getExperimentalElement()));
} }
if (src.hasDate()) { if (src.hasDate()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.date", DateTime40_50.convertDateTime(src.getDateElement())); tgt.addExtension(DATE_EXTENSION_URL, DateTime40_50.convertDateTime(src.getDateElement()));
} }
if (src.hasPublisher()) { if (src.hasPublisher()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.publisher", String40_50.convertString(src.getPublisherElement())); tgt.addExtension(PUBLISHER_EXTENSION_URL, String40_50.convertString(src.getPublisherElement()));
} }
for (ContactDetail cd : src.getContact()) { for (ContactDetail cd : src.getContact()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.contact", ContactDetail40_50.convertContactDetail(cd)); tgt.addExtension(CONTACT_EXTENSION_URL, ContactDetail40_50.convertContactDetail(cd));
} }
if (src.hasDescription()) { if (src.hasDescription()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.description", MarkDown40_50.convertMarkdown(src.getDescriptionElement())); tgt.addExtension(DESCRIPTION_EXTENSION_URL, MarkDown40_50.convertMarkdown(src.getDescriptionElement()));
} }
for (UsageContext cd : src.getUseContext()) { for (UsageContext cd : src.getUseContext()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.useContext", UsageContext40_50.convertUsageContext(cd)); tgt.addExtension(USE_CONTEXT_EXTENSION_URL, UsageContext40_50.convertUsageContext(cd));
} }
for (CodeableConcept cd : src.getJurisdiction()) { for (CodeableConcept cd : src.getJurisdiction()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.jurisdiction", CodeableConcept40_50.convertCodeableConcept(cd)); tgt.addExtension(JURISDICTION_EXTENSION_URL, CodeableConcept40_50.convertCodeableConcept(cd));
} }
if (src.hasPurpose()) { if (src.hasPurpose()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.purpose", MarkDown40_50.convertMarkdown(src.getPurposeElement())); tgt.addExtension(PURPOSE_EXTENSION_URL, MarkDown40_50.convertMarkdown(src.getPurposeElement()));
} }
if (src.hasCopyright()) { if (src.hasCopyright()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.copyright", MarkDown40_50.convertMarkdown(src.getCopyrightElement())); tgt.addExtension(COPYRIGHT_EXTENSION_URL, MarkDown40_50.convertMarkdown(src.getCopyrightElement()));
} }
if (src.hasCopyrightLabel()) { if (src.hasCopyrightLabel()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.copyrightLabel", String40_50.convertString(src.getCopyrightLabelElement())); tgt.addExtension(COPYRIGHT_LABEL_EXTENSION_URL, String40_50.convertString(src.getCopyrightLabelElement()));
} }
if (src.hasType()) { if (src.hasType()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.type", new org.hl7.fhir.r4.model.CodeType(src.getType().toCode())); tgt.addExtension(TYPE_EXTENSION_URL, new org.hl7.fhir.r4.model.CodeType(src.getType().toCode()));
} }
if (src.hasDocumentation()) { if (src.hasDocumentation()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.documentation", MarkDown40_50.convertMarkdown(src.getDocumentationElement())); tgt.addExtension(DOCUMENTATION_EXTENSION_URL, MarkDown40_50.convertMarkdown(src.getDocumentationElement()));
} }
for (UrlType ref : src.getReference()) { for (UrlType ref : src.getReference()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.reference", Url40_50.convertUrl(ref)); tgt.addExtension(REFERENCE_EXTENSION_URL, Url40_50.convertUrl(ref));
} }
if (src.hasCapabilities()) { if (src.hasCapabilities()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.capabilities", Canonical40_50.convertCanonical(src.getCapabilitiesElement())); tgt.addExtension(CAPABILITIES_EXTENSION_URL, Canonical40_50.convertCanonical(src.getCapabilitiesElement()));
} }
for (CanonicalType ct : src.getDerivedFrom()) { for (CanonicalType ct : src.getDerivedFrom()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.derivedFrom", Canonical40_50.convertCanonical(ct)); tgt.addExtension(DERIVED_FROM_EXTENSION_URL, Canonical40_50.convertCanonical(ct));
} }
return tgt; return tgt;

View File

@ -58,6 +58,46 @@ import org.hl7.fhir.r5.model.UsageContext;
// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 // Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
public class Requirements40_50 { public class Requirements40_50 {
public static final String URL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.url";
public static final String VERSION_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.version";
public static final String NAME_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.name";
public static final String TITLE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.title";
public static final String STATUS_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.status";
public static final String EXPERIMENTAL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.experimental";
public static final String DATE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.date";
public static final String PUBLISHER_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.publisher";
public static final String CONTACT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.contact";
public static final String DESCRIPTION_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.description";
public static final String USE_CONTEXT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.useContext";
public static final String JURISDICTION_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.jurisdiction";
public static final String PURPOSE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.purpose";
public static final String COPYRIGHT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyright";
public static final String COPYRIGHT_LABEL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyrightLabel";
public static final String DERIVED_FROM_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.derivedFrom";
public static final String ACTOR_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.actor";
public static final String STATEMENT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement";
private static final String[] IGNORED_EXTENSION_URLS = new String[]{
URL_EXTENSION_URL,
VERSION_EXTENSION_URL,
NAME_EXTENSION_URL,
TITLE_EXTENSION_URL,
STATUS_EXTENSION_URL,
EXPERIMENTAL_EXTENSION_URL,
DATE_EXTENSION_URL,
PUBLISHER_EXTENSION_URL,
CONTACT_EXTENSION_URL,
DESCRIPTION_EXTENSION_URL,
USE_CONTEXT_EXTENSION_URL,
JURISDICTION_EXTENSION_URL,
PURPOSE_EXTENSION_URL,
COPYRIGHT_EXTENSION_URL,
COPYRIGHT_LABEL_EXTENSION_URL,
DERIVED_FROM_EXTENSION_URL,
ACTOR_EXTENSION_URL,
STATEMENT_EXTENSION_URL
};
public static org.hl7.fhir.r5.model.Requirements convertRequirements(org.hl7.fhir.r4.model.Basic src) throws FHIRException { public static org.hl7.fhir.r5.model.Requirements convertRequirements(org.hl7.fhir.r4.model.Basic src) throws FHIRException {
if (src == null) if (src == null)
return null; return null;
@ -65,64 +105,64 @@ public class Requirements40_50 {
throw new FHIRException("Error in logic: this basic resource is not an Requirements"); throw new FHIRException("Error in logic: this basic resource is not an Requirements");
} }
org.hl7.fhir.r5.model.Requirements tgt = new org.hl7.fhir.r5.model.Requirements(); org.hl7.fhir.r5.model.Requirements tgt = new org.hl7.fhir.r5.model.Requirements();
//FIXME add ignore
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt); ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt, IGNORED_EXTENSION_URLS);
for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
tgt.addIdentifier(Identifier40_50.convertIdentifier(t)); tgt.addIdentifier(Identifier40_50.convertIdentifier(t));
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.url")) { if (src.hasExtension(URL_EXTENSION_URL)) {
tgt.setUrlElement(Uri40_50.convertUri((org.hl7.fhir.r4.model.UriType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.url").getValue())); tgt.setUrlElement(Uri40_50.convertUri((org.hl7.fhir.r4.model.UriType) src.getExtensionByUrl(URL_EXTENSION_URL).getValue()));
} }
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.version")) { if (src.hasExtension(VERSION_EXTENSION_URL)) {
tgt.setVersionElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.version").getValue())); tgt.setVersionElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl(VERSION_EXTENSION_URL).getValue()));
} }
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.name")) { if (src.hasExtension(NAME_EXTENSION_URL)) {
tgt.setNameElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.name").getValue())); tgt.setNameElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl(NAME_EXTENSION_URL).getValue()));
} }
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.title")) { if (src.hasExtension(TITLE_EXTENSION_URL)) {
tgt.setTitleElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.title").getValue())); tgt.setTitleElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl(TITLE_EXTENSION_URL).getValue()));
} }
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.status")) { if (src.hasExtension(STATUS_EXTENSION_URL)) {
tgt.setStatus(PublicationStatus.fromCode(src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.status").getValue().primitiveValue())); tgt.setStatus(PublicationStatus.fromCode(src.getExtensionByUrl(STATUS_EXTENSION_URL).getValue().primitiveValue()));
} }
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.experimental")) { if (src.hasExtension(EXPERIMENTAL_EXTENSION_URL)) {
tgt.setExperimentalElement(Boolean40_50.convertBoolean((org.hl7.fhir.r4.model.BooleanType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.experimental").getValue())); tgt.setExperimentalElement(Boolean40_50.convertBoolean((org.hl7.fhir.r4.model.BooleanType) src.getExtensionByUrl(EXPERIMENTAL_EXTENSION_URL).getValue()));
} }
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.date")) { if (src.hasExtension(DATE_EXTENSION_URL)) {
tgt.setDateElement(DateTime40_50.convertDateTime((org.hl7.fhir.r4.model.DateTimeType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.date").getValue())); tgt.setDateElement(DateTime40_50.convertDateTime((org.hl7.fhir.r4.model.DateTimeType) src.getExtensionByUrl(DATE_EXTENSION_URL).getValue()));
} }
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.publisher")) { if (src.hasExtension(PUBLISHER_EXTENSION_URL)) {
tgt.setPublisherElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.publisher").getValue())); tgt.setPublisherElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl(PUBLISHER_EXTENSION_URL).getValue()));
} }
for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.contact")) { for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl(CONTACT_EXTENSION_URL)) {
tgt.addContact(ContactDetail40_50.convertContactDetail((org.hl7.fhir.r4.model.ContactDetail) ext.getValue())); tgt.addContact(ContactDetail40_50.convertContactDetail((org.hl7.fhir.r4.model.ContactDetail) ext.getValue()));
} }
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.description")) { if (src.hasExtension(DESCRIPTION_EXTENSION_URL)) {
tgt.setPublisherElement(MarkDown40_50.convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.description").getValue())); tgt.setPublisherElement(MarkDown40_50.convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src.getExtensionByUrl(DESCRIPTION_EXTENSION_URL).getValue()));
} }
for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.useContext")) { for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl(USE_CONTEXT_EXTENSION_URL)) {
tgt.addUseContext(UsageContext40_50.convertUsageContext((org.hl7.fhir.r4.model.UsageContext) ext.getValue())); tgt.addUseContext(UsageContext40_50.convertUsageContext((org.hl7.fhir.r4.model.UsageContext) ext.getValue()));
} }
for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.jurisdiction")) { for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl(JURISDICTION_EXTENSION_URL)) {
tgt.addJurisdiction(CodeableConcept40_50.convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) ext.getValue())); tgt.addJurisdiction(CodeableConcept40_50.convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) ext.getValue()));
} }
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.purpose")) { if (src.hasExtension(PURPOSE_EXTENSION_URL)) {
tgt.setPurposeElement(MarkDown40_50.convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.purpose").getValue())); tgt.setPurposeElement(MarkDown40_50.convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src.getExtensionByUrl(PURPOSE_EXTENSION_URL).getValue()));
} }
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyright")) { if (src.hasExtension(COPYRIGHT_EXTENSION_URL)) {
tgt.setCopyrightElement(MarkDown40_50.convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyright").getValue())); tgt.setCopyrightElement(MarkDown40_50.convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src.getExtensionByUrl(COPYRIGHT_EXTENSION_URL).getValue()));
} }
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyrightLabel")) { if (src.hasExtension(COPYRIGHT_LABEL_EXTENSION_URL)) {
tgt.setCopyrightLabelElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyrightLabel").getValue())); tgt.setCopyrightLabelElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl(COPYRIGHT_LABEL_EXTENSION_URL).getValue()));
} }
for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.derivedFrom")) { for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl(DERIVED_FROM_EXTENSION_URL)) {
tgt.getDerivedFrom().add(Canonical40_50.convertCanonical((org.hl7.fhir.r4.model.CanonicalType) ext.getValue())); tgt.getDerivedFrom().add(Canonical40_50.convertCanonical((org.hl7.fhir.r4.model.CanonicalType) ext.getValue()));
} }
for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.actor")) { for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl(ACTOR_EXTENSION_URL)) {
tgt.getActor().add(Canonical40_50.convertCanonical((org.hl7.fhir.r4.model.CanonicalType) ext.getValue())); tgt.getActor().add(Canonical40_50.convertCanonical((org.hl7.fhir.r4.model.CanonicalType) ext.getValue()));
} }
for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement")) { for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl(STATEMENT_EXTENSION_URL)) {
convertRequirementsStatement(ext, tgt.addStatement()); convertRequirementsStatement(ext, tgt.addStatement());
} }
return tgt; return tgt;
@ -139,58 +179,58 @@ public class Requirements40_50 {
for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
tgt.addIdentifier(Identifier40_50.convertIdentifier(t)); tgt.addIdentifier(Identifier40_50.convertIdentifier(t));
if (src.hasUrl()) { if (src.hasUrl()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.url", Uri40_50.convertUri(src.getUrlElement())); tgt.addExtension(URL_EXTENSION_URL, Uri40_50.convertUri(src.getUrlElement()));
} }
if (src.hasVersion()) { if (src.hasVersion()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.version", String40_50.convertString(src.getVersionElement())); tgt.addExtension(VERSION_EXTENSION_URL, String40_50.convertString(src.getVersionElement()));
} }
if (src.hasName()) { if (src.hasName()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.name", String40_50.convertString(src.getNameElement())); tgt.addExtension(NAME_EXTENSION_URL, String40_50.convertString(src.getNameElement()));
} }
if (src.hasTitle()) { if (src.hasTitle()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.title", String40_50.convertString(src.getTitleElement())); tgt.addExtension(TITLE_EXTENSION_URL, String40_50.convertString(src.getTitleElement()));
} }
if (src.hasStatus()) { if (src.hasStatus()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.status", new org.hl7.fhir.r4.model.CodeType(src.getStatus().toCode())); tgt.addExtension(STATUS_EXTENSION_URL, new org.hl7.fhir.r4.model.CodeType(src.getStatus().toCode()));
} }
if (src.hasExperimental()) { if (src.hasExperimental()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.experimental", Boolean40_50.convertBoolean(src.getExperimentalElement())); tgt.addExtension(EXPERIMENTAL_EXTENSION_URL, Boolean40_50.convertBoolean(src.getExperimentalElement()));
} }
if (src.hasDate()) { if (src.hasDate()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.date", DateTime40_50.convertDateTime(src.getDateElement())); tgt.addExtension(DATE_EXTENSION_URL, DateTime40_50.convertDateTime(src.getDateElement()));
} }
if (src.hasPublisher()) { if (src.hasPublisher()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.publisher", String40_50.convertString(src.getPublisherElement())); tgt.addExtension(PUBLISHER_EXTENSION_URL, String40_50.convertString(src.getPublisherElement()));
} }
for (ContactDetail cd : src.getContact()) { for (ContactDetail cd : src.getContact()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.contact", ContactDetail40_50.convertContactDetail(cd)); tgt.addExtension(CONTACT_EXTENSION_URL, ContactDetail40_50.convertContactDetail(cd));
} }
if (src.hasDescription()) { if (src.hasDescription()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.description", MarkDown40_50.convertMarkdown(src.getDescriptionElement())); tgt.addExtension(DESCRIPTION_EXTENSION_URL, MarkDown40_50.convertMarkdown(src.getDescriptionElement()));
} }
for (UsageContext cd : src.getUseContext()) { for (UsageContext cd : src.getUseContext()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.useContext", UsageContext40_50.convertUsageContext(cd)); tgt.addExtension(USE_CONTEXT_EXTENSION_URL, UsageContext40_50.convertUsageContext(cd));
} }
for (CodeableConcept cd : src.getJurisdiction()) { for (CodeableConcept cd : src.getJurisdiction()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.jurisdiction", CodeableConcept40_50.convertCodeableConcept(cd)); tgt.addExtension(JURISDICTION_EXTENSION_URL, CodeableConcept40_50.convertCodeableConcept(cd));
} }
if (src.hasPurpose()) { if (src.hasPurpose()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.purpose", MarkDown40_50.convertMarkdown(src.getPurposeElement())); tgt.addExtension(PURPOSE_EXTENSION_URL, MarkDown40_50.convertMarkdown(src.getPurposeElement()));
} }
if (src.hasCopyright()) { if (src.hasCopyright()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyright", MarkDown40_50.convertMarkdown(src.getCopyrightElement())); tgt.addExtension(COPYRIGHT_EXTENSION_URL, MarkDown40_50.convertMarkdown(src.getCopyrightElement()));
} }
if (src.hasCopyrightLabel()) { if (src.hasCopyrightLabel()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyrightLabel", String40_50.convertString(src.getCopyrightLabelElement())); tgt.addExtension(COPYRIGHT_LABEL_EXTENSION_URL, String40_50.convertString(src.getCopyrightLabelElement()));
} }
for (CanonicalType ref : src.getDerivedFrom()) { for (CanonicalType ref : src.getDerivedFrom()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.derivedFrom", Canonical40_50.convertCanonical(ref)); tgt.addExtension(DERIVED_FROM_EXTENSION_URL, Canonical40_50.convertCanonical(ref));
} }
for (CanonicalType ref : src.getActor()) { for (CanonicalType ref : src.getActor()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.actor", Canonical40_50.convertCanonical(ref)); tgt.addExtension(ACTOR_EXTENSION_URL, Canonical40_50.convertCanonical(ref));
} }
for (RequirementsStatementComponent ref : src.getStatement()) { for (RequirementsStatementComponent ref : src.getStatement()) {
org.hl7.fhir.r4.model.Extension tgte = new org.hl7.fhir.r4.model.Extension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement"); org.hl7.fhir.r4.model.Extension tgte = new org.hl7.fhir.r4.model.Extension(STATEMENT_EXTENSION_URL);
tgt.addExtension(tgte); tgt.addExtension(tgte);
convertRequirementsStatement(ref, tgte); convertRequirementsStatement(ref, tgte);
} }

View File

@ -11,6 +11,8 @@ import org.hl7.fhir.convertors.conv40_50.datatypes40_50.special40_50.Narrative40
import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r4.model.Basic; import org.hl7.fhir.r4.model.Basic;
import java.util.Arrays;
public class Resource40_50 { public class Resource40_50 {
public final BaseAdvisor_40_50 advisor; public final BaseAdvisor_40_50 advisor;
@ -525,7 +527,7 @@ public class Resource40_50 {
} }
} }
public void copyDomainResource(org.hl7.fhir.r4.model.DomainResource src, org.hl7.fhir.r5.model.DomainResource tgt) throws FHIRException { public void copyDomainResource(org.hl7.fhir.r4.model.DomainResource src, org.hl7.fhir.r5.model.DomainResource tgt, String... ignoredExtensionUrls) throws FHIRException {
copyResource(src, tgt); copyResource(src, tgt);
if (src.hasText()) tgt.setText(Narrative40_50.convertNarrative(src.getText())); if (src.hasText()) tgt.setText(Narrative40_50.convertNarrative(src.getText()));
src.getContained().stream() src.getContained().stream()
@ -536,7 +538,7 @@ public class Resource40_50 {
org.hl7.fhir.r5.model.Extension convertExtension = new org.hl7.fhir.r5.model.Extension(); org.hl7.fhir.r5.model.Extension convertExtension = new org.hl7.fhir.r5.model.Extension();
advisor.handleExtension(ConversionContext40_50.INSTANCE.path(), extension, convertExtension); advisor.handleExtension(ConversionContext40_50.INSTANCE.path(), extension, convertExtension);
tgt.addExtension(convertExtension); tgt.addExtension(convertExtension);
} else if (!advisor.ignoreExtension(ConversionContext40_50.INSTANCE.path(), extension)) { } else if (!advisor.ignoreExtension(ConversionContext40_50.INSTANCE.path(), extension) && !Arrays.asList(ignoredExtensionUrls).contains(extension.getUrl())) {
tgt.addExtension(Extension40_50.convertExtension(extension)); tgt.addExtension(Extension40_50.convertExtension(extension));
} }
}); });
@ -546,7 +548,7 @@ public class Resource40_50 {
.forEach(tgt::addModifierExtension); .forEach(tgt::addModifierExtension);
} }
public void copyDomainResource(org.hl7.fhir.r5.model.DomainResource src, org.hl7.fhir.r4.model.DomainResource tgt) throws FHIRException { public void copyDomainResource(org.hl7.fhir.r5.model.DomainResource src, org.hl7.fhir.r4.model.DomainResource tgt, String... ignoredExtensionUrls) throws FHIRException {
copyResource(src, tgt); copyResource(src, tgt);
if (src.hasText()) tgt.setText(Narrative40_50.convertNarrative(src.getText())); if (src.hasText()) tgt.setText(Narrative40_50.convertNarrative(src.getText()));
src.getContained().stream() src.getContained().stream()
@ -557,7 +559,7 @@ public class Resource40_50 {
org.hl7.fhir.r4.model.Extension convertExtension = new org.hl7.fhir.r4.model.Extension(); org.hl7.fhir.r4.model.Extension convertExtension = new org.hl7.fhir.r4.model.Extension();
advisor.handleExtension(ConversionContext40_50.INSTANCE.path(), extension, convertExtension); advisor.handleExtension(ConversionContext40_50.INSTANCE.path(), extension, convertExtension);
tgt.addExtension(convertExtension); tgt.addExtension(convertExtension);
} else if (!advisor.ignoreExtension(ConversionContext40_50.INSTANCE.path(), extension)) { } else if (!advisor.ignoreExtension(ConversionContext40_50.INSTANCE.path(), extension) && !Arrays.asList(ignoredExtensionUrls).contains(extension.getUrl())) {
tgt.addExtension(Extension40_50.convertExtension(extension)); tgt.addExtension(Extension40_50.convertExtension(extension));
} }
}); });