#1329 Fix up type handling for conversions between R4/R4B and R5 (OperationDefinition.parameter.type)
This commit is contained in:
parent
6db701767a
commit
6956f39502
|
@ -47,6 +47,7 @@ public class VersionConvertorConstants {
|
|||
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 final String EXT_OPDEF_ORIGINAL_TYPE = "http://hl7.org/fhir/4.0/StructureDefinition/extension-OperationDefinition.parameter.type";
|
||||
|
||||
public static String refToVS(String url) {
|
||||
if (url == null)
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
package org.hl7.fhir.convertors.conv40_50.datatypes40_50;
|
||||
|
||||
import org.hl7.fhir.convertors.VersionConvertorConstants;
|
||||
import org.hl7.fhir.r5.model.CodeType;
|
||||
import org.hl7.fhir.r5.model.Extension;
|
||||
import org.hl7.fhir.r5.model.Enumeration;
|
||||
import org.hl7.fhir.r5.model.Enumerations.FHIRTypes;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
|
||||
public class Utilities40_50 {
|
||||
|
||||
public static void convertType(org.hl7.fhir.r4.model.CodeType src, org.hl7.fhir.r5.model.Enumeration<FHIRTypes> tgt) {
|
||||
if (Utilities.existsInList(src.primitiveValue(), "Media")) {
|
||||
setType(tgt, src.primitiveValue(), "DocumentReference");
|
||||
|
||||
} else if (Utilities.existsInList(src.primitiveValue(), "DeviceUseStatement")) {
|
||||
setType(tgt, src.primitiveValue(), "DeviceUsage");
|
||||
|
||||
} else if (Utilities.existsInList(src.primitiveValue(), "DocumentManifest")) {
|
||||
setType(tgt, src.primitiveValue(), "List");
|
||||
|
||||
} else if (Utilities.existsInList(src.primitiveValue(), "MedicinalProduct")) {
|
||||
setType(tgt, src.primitiveValue(), "MedicinalProductDefinition");
|
||||
|
||||
} else if (Utilities.existsInList(src.primitiveValue(), "MedicinalProductAuthorization")) {
|
||||
setType(tgt, src.primitiveValue(), "RegulatedAuthorization");
|
||||
|
||||
} else if (Utilities.existsInList(src.primitiveValue(), "RequestGroup")) {
|
||||
setType(tgt, src.primitiveValue(), "RequestOrchestration");
|
||||
|
||||
} else if (Utilities.existsInList(src.primitiveValue(), "MedicinalProductIngredient")) {
|
||||
setType(tgt, src.primitiveValue(), "Ingredient");
|
||||
|
||||
} else if (Utilities.existsInList(src.primitiveValue(), "MedicinalProductManufactured")) {
|
||||
setType(tgt, src.primitiveValue(), "ManufacturedItemDefinition");
|
||||
|
||||
} else if (Utilities.existsInList(src.primitiveValue(), "MedicinalProductPackaged")) {
|
||||
setType(tgt, src.primitiveValue(), "PackagedProductDefinition");
|
||||
|
||||
} else if (Utilities.existsInList(src.primitiveValue(), "MedicinalProductPharmaceutical")) {
|
||||
setType(tgt, src.primitiveValue(), "AdministrableProductDefinition");
|
||||
|
||||
} else if (Utilities.existsInList(src.primitiveValue(), "SubstanceSpecification")) {
|
||||
setType(tgt, src.primitiveValue(), "SubstanceDefinition");
|
||||
|
||||
} else if (Utilities.existsInList(src.primitiveValue(), "MedicinalProductContraindication", "MedicinalProductIndication", "MedicinalProductInteraction", "MedicinalProductUndesirableEffect", "ClinicalUseDefinition")) {
|
||||
setType(tgt, src.primitiveValue(), "SubstanceDefinition");
|
||||
|
||||
} else if (Utilities.existsInList(src.primitiveValue(), "EffectEvidenceSynthesis", "CatalogEntry", "ResearchDefinition", "ResearchElementDefinition", "RiskEvidenceSynthesis",
|
||||
"Contributor", "ProdCharacteristic", "SubstanceAmount")) {
|
||||
setType(tgt, src.primitiveValue(), "Basic");
|
||||
|
||||
} else {
|
||||
tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FHIRTypes.fromCode(src.primitiveValue()));
|
||||
}
|
||||
}
|
||||
|
||||
private static void setType(org.hl7.fhir.r5.model.Enumeration<FHIRTypes> tgt, String original, String value) {
|
||||
tgt.setValueAsString(value);
|
||||
tgt.addExtension(new Extension().setUrl(VersionConvertorConstants.EXT_OPDEF_ORIGINAL_TYPE).setValue(new CodeType(original)));
|
||||
}
|
||||
|
||||
public static void convertType(org.hl7.fhir.r5.model.Enumeration<FHIRTypes> src, org.hl7.fhir.r4.model.CodeType tgt) {
|
||||
if (src.hasExtension(VersionConvertorConstants.EXT_OPDEF_ORIGINAL_TYPE)) {
|
||||
tgt.setValueAsString(src.getExtensionString(VersionConvertorConstants.EXT_OPDEF_ORIGINAL_TYPE));
|
||||
} else {
|
||||
tgt.setValue(src.asStringValue());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package org.hl7.fhir.convertors.conv40_50.datatypes40_50.metadata40_50;
|
||||
|
||||
import org.hl7.fhir.convertors.context.ConversionContext40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.Utilities40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.Coding40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Canonical40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.PositiveInt40_50;
|
||||
|
@ -12,8 +13,9 @@ public class DataRequirement40_50 {
|
|||
if (src == null) return null;
|
||||
org.hl7.fhir.r5.model.DataRequirement tgt = new org.hl7.fhir.r5.model.DataRequirement();
|
||||
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
|
||||
if (src.hasType())
|
||||
tgt.setType(org.hl7.fhir.r5.model.Enumerations.FHIRTypes.fromCode(convertResourceName4to5(src.getType())));
|
||||
if (src.hasType()) {
|
||||
Utilities40_50.convertType(src.getTypeElement(), tgt.getTypeElement());
|
||||
}
|
||||
for (org.hl7.fhir.r4.model.CanonicalType t : src.getProfile())
|
||||
tgt.getProfile().add(Canonical40_50.convertCanonical(t));
|
||||
if (src.hasSubject())
|
||||
|
@ -34,7 +36,9 @@ public class DataRequirement40_50 {
|
|||
if (src == null) return null;
|
||||
org.hl7.fhir.r4.model.DataRequirement tgt = new org.hl7.fhir.r4.model.DataRequirement();
|
||||
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
|
||||
if (src.hasType()) tgt.setType(convertResourceName5to4(src.getType().toCode()));
|
||||
if (src.hasType()) {
|
||||
Utilities40_50.convertType(src.getTypeElement(), tgt.getTypeElement());
|
||||
}
|
||||
for (org.hl7.fhir.r5.model.CanonicalType t : src.getProfile())
|
||||
tgt.getProfile().add(Canonical40_50.convertCanonical(t));
|
||||
if (src.hasSubject())
|
||||
|
@ -51,22 +55,6 @@ public class DataRequirement40_50 {
|
|||
return tgt;
|
||||
}
|
||||
|
||||
private static String convertResourceName4to5(String name) {
|
||||
if (name == null) return null;
|
||||
if (name.equals("DeviceUseStatement")) {
|
||||
return "DeviceUsage";
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
private static String convertResourceName5to4(String name) {
|
||||
if (name == null) return null;
|
||||
if (name.equals("DeviceUsage")) {
|
||||
return "DeviceUseStatement";
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
public static org.hl7.fhir.r5.model.DataRequirement.DataRequirementCodeFilterComponent convertDataRequirementCodeFilterComponent(org.hl7.fhir.r4.model.DataRequirement.DataRequirementCodeFilterComponent src) throws FHIRException {
|
||||
if (src == null) return null;
|
||||
org.hl7.fhir.r5.model.DataRequirement.DataRequirementCodeFilterComponent tgt = new org.hl7.fhir.r5.model.DataRequirement.DataRequirementCodeFilterComponent();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.hl7.fhir.convertors.conv40_50.datatypes40_50.metadata40_50;
|
||||
|
||||
import org.hl7.fhir.convertors.context.ConversionContext40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.Utilities40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Canonical40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Code40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Integer40_50;
|
||||
|
@ -17,7 +18,9 @@ public class ParameterDefinition40_50 {
|
|||
if (src.hasMin()) tgt.setMinElement(Integer40_50.convertInteger(src.getMinElement()));
|
||||
if (src.hasMax()) tgt.setMaxElement(String40_50.convertString(src.getMaxElement()));
|
||||
if (src.hasDocumentation()) tgt.setDocumentationElement(String40_50.convertString(src.getDocumentationElement()));
|
||||
if (src.hasType()) tgt.setType(org.hl7.fhir.r5.model.Enumerations.FHIRTypes.fromCode(src.getType()));
|
||||
if (src.hasType()) {
|
||||
Utilities40_50.convertType(src.getTypeElement(), tgt.getTypeElement());
|
||||
}
|
||||
if (src.hasProfile()) tgt.setProfileElement(Canonical40_50.convertCanonical(src.getProfileElement()));
|
||||
return tgt;
|
||||
}
|
||||
|
@ -31,7 +34,9 @@ public class ParameterDefinition40_50 {
|
|||
if (src.hasMin()) tgt.setMinElement(Integer40_50.convertInteger(src.getMinElement()));
|
||||
if (src.hasMax()) tgt.setMaxElement(String40_50.convertString(src.getMaxElement()));
|
||||
if (src.hasDocumentation()) tgt.setDocumentationElement(String40_50.convertString(src.getDocumentationElement()));
|
||||
if (src.hasType()) tgt.setType(src.getType().toCode());
|
||||
if (src.hasType()) {
|
||||
Utilities40_50.convertType(src.getTypeElement(), tgt.getTypeElement());
|
||||
}
|
||||
if (src.hasProfile()) tgt.setProfileElement(Canonical40_50.convertCanonical(src.getProfileElement()));
|
||||
return tgt;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
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.conv40_50.datatypes40_50.Utilities40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.CodeableConcept40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.metadata40_50.ContactDetail40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.metadata40_50.UsageContext40_50;
|
||||
|
@ -18,6 +20,7 @@ import org.hl7.fhir.r5.model.CodeType;
|
|||
import org.hl7.fhir.r5.model.Enumeration;
|
||||
import org.hl7.fhir.r5.model.Enumerations.VersionIndependentResourceTypesAll;
|
||||
import org.hl7.fhir.r5.model.Enumerations.VersionIndependentResourceTypesAllEnumFactory;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
|
||||
/*
|
||||
Copyright (c) 2011+, HL7, Inc.
|
||||
|
@ -221,8 +224,9 @@ public class OperationDefinition40_50 {
|
|||
tgt.setMaxElement(String40_50.convertString(src.getMaxElement()));
|
||||
if (src.hasDocumentation())
|
||||
tgt.setDocumentationElement(String40_50.convertStringToMarkdown(src.getDocumentationElement()));
|
||||
if (src.hasType())
|
||||
tgt.getTypeElement().setValue(org.hl7.fhir.r5.model.Enumerations.FHIRTypes.fromCode(src.getType()));
|
||||
if (src.hasType()) {
|
||||
Utilities40_50.convertType(src.getTypeElement(), tgt.getTypeElement());
|
||||
}
|
||||
for (org.hl7.fhir.r4.model.CanonicalType t : src.getTargetProfile())
|
||||
tgt.getTargetProfile().add(Canonical40_50.convertCanonical(t));
|
||||
if (src.hasSearchType())
|
||||
|
@ -251,8 +255,9 @@ public class OperationDefinition40_50 {
|
|||
tgt.setMaxElement(String40_50.convertString(src.getMaxElement()));
|
||||
if (src.hasDocumentation())
|
||||
tgt.setDocumentationElement(String40_50.convertString(src.getDocumentationElement()));
|
||||
if (src.hasType())
|
||||
tgt.setTypeElement(new org.hl7.fhir.r4.model.CodeType(src.getType().toCode()));
|
||||
if (src.hasType()) {
|
||||
Utilities40_50.convertType(src.getTypeElement(), tgt.getTypeElement());
|
||||
}
|
||||
for (org.hl7.fhir.r5.model.CanonicalType t : src.getTargetProfile())
|
||||
tgt.getTargetProfile().add(Canonical40_50.convertCanonical(t));
|
||||
if (src.hasSearchType())
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
package org.hl7.fhir.convertors.conv43_50;
|
||||
|
||||
import org.hl7.fhir.convertors.VersionConvertorConstants;
|
||||
import org.hl7.fhir.r4b.model.Enumerations.FHIRAllTypes;
|
||||
import org.hl7.fhir.r5.model.CodeType;
|
||||
import org.hl7.fhir.r5.model.Extension;
|
||||
import org.hl7.fhir.r5.model.Enumeration;
|
||||
import org.hl7.fhir.r5.model.Enumerations.FHIRTypes;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
|
||||
public class Utilities43_50 {
|
||||
|
||||
public static void convertType(org.hl7.fhir.r4b.model.Enumeration<FHIRAllTypes> src, org.hl7.fhir.r5.model.Enumeration<FHIRTypes> tgt) {
|
||||
if (Utilities.existsInList(src.primitiveValue(), "Media")) {
|
||||
setType(tgt, src.primitiveValue(), "DocumentReference");
|
||||
|
||||
} else if (Utilities.existsInList(src.primitiveValue(), "DeviceUseStatement")) {
|
||||
setType(tgt, src.primitiveValue(), "DeviceUsage");
|
||||
|
||||
} else if (Utilities.existsInList(src.primitiveValue(), "DocumentManifest")) {
|
||||
setType(tgt, src.primitiveValue(), "List");
|
||||
|
||||
} else if (Utilities.existsInList(src.primitiveValue(), "MedicinalProduct")) {
|
||||
setType(tgt, src.primitiveValue(), "MedicinalProductDefinition");
|
||||
|
||||
} else if (Utilities.existsInList(src.primitiveValue(), "MedicinalProductAuthorization")) {
|
||||
setType(tgt, src.primitiveValue(), "RegulatedAuthorization");
|
||||
|
||||
} else if (Utilities.existsInList(src.primitiveValue(), "RequestGroup")) {
|
||||
setType(tgt, src.primitiveValue(), "RequestOrchestration");
|
||||
|
||||
} else if (Utilities.existsInList(src.primitiveValue(), "MedicinalProductIngredient")) {
|
||||
setType(tgt, src.primitiveValue(), "Ingredient");
|
||||
|
||||
} else if (Utilities.existsInList(src.primitiveValue(), "MedicinalProductManufactured")) {
|
||||
setType(tgt, src.primitiveValue(), "ManufacturedItemDefinition");
|
||||
|
||||
} else if (Utilities.existsInList(src.primitiveValue(), "MedicinalProductPackaged")) {
|
||||
setType(tgt, src.primitiveValue(), "PackagedProductDefinition");
|
||||
|
||||
} else if (Utilities.existsInList(src.primitiveValue(), "MedicinalProductPharmaceutical")) {
|
||||
setType(tgt, src.primitiveValue(), "AdministrableProductDefinition");
|
||||
|
||||
} else if (Utilities.existsInList(src.primitiveValue(), "SubstanceSpecification")) {
|
||||
setType(tgt, src.primitiveValue(), "SubstanceDefinition");
|
||||
|
||||
} else if (Utilities.existsInList(src.primitiveValue(), "MedicinalProductContraindication", "MedicinalProductIndication", "MedicinalProductInteraction", "MedicinalProductUndesirableEffect", "ClinicalUseDefinition")) {
|
||||
setType(tgt, src.primitiveValue(), "SubstanceDefinition");
|
||||
|
||||
} else if (Utilities.existsInList(src.primitiveValue(), "EffectEvidenceSynthesis", "CatalogEntry", "ResearchDefinition", "ResearchElementDefinition", "RiskEvidenceSynthesis",
|
||||
"Contributor", "ProdCharacteristic", "SubstanceAmount")) {
|
||||
setType(tgt, src.primitiveValue(), "Basic");
|
||||
|
||||
} else {
|
||||
tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FHIRTypes.fromCode(src.primitiveValue()));
|
||||
}
|
||||
}
|
||||
|
||||
private static void setType(org.hl7.fhir.r5.model.Enumeration<FHIRTypes> tgt, String original, String value) {
|
||||
tgt.setValueAsString(value);
|
||||
tgt.addExtension(new Extension().setUrl(VersionConvertorConstants.EXT_OPDEF_ORIGINAL_TYPE).setValue(new CodeType(original)));
|
||||
}
|
||||
|
||||
public static void convertType(org.hl7.fhir.r5.model.Enumeration<FHIRTypes> src, org.hl7.fhir.r4b.model.Enumeration<FHIRAllTypes> tgt) {
|
||||
if (src.hasExtension(VersionConvertorConstants.EXT_OPDEF_ORIGINAL_TYPE)) {
|
||||
tgt.setValueAsString(src.getExtensionString(VersionConvertorConstants.EXT_OPDEF_ORIGINAL_TYPE));
|
||||
} else {
|
||||
tgt.setValueAsString(src.asStringValue());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package org.hl7.fhir.convertors.conv43_50.datatypes43_50.metadata43_50;
|
||||
|
||||
import org.hl7.fhir.convertors.context.ConversionContext43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.Utilities43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Coding43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Canonical43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.PositiveInt43_50;
|
||||
|
@ -12,8 +13,9 @@ public class DataRequirement43_50 {
|
|||
if (src == null) return null;
|
||||
org.hl7.fhir.r5.model.DataRequirement tgt = new org.hl7.fhir.r5.model.DataRequirement();
|
||||
ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
|
||||
if (src.hasType())
|
||||
tgt.setType(org.hl7.fhir.r5.model.Enumerations.FHIRTypes.fromCode(convertResourceName4to5(src.getType().toCode())));
|
||||
if (src.hasType()) {
|
||||
Utilities43_50.convertType(src.getTypeElement(), tgt.getTypeElement());
|
||||
}
|
||||
for (org.hl7.fhir.r4b.model.CanonicalType t : src.getProfile())
|
||||
tgt.getProfile().add(Canonical43_50.convertCanonical(t));
|
||||
if (src.hasSubject())
|
||||
|
@ -34,7 +36,9 @@ public class DataRequirement43_50 {
|
|||
if (src == null) return null;
|
||||
org.hl7.fhir.r4b.model.DataRequirement tgt = new org.hl7.fhir.r4b.model.DataRequirement();
|
||||
ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
|
||||
if (src.hasType()) tgt.getTypeElement().setValueAsString(convertResourceName5to4(src.getType().toCode()));
|
||||
if (src.hasType()) {
|
||||
Utilities43_50.convertType(src.getTypeElement(), tgt.getTypeElement());
|
||||
}
|
||||
for (org.hl7.fhir.r5.model.CanonicalType t : src.getProfile())
|
||||
tgt.getProfile().add(Canonical43_50.convertCanonical(t));
|
||||
if (src.hasSubject())
|
||||
|
@ -51,22 +55,6 @@ public class DataRequirement43_50 {
|
|||
return tgt;
|
||||
}
|
||||
|
||||
private static String convertResourceName4to5(String name) {
|
||||
if (name == null) return null;
|
||||
if (name.equals("DeviceUseStatement")) {
|
||||
return "DeviceUsage";
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
private static String convertResourceName5to4(String name) {
|
||||
if (name == null) return null;
|
||||
if (name.equals("DeviceUsage")) {
|
||||
return "DeviceUseStatement";
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
public static org.hl7.fhir.r5.model.DataRequirement.DataRequirementCodeFilterComponent convertDataRequirementCodeFilterComponent(org.hl7.fhir.r4b.model.DataRequirement.DataRequirementCodeFilterComponent src) throws FHIRException {
|
||||
if (src == null) return null;
|
||||
org.hl7.fhir.r5.model.DataRequirement.DataRequirementCodeFilterComponent tgt = new org.hl7.fhir.r5.model.DataRequirement.DataRequirementCodeFilterComponent();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.hl7.fhir.convertors.conv43_50.datatypes43_50.metadata43_50;
|
||||
|
||||
import org.hl7.fhir.convertors.context.ConversionContext43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.Utilities43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Canonical43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Code43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Integer43_50;
|
||||
|
@ -17,7 +18,9 @@ public class ParameterDefinition43_50 {
|
|||
if (src.hasMin()) tgt.setMinElement(Integer43_50.convertInteger(src.getMinElement()));
|
||||
if (src.hasMax()) tgt.setMaxElement(String43_50.convertString(src.getMaxElement()));
|
||||
if (src.hasDocumentation()) tgt.setDocumentationElement(String43_50.convertString(src.getDocumentationElement()));
|
||||
if (src.hasType()) tgt.setType(org.hl7.fhir.r5.model.Enumerations.FHIRTypes.fromCode(src.getType().toCode()));
|
||||
if (src.hasType()) {
|
||||
Utilities43_50.convertType(src.getTypeElement(), tgt.getTypeElement());
|
||||
}
|
||||
if (src.hasProfile()) tgt.setProfileElement(Canonical43_50.convertCanonical(src.getProfileElement()));
|
||||
return tgt;
|
||||
}
|
||||
|
@ -31,7 +34,9 @@ public class ParameterDefinition43_50 {
|
|||
if (src.hasMin()) tgt.setMinElement(Integer43_50.convertInteger(src.getMinElement()));
|
||||
if (src.hasMax()) tgt.setMaxElement(String43_50.convertString(src.getMaxElement()));
|
||||
if (src.hasDocumentation()) tgt.setDocumentationElement(String43_50.convertString(src.getDocumentationElement()));
|
||||
if (src.hasType()) tgt.getTypeElement().setValueAsString(src.getType().toCode());
|
||||
if (src.hasType()) {
|
||||
Utilities43_50.convertType(src.getTypeElement(), tgt.getTypeElement());
|
||||
}
|
||||
if (src.hasProfile()) tgt.setProfileElement(Canonical43_50.convertCanonical(src.getProfileElement()));
|
||||
return tgt;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.hl7.fhir.convertors.conv43_50.resources43_50;
|
||||
|
||||
import org.hl7.fhir.convertors.context.ConversionContext43_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.Utilities40_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.Utilities43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.CodeableConcept43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.metadata43_50.ContactDetail43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.metadata43_50.UsageContext43_50;
|
||||
|
@ -220,8 +222,9 @@ public class OperationDefinition43_50 {
|
|||
tgt.setMaxElement(String43_50.convertString(src.getMaxElement()));
|
||||
if (src.hasDocumentation())
|
||||
tgt.setDocumentationElement(String43_50.convertStringToMarkdown(src.getDocumentationElement()));
|
||||
if (src.hasType())
|
||||
tgt.getTypeElement().setValue(org.hl7.fhir.r5.model.Enumerations.FHIRTypes.fromCode(src.getType().toCode()));
|
||||
if (src.hasType()) {
|
||||
Utilities43_50.convertType(src.getTypeElement(), tgt.getTypeElement());
|
||||
}
|
||||
for (org.hl7.fhir.r4b.model.CanonicalType t : src.getTargetProfile())
|
||||
tgt.getTargetProfile().add(Canonical43_50.convertCanonical(t));
|
||||
if (src.hasSearchType())
|
||||
|
@ -250,8 +253,9 @@ public class OperationDefinition43_50 {
|
|||
tgt.setMaxElement(String43_50.convertString(src.getMaxElement()));
|
||||
if (src.hasDocumentation())
|
||||
tgt.setDocumentationElement(String43_50.convertString(src.getDocumentationElement()));
|
||||
if (src.hasType())
|
||||
tgt.getTypeElement().setValueAsString(src.getType().toCode());
|
||||
if (src.hasType()) {
|
||||
Utilities43_50.convertType(src.getTypeElement(), tgt.getTypeElement());
|
||||
}
|
||||
for (org.hl7.fhir.r5.model.CanonicalType t : src.getTargetProfile())
|
||||
tgt.getTargetProfile().add(Canonical43_50.convertCanonical(t));
|
||||
if (src.hasSearchType())
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package org.hl7.fhir.convertors.conv40_50;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class OperationDefinition40_50Test {
|
||||
|
||||
|
||||
@Test
|
||||
@DisplayName("Test r5 -> r4 OperationDefinition conversion.")
|
||||
public void testR5_R4() throws IOException {
|
||||
InputStream r4_input = this.getClass().getResourceAsStream("/opdef-4.xml");
|
||||
|
||||
org.hl7.fhir.r4.model.OperationDefinition r4_actual = (org.hl7.fhir.r4.model.OperationDefinition) new org.hl7.fhir.r4.formats.XmlParser().parse(r4_input);
|
||||
org.hl7.fhir.r5.model.Resource r5_conv = VersionConvertorFactory_40_50.convertResource(r4_actual);
|
||||
|
||||
org.hl7.fhir.r5.formats.XmlParser r5_parser = new org.hl7.fhir.r5.formats.XmlParser();
|
||||
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
r5_parser.compose(stream, r5_conv);
|
||||
|
||||
org.hl7.fhir.r5.model.Resource r5_streamed = (org.hl7.fhir.r5.model.OperationDefinition) new org.hl7.fhir.r5.formats.XmlParser().parse(new ByteArrayInputStream(stream.toByteArray()));
|
||||
org.hl7.fhir.r4.model.Resource r4_conv = VersionConvertorFactory_40_50.convertResource(r5_streamed);
|
||||
|
||||
assertTrue(r4_actual.equalsDeep(r4_conv), "should be the same");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<OperationDefinition xmlns="http://hl7.org/fhir">
|
||||
<url value="http:://false.com/OperationDefinition/operation-DiagnosticReport-addMedia" />
|
||||
<name value="operation-DiagnosticReport-addMedia" />
|
||||
<status value="active" />
|
||||
<kind value="operation" />
|
||||
<experimental value="false" />
|
||||
<affectsState value="true" />
|
||||
<code value="addMedia" />
|
||||
<system value="false" />
|
||||
<type value="false" />
|
||||
<instance value="true" />
|
||||
<parameter>
|
||||
<name value="mediaInstance" />
|
||||
<use value="in" />
|
||||
<min value="1" />
|
||||
<max value="1" />
|
||||
<documentation value="Instance of media that should be attached to the diagnosticreport" />
|
||||
<type value="Media" />
|
||||
<targetProfile value="http://false.com/StructureDefinition/Media" />
|
||||
</parameter>
|
||||
</OperationDefinition>
|
Loading…
Reference in New Issue