support for NamingSystem conversion of url, version, and title (for THO)
This commit is contained in:
parent
bc6d0e43a3
commit
13254f39a2
|
@ -44,6 +44,9 @@ public class VersionConvertorConstants {
|
|||
public static final String EXT_OLD_CONCEPTMAP_EQUIVALENCE = "http://hl7.org/fhir/1.0/StructureDefinition/extension-ConceptMap.element.target.equivalence";
|
||||
public static final String EXT_ACTUAL_RESOURCE_NAME = "http://hl7.org/fhir/tools/StructureDefinition/original-resource-name";
|
||||
public static final String EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL = QuestionnaireRenderer.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL;
|
||||
public static final String EXT_NAMINGSYSTEM_TITLE = "http://hl7.org/fhir/5.0/StructureDefinition/extension-NamingSystem.title";
|
||||
public static final String EXT_NAMINGSYSTEM_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-NamingSystem.url";
|
||||
public static final String EXT_NAMINGSYSTEM_VERSION = "http://hl7.org/fhir/5.0/StructureDefinition/extension-NamingSystem.version";
|
||||
|
||||
public static String refToVS(String url) {
|
||||
if (url == null)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.hl7.fhir.convertors.conv10_50.resources10_50;
|
||||
|
||||
import org.hl7.fhir.convertors.VersionConvertorConstants;
|
||||
import org.hl7.fhir.convertors.context.ConversionContext10_50;
|
||||
import org.hl7.fhir.convertors.conv10_50.VersionConvertor_10_50;
|
||||
import org.hl7.fhir.convertors.conv10_50.datatypes10_50.complextypes10_50.CodeableConcept10_50;
|
||||
|
@ -8,6 +9,12 @@ import org.hl7.fhir.convertors.conv10_50.datatypes10_50.complextypes10_50.Period
|
|||
import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.Boolean10_50;
|
||||
import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.DateTime10_50;
|
||||
import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.String10_50;
|
||||
import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.Uri10_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.String43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Uri43_50;
|
||||
import org.hl7.fhir.dstu2.model.Extension;
|
||||
import org.hl7.fhir.dstu2.model.StringType;
|
||||
import org.hl7.fhir.dstu2.model.UriType;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
|
||||
public class NamingSystem10_50 {
|
||||
|
@ -17,8 +24,14 @@ public class NamingSystem10_50 {
|
|||
return null;
|
||||
org.hl7.fhir.dstu2.model.NamingSystem tgt = new org.hl7.fhir.dstu2.model.NamingSystem();
|
||||
ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyDomainResource(src, tgt);
|
||||
if (src.hasUrlElement())
|
||||
tgt.getExtension().add(new Extension().setUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_URL).setValue(Uri10_50.convertUri(src.getUrlElement())));
|
||||
if (src.hasVersionElement())
|
||||
tgt.getExtension().add(new Extension().setUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_VERSION).setValue(String10_50.convertString(src.getVersionElement())));
|
||||
if (src.hasNameElement())
|
||||
tgt.setNameElement(String10_50.convertString(src.getNameElement()));
|
||||
if (src.hasTitleElement())
|
||||
tgt.getExtension().add(new Extension().setUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE).setValue(String10_50.convertString(src.getTitleElement())));
|
||||
if (src.hasStatus())
|
||||
tgt.setStatusElement(Enumerations10_50.convertConformanceResourceStatus(src.getStatusElement()));
|
||||
if (src.hasKind())
|
||||
|
@ -51,9 +64,20 @@ public class NamingSystem10_50 {
|
|||
if (src == null || src.isEmpty())
|
||||
return null;
|
||||
org.hl7.fhir.r5.model.NamingSystem tgt = new org.hl7.fhir.r5.model.NamingSystem();
|
||||
ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyDomainResource(src, tgt);
|
||||
ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyDomainResource(src, tgt, VersionConvertorConstants.EXT_NAMINGSYSTEM_URL, VersionConvertorConstants.EXT_NAMINGSYSTEM_VERSION, VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE);
|
||||
|
||||
if (src.hasExtension(VersionConvertorConstants.EXT_NAMINGSYSTEM_URL)) {
|
||||
tgt.setUrlElement(Uri10_50.convertUri((UriType) src.getExtensionByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_URL).getValue()));
|
||||
}
|
||||
if (src.hasExtension(VersionConvertorConstants.EXT_NAMINGSYSTEM_VERSION)) {
|
||||
tgt.setVersionElement(String10_50.convertString((StringType) src.getExtensionByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_VERSION).getValue()));
|
||||
}
|
||||
if (src.hasNameElement())
|
||||
tgt.setNameElement(String10_50.convertString(src.getNameElement()));
|
||||
if (src.hasExtension(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE)) {
|
||||
tgt.setTitleElement(String10_50.convertString((StringType) src.getExtensionByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE).getValue()));
|
||||
}
|
||||
|
||||
if (src.hasStatus())
|
||||
tgt.setStatusElement(Enumerations10_50.convertConformanceResourceStatus(src.getStatusElement()));
|
||||
if (src.hasKind())
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.hl7.fhir.convertors.conv14_50.resources14_50;
|
||||
|
||||
import org.hl7.fhir.convertors.VersionConvertorConstants;
|
||||
import org.hl7.fhir.convertors.context.ConversionContext14_50;
|
||||
import org.hl7.fhir.convertors.conv14_50.datatypes14_50.complextypes14_50.CodeableConcept14_50;
|
||||
import org.hl7.fhir.convertors.conv14_50.datatypes14_50.complextypes14_50.ContactPoint14_50;
|
||||
|
@ -7,6 +8,9 @@ import org.hl7.fhir.convertors.conv14_50.datatypes14_50.complextypes14_50.Period
|
|||
import org.hl7.fhir.convertors.conv14_50.datatypes14_50.primitivetypes14_50.Boolean14_50;
|
||||
import org.hl7.fhir.convertors.conv14_50.datatypes14_50.primitivetypes14_50.DateTime14_50;
|
||||
import org.hl7.fhir.convertors.conv14_50.datatypes14_50.primitivetypes14_50.String14_50;
|
||||
import org.hl7.fhir.convertors.conv14_50.datatypes14_50.primitivetypes14_50.Uri14_50;
|
||||
import org.hl7.fhir.dstu2016may.model.Extension;
|
||||
import org.hl7.fhir.dstu2016may.model.StringType;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
|
||||
public class NamingSystem14_50 {
|
||||
|
@ -14,10 +18,14 @@ public class NamingSystem14_50 {
|
|||
public static org.hl7.fhir.r5.model.NamingSystem convertNamingSystem(org.hl7.fhir.dstu2016may.model.NamingSystem src) throws FHIRException {
|
||||
if (src == null || src.isEmpty())
|
||||
return null;
|
||||
|
||||
org.hl7.fhir.r5.model.NamingSystem tgt = new org.hl7.fhir.r5.model.NamingSystem();
|
||||
ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyDomainResource(src, tgt);
|
||||
ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyDomainResource(src, tgt, VersionConvertorConstants.EXT_NAMINGSYSTEM_URL, VersionConvertorConstants.EXT_NAMINGSYSTEM_VERSION, VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE);
|
||||
if (src.hasNameElement())
|
||||
tgt.setNameElement(String14_50.convertString(src.getNameElement()));
|
||||
if (src.hasExtension(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE)) {
|
||||
tgt.setTitleElement(String14_50.convertString((StringType) src.getExtensionByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE).getValue()));
|
||||
}
|
||||
if (src.hasStatus())
|
||||
tgt.setStatusElement(Enumerations14_50.convertConformanceResourceStatus(src.getStatusElement()));
|
||||
if (src.hasKind())
|
||||
|
@ -51,8 +59,15 @@ public class NamingSystem14_50 {
|
|||
return null;
|
||||
org.hl7.fhir.dstu2016may.model.NamingSystem tgt = new org.hl7.fhir.dstu2016may.model.NamingSystem();
|
||||
ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyDomainResource(src, tgt);
|
||||
if (src.hasUrlElement())
|
||||
tgt.getExtension().add(new Extension().setUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_URL).setValue(Uri14_50.convertUri(src.getUrlElement())));
|
||||
if (src.hasVersionElement())
|
||||
tgt.getExtension().add(new Extension().setUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_VERSION).setValue(String14_50.convertString(src.getVersionElement())));
|
||||
|
||||
if (src.hasNameElement())
|
||||
tgt.setNameElement(String14_50.convertString(src.getNameElement()));
|
||||
if (src.hasTitleElement())
|
||||
tgt.getExtension().add(new Extension().setUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE).setValue(String14_50.convertString(src.getTitleElement())));
|
||||
if (src.hasStatus())
|
||||
tgt.setStatusElement(Enumerations14_50.convertConformanceResourceStatus(src.getStatusElement()));
|
||||
if (src.hasKind())
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.hl7.fhir.convertors.conv30_50.resources30_50;
|
||||
|
||||
import org.hl7.fhir.convertors.VersionConvertorConstants;
|
||||
import org.hl7.fhir.convertors.context.ConversionContext30_50;
|
||||
import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.Uri10_50;
|
||||
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.ContactDetail30_50;
|
||||
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.UsageContext30_50;
|
||||
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.CodeableConcept30_50;
|
||||
|
@ -9,6 +11,12 @@ import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Bool
|
|||
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.DateTime30_50;
|
||||
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.MarkDown30_50;
|
||||
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.String30_50;
|
||||
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Uri30_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.String43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Uri43_50;
|
||||
import org.hl7.fhir.dstu3.model.Extension;
|
||||
import org.hl7.fhir.dstu3.model.StringType;
|
||||
import org.hl7.fhir.dstu3.model.UriType;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
|
||||
public class NamingSystem30_50 {
|
||||
|
@ -18,8 +26,15 @@ public class NamingSystem30_50 {
|
|||
return null;
|
||||
org.hl7.fhir.dstu3.model.NamingSystem tgt = new org.hl7.fhir.dstu3.model.NamingSystem();
|
||||
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
|
||||
if (src.hasUrlElement())
|
||||
tgt.getExtension().add(new Extension().setUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_URL).setValue(Uri30_50.convertUri(src.getUrlElement())));
|
||||
if (src.hasVersionElement())
|
||||
tgt.getExtension().add(new Extension().setUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_VERSION).setValue(String30_50.convertString(src.getVersionElement())));
|
||||
if (src.hasName())
|
||||
tgt.setNameElement(String30_50.convertString(src.getNameElement()));
|
||||
if (src.hasTitleElement())
|
||||
tgt.getExtension().add(new Extension().setUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE).setValue(String30_50.convertString(src.getTitleElement())));
|
||||
|
||||
if (src.hasStatus())
|
||||
tgt.setStatusElement(Enumerations30_50.convertPublicationStatus(src.getStatusElement()));
|
||||
if (src.hasKind())
|
||||
|
@ -51,9 +66,19 @@ public class NamingSystem30_50 {
|
|||
if (src == null)
|
||||
return null;
|
||||
org.hl7.fhir.r5.model.NamingSystem tgt = new org.hl7.fhir.r5.model.NamingSystem();
|
||||
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
|
||||
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt, VersionConvertorConstants.EXT_NAMINGSYSTEM_URL, VersionConvertorConstants.EXT_NAMINGSYSTEM_VERSION, VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE);
|
||||
|
||||
if (src.hasExtension(VersionConvertorConstants.EXT_NAMINGSYSTEM_URL)) {
|
||||
tgt.setUrlElement(Uri30_50.convertUri((UriType) src.getExtensionByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_URL).getValue()));
|
||||
}
|
||||
if (src.hasExtension(VersionConvertorConstants.EXT_NAMINGSYSTEM_VERSION)) {
|
||||
tgt.setVersionElement(String30_50.convertString((StringType) src.getExtensionByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_VERSION).getValue()));
|
||||
}
|
||||
if (src.hasName())
|
||||
tgt.setNameElement(String30_50.convertString(src.getNameElement()));
|
||||
if (src.hasExtension(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE)) {
|
||||
tgt.setTitleElement(String30_50.convertString((StringType) src.getExtensionByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE).getValue()));
|
||||
}
|
||||
if (src.hasStatus())
|
||||
tgt.setStatusElement(Enumerations30_50.convertPublicationStatus(src.getStatusElement()));
|
||||
if (src.hasKind())
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package org.hl7.fhir.convertors.conv40_50.resources40_50;
|
||||
|
||||
import org.hl7.fhir.convertors.VersionConvertorConstants;
|
||||
import org.hl7.fhir.convertors.context.ConversionContext40_50;
|
||||
import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.String10_50;
|
||||
import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.Uri10_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.CodeableConcept40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.Period40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.metadata40_50.ContactDetail40_50;
|
||||
|
@ -9,7 +12,13 @@ import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Boolean40
|
|||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.DateTime40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.MarkDown40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.String40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Uri40_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.String43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Uri43_50;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r4.model.Extension;
|
||||
import org.hl7.fhir.r4.model.StringType;
|
||||
import org.hl7.fhir.r4.model.UriType;
|
||||
|
||||
/*
|
||||
Copyright (c) 2011+, HL7, Inc.
|
||||
|
@ -45,10 +54,22 @@ public class NamingSystem40_50 {
|
|||
public static org.hl7.fhir.r5.model.NamingSystem convertNamingSystem(org.hl7.fhir.r4.model.NamingSystem src) throws FHIRException {
|
||||
if (src == null)
|
||||
return null;
|
||||
|
||||
org.hl7.fhir.r5.model.NamingSystem tgt = new org.hl7.fhir.r5.model.NamingSystem();
|
||||
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt);
|
||||
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt, VersionConvertorConstants.EXT_NAMINGSYSTEM_URL, VersionConvertorConstants.EXT_NAMINGSYSTEM_VERSION, VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE);
|
||||
|
||||
if (src.hasExtension(VersionConvertorConstants.EXT_NAMINGSYSTEM_URL)) {
|
||||
tgt.setUrlElement(Uri40_50.convertUri((UriType) src.getExtensionByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_URL).getValue()));
|
||||
}
|
||||
if (src.hasExtension(VersionConvertorConstants.EXT_NAMINGSYSTEM_VERSION)) {
|
||||
tgt.setVersionElement(String40_50.convertString((StringType) src.getExtensionByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_VERSION).getValue()));
|
||||
}
|
||||
if (src.hasName())
|
||||
tgt.setNameElement(String40_50.convertString(src.getNameElement()));
|
||||
if (src.hasExtension(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE)) {
|
||||
tgt.setTitleElement(String40_50.convertString((StringType) src.getExtensionByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE).getValue()));
|
||||
}
|
||||
|
||||
if (src.hasStatus())
|
||||
tgt.setStatusElement(Enumerations40_50.convertPublicationStatus(src.getStatusElement()));
|
||||
if (src.hasKind())
|
||||
|
@ -81,8 +102,15 @@ public class NamingSystem40_50 {
|
|||
return null;
|
||||
org.hl7.fhir.r4.model.NamingSystem tgt = new org.hl7.fhir.r4.model.NamingSystem();
|
||||
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt);
|
||||
if (src.hasUrlElement())
|
||||
tgt.getExtension().add(new Extension().setUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_URL).setValue(Uri40_50.convertUri(src.getUrlElement())));
|
||||
if (src.hasVersionElement())
|
||||
tgt.getExtension().add(new Extension().setUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_VERSION).setValue(String40_50.convertString(src.getVersionElement())));
|
||||
if (src.hasName())
|
||||
tgt.setNameElement(String40_50.convertString(src.getNameElement()));
|
||||
if (src.hasTitleElement())
|
||||
tgt.getExtension().add(new Extension().setUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE).setValue(String40_50.convertString(src.getTitleElement())));
|
||||
|
||||
if (src.hasStatus())
|
||||
tgt.setStatusElement(Enumerations40_50.convertPublicationStatus(src.getStatusElement()));
|
||||
if (src.hasKind())
|
||||
|
|
|
@ -2,6 +2,9 @@ package org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50;
|
|||
|
||||
import org.hl7.fhir.convertors.context.ConversionContext43_50;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r4b.model.DataType;
|
||||
import org.hl7.fhir.r4b.model.PrimitiveType;
|
||||
import org.hl7.fhir.r5.model.UriType;
|
||||
|
||||
public class Uri43_50 {
|
||||
public static org.hl7.fhir.r5.model.UriType convertUri(org.hl7.fhir.r4b.model.UriType src) throws FHIRException {
|
||||
|
@ -15,4 +18,15 @@ public class Uri43_50 {
|
|||
ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
|
||||
return tgt;
|
||||
}
|
||||
|
||||
public static UriType convertToUri(DataType src) {
|
||||
if (src instanceof PrimitiveType<?>) {
|
||||
PrimitiveType<?> p = (PrimitiveType<?>) src;
|
||||
org.hl7.fhir.r5.model.UriType tgt = p.hasValue() ? new org.hl7.fhir.r5.model.UriType(p.getValueAsString()) : new org.hl7.fhir.r5.model.UriType();
|
||||
ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
|
||||
return tgt;
|
||||
} else {
|
||||
throw new FHIRException("Unable to convert "+src.fhirType()+" to a URI Type");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package org.hl7.fhir.convertors.conv43_50.resources43_50;
|
||||
|
||||
import org.hl7.fhir.convertors.VersionConvertorConstants;
|
||||
import org.hl7.fhir.convertors.context.ConversionContext43_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.String40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Uri40_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.CodeableConcept43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Period43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.metadata43_50.ContactDetail43_50;
|
||||
|
@ -9,7 +12,9 @@ import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Boolean43
|
|||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.DateTime43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.MarkDown43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.String43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Uri43_50;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r4b.model.Extension;
|
||||
|
||||
/*
|
||||
Copyright (c) 2011+, HL7, Inc.
|
||||
|
@ -46,9 +51,19 @@ public class NamingSystem43_50 {
|
|||
if (src == null)
|
||||
return null;
|
||||
org.hl7.fhir.r5.model.NamingSystem tgt = new org.hl7.fhir.r5.model.NamingSystem();
|
||||
ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt);
|
||||
ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt, VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE);
|
||||
|
||||
if (src.hasExtension(VersionConvertorConstants.EXT_NAMINGSYSTEM_URL)) {
|
||||
tgt.setUrlElement(Uri43_50.convertToUri(src.getExtensionByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_URL).getValue()));
|
||||
}
|
||||
if (src.hasExtension(VersionConvertorConstants.EXT_NAMINGSYSTEM_VERSION)) {
|
||||
tgt.setVersionElement(String43_50.convertString(src.getExtensionByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_VERSION).getValueStringType()));
|
||||
}
|
||||
if (src.hasName())
|
||||
tgt.setNameElement(String43_50.convertString(src.getNameElement()));
|
||||
if (src.hasExtension(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE)) {
|
||||
tgt.setTitleElement(String43_50.convertString(src.getExtensionByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE).getValueStringType()));
|
||||
}
|
||||
if (src.hasStatus())
|
||||
tgt.setStatusElement(Enumerations43_50.convertPublicationStatus(src.getStatusElement()));
|
||||
if (src.hasKind())
|
||||
|
@ -81,8 +96,16 @@ public class NamingSystem43_50 {
|
|||
return null;
|
||||
org.hl7.fhir.r4b.model.NamingSystem tgt = new org.hl7.fhir.r4b.model.NamingSystem();
|
||||
ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt);
|
||||
|
||||
if (src.hasUrlElement())
|
||||
tgt.getExtension().add(new Extension().setUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_URL).setValue(Uri43_50.convertUri(src.getUrlElement())));
|
||||
if (src.hasVersionElement())
|
||||
tgt.getExtension().add(new Extension().setUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_VERSION).setValue(String43_50.convertString(src.getVersionElement())));
|
||||
if (src.hasName())
|
||||
tgt.setNameElement(String43_50.convertString(src.getNameElement()));
|
||||
if (src.hasTitleElement())
|
||||
tgt.getExtension().add(new Extension().setUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE).setValue(String43_50.convertString(src.getTitleElement())));
|
||||
|
||||
if (src.hasStatus())
|
||||
tgt.setStatusElement(Enumerations43_50.convertPublicationStatus(src.getStatusElement()));
|
||||
if (src.hasKind())
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package org.hl7.fhir.convertors.conv40_50;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.hl7.fhir.convertors.VersionConvertorConstants;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class NamingSystem40_50Test {
|
||||
|
||||
|
||||
@Test
|
||||
@DisplayName("Test r5 -> r4 NamingSystem conversion.")
|
||||
public void testR5_R4() throws IOException {
|
||||
InputStream r4b_input = this.getClass().getResourceAsStream("/naming_system_r4.xml");
|
||||
|
||||
org.hl7.fhir.r4.model.NamingSystem r4b_actual = (org.hl7.fhir.r4.model.NamingSystem) new org.hl7.fhir.r4.formats.XmlParser().parse(r4b_input);
|
||||
org.hl7.fhir.r5.model.NamingSystem r5_conv = (org.hl7.fhir.r5.model.NamingSystem) VersionConvertorFactory_40_50.convertResource(r4b_actual);
|
||||
org.hl7.fhir.r4.model.NamingSystem r4b_conv = (org.hl7.fhir.r4.model.NamingSystem) VersionConvertorFactory_40_50.convertResource(r5_conv);
|
||||
|
||||
assertEquals(1, r4b_actual.getExtensionsByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE).size());
|
||||
assertEquals(0, r5_conv.getExtensionsByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE).size());
|
||||
assertEquals("American Dental Association Area of Oral Cavity System", r5_conv.getTitle());
|
||||
assertEquals("http://terminology.hl7.org/NamingSystem/ADAAreaOralCavitySystem", r5_conv.getUrl());
|
||||
assertEquals("1.0.0", r5_conv.getVersion());
|
||||
assertEquals(1, r4b_conv.getExtensionsByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE).size());
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package org.hl7.fhir.convertors.conv43_50;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.hl7.fhir.convertors.VersionConvertorConstants;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_43_50;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class NamingSystem43_50Test {
|
||||
|
||||
|
||||
@Test
|
||||
@DisplayName("Test r5 -> r4 NamingSystem conversion.")
|
||||
public void testR5_R4() throws IOException {
|
||||
InputStream r4b_input = this.getClass().getResourceAsStream("/naming_system_r4.xml");
|
||||
|
||||
org.hl7.fhir.r4b.model.NamingSystem r4b_actual = (org.hl7.fhir.r4b.model.NamingSystem) new org.hl7.fhir.r4b.formats.XmlParser().parse(r4b_input);
|
||||
org.hl7.fhir.r5.model.NamingSystem r5_conv = (org.hl7.fhir.r5.model.NamingSystem) VersionConvertorFactory_43_50.convertResource(r4b_actual);
|
||||
org.hl7.fhir.r4b.model.NamingSystem r4b_conv = (org.hl7.fhir.r4b.model.NamingSystem) VersionConvertorFactory_43_50.convertResource(r5_conv);
|
||||
|
||||
assertEquals(1, r4b_actual.getExtensionsByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE).size());
|
||||
assertEquals(0, r5_conv.getExtensionsByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE).size());
|
||||
assertEquals("American Dental Association Area of Oral Cavity System", r5_conv.getTitle());
|
||||
assertEquals("http://terminology.hl7.org/NamingSystem/ADAAreaOralCavitySystem", r5_conv.getUrl());
|
||||
assertEquals("1.0.0", r5_conv.getVersion());
|
||||
assertEquals(1, r4b_conv.getExtensionsByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE).size());
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<NamingSystem xmlns="http://hl7.org/fhir">
|
||||
<id value="ADAAreaOralCavitySystem"/>
|
||||
<extension url="http://hl7.org/fhir/5.0/StructureDefinition/extension-NamingSystem.title">
|
||||
<valueString value="American Dental Association Area of Oral Cavity System"/>
|
||||
</extension>
|
||||
<extension url="http://hl7.org/fhir/5.0/StructureDefinition/extension-NamingSystem.url">
|
||||
<valueUri value="http://terminology.hl7.org/NamingSystem/ADAAreaOralCavitySystem"/>
|
||||
</extension>
|
||||
<extension url="http://hl7.org/fhir/5.0/StructureDefinition/extension-NamingSystem.version">
|
||||
<valueString value="1.0.0"/>
|
||||
</extension>
|
||||
<name value="ADAAreaOralCavitySystem"/>
|
||||
<status value="active"/>
|
||||
<kind value="codesystem"/>
|
||||
<date value="2022-04-07T00:00:00-00:00"/>
|
||||
<publisher value="American Dental Association"/>
|
||||
<contact>
|
||||
<name value="American Dental Association; 211 East Chicago Avenue Chicago, IL 60610-2678"/>
|
||||
</contact>
|
||||
<description value="The Area of Oral Cavity System is accepted and approved by the ADA and is the most commonly used system used by dental professionals in America. Area of the oral cavity is designated by a two-digit code. The Area of Oral Cavity System can be found in the ADA Comprehensive ADA Dental Claim Form Completion Instructions (see https://www.ada.org/-/media/project/ada-organization/ada/ada-org/files/publications/cdt/v2019adadentalclaimcompletioninstructions_v3_2022feb.pdf). For more information see here: https://www.ada.org/publications/cdt/ada-dental-claim-form. A Statement of Understanding (SOU) between ADA and HL7 exists here: http://www.hl7.org/documentcenter/public/mou/ADA%20HL7%20SOU%202021_signed.pdf"/>
|
||||
<uniqueId>
|
||||
<type value="uri"/>
|
||||
<value value="http://terminology.hl7.org/CodeSystem/ADAAreaOralCavitySystem"/>
|
||||
<preferred value="true"/>
|
||||
<comment value="This is the URL endorsed by the HTA and is considered authoritative."/>
|
||||
<period>
|
||||
<start value="2022-04-07"/>
|
||||
</period>
|
||||
</uniqueId>
|
||||
</NamingSystem>
|
|
@ -316,4 +316,26 @@ public abstract class DomainResource extends Resource implements IBaseHasExtensi
|
|||
}
|
||||
|
||||
|
||||
public boolean hasExtension(String url) {
|
||||
for (Extension e : getExtension())
|
||||
if (url.equals(e.getUrl()))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public Extension getExtensionByUrl(String theUrl) {
|
||||
org.apache.commons.lang3.Validate.notBlank(theUrl, "theUrl must not be blank or null");
|
||||
ArrayList<Extension> retVal = new ArrayList<Extension>();
|
||||
for (Extension next : getExtension()) {
|
||||
if (theUrl.equals(next.getUrl())) {
|
||||
retVal.add(next);
|
||||
}
|
||||
}
|
||||
if (retVal.size() == 0)
|
||||
return null;
|
||||
else {
|
||||
org.apache.commons.lang3.Validate.isTrue(retVal.size() == 1, "Url "+theUrl+" must have only one match");
|
||||
return retVal.get(0);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -390,4 +390,28 @@ public abstract class DomainResource extends Resource implements IBaseHasExtensi
|
|||
}
|
||||
|
||||
|
||||
|
||||
public boolean hasExtension(String url) {
|
||||
for (Extension e : getExtension())
|
||||
if (url.equals(e.getUrl()))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public Extension getExtensionByUrl(String theUrl) {
|
||||
org.apache.commons.lang3.Validate.notBlank(theUrl, "theUrl must not be blank or null");
|
||||
ArrayList<Extension> retVal = new ArrayList<Extension>();
|
||||
for (Extension next : getExtension()) {
|
||||
if (theUrl.equals(next.getUrl())) {
|
||||
retVal.add(next);
|
||||
}
|
||||
}
|
||||
if (retVal.size() == 0)
|
||||
return null;
|
||||
else {
|
||||
org.apache.commons.lang3.Validate.isTrue(retVal.size() == 1, "Url "+theUrl+" must have only one match");
|
||||
return retVal.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -32,29 +32,19 @@ package org.hl7.fhir.r5.model;
|
|||
// Generated on Thu, Mar 23, 2023 19:59+1100 for FHIR v5.0.0
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.hl7.fhir.r5.model.Enumerations.*;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.instance.model.api.ICompositeType;
|
||||
import ca.uhn.fhir.model.api.annotation.ResourceDef;
|
||||
import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.ChildOrder;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import org.hl7.fhir.instance.model.api.IDomainResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
|
||||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.instance.model.api.IBaseHasExtensions;
|
||||
import org.hl7.fhir.instance.model.api.IBaseHasModifierExtensions;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.instance.model.api.IDomainResource;
|
||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||
import org.hl7.fhir.utilities.StandardsStatus;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
|
||||
/**
|
||||
* A resource that includes narrative, extensions, and contained resources.
|
||||
*/
|
||||
|
@ -522,6 +512,7 @@ public void checkNoModifiers(String noun, String verb) throws FHIRException {
|
|||
ToolingExtensions.setStandardsStatus(this, status, null);
|
||||
}
|
||||
|
||||
|
||||
// end addition
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue