From b7fbd3ce449feb67ad9739f1ad9bf7c7cb1c41ba Mon Sep 17 00:00:00 2001 From: dotasek Date: Fri, 18 Mar 2022 14:09:01 -0400 Subject: [PATCH] Add tests and changes for Time + fix skipped Uuid conversions --- .../primitivetypes10_30/Time10_30.java | 4 +- .../primitivetypes10_40/Time10_40.java | 4 +- .../primitivetypes10_50/Time10_50.java | 4 +- .../conv14_30/datatypes14_30/Type14_30.java | 4 +- .../primitivetypes14_30/Time14_30.java | 6 +-- .../conv14_40/datatypes14_40/Type14_40.java | 2 +- .../primitivetypes14_40/Time14_40.java | 6 +-- .../primitivetypes14_50/Time14_50.java | 6 +-- .../primitivetypes30_40/Time30_40.java | 4 +- .../conv30_50/datatypes30_50/Type30_50.java | 2 +- .../primitivetypes30_50/Time30_50.java | 4 +- .../conv40_50/datatypes40_50/Type40_50.java | 4 +- .../primitive40_50/Time40_50.java | 2 +- .../VersionConvertorPrimitiveTypeTests.java | 47 ++++++++++++++++++- 14 files changed, 69 insertions(+), 30 deletions(-) diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/datatypes10_30/primitivetypes10_30/Time10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/datatypes10_30/primitivetypes10_30/Time10_30.java index 4f153737f..10bf5325e 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/datatypes10_30/primitivetypes10_30/Time10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/datatypes10_30/primitivetypes10_30/Time10_30.java @@ -5,13 +5,13 @@ import org.hl7.fhir.exceptions.FHIRException; public class Time10_30 { public static org.hl7.fhir.dstu3.model.TimeType convertTime(org.hl7.fhir.dstu2.model.TimeType src) throws FHIRException { - org.hl7.fhir.dstu3.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.TimeType(src.getValue()) : new org.hl7.fhir.dstu3.model.TimeType(); + org.hl7.fhir.dstu3.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.TimeType(src.getValueAsString()) : new org.hl7.fhir.dstu3.model.TimeType(); ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyElement(src, tgt); return tgt; } public static org.hl7.fhir.dstu2.model.TimeType convertTime(org.hl7.fhir.dstu3.model.TimeType src) throws FHIRException { - org.hl7.fhir.dstu2.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.TimeType(src.getValue()) : new org.hl7.fhir.dstu2.model.TimeType(); + org.hl7.fhir.dstu2.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.TimeType(src.getValueAsString()) : new org.hl7.fhir.dstu2.model.TimeType(); ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyElement(src, tgt); return tgt; } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/datatypes10_40/primitivetypes10_40/Time10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/datatypes10_40/primitivetypes10_40/Time10_40.java index 29ead07db..7138853e8 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/datatypes10_40/primitivetypes10_40/Time10_40.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/datatypes10_40/primitivetypes10_40/Time10_40.java @@ -5,13 +5,13 @@ import org.hl7.fhir.exceptions.FHIRException; public class Time10_40 { public static org.hl7.fhir.r4.model.TimeType convertTime(org.hl7.fhir.dstu2.model.TimeType src) throws FHIRException { - org.hl7.fhir.r4.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.TimeType(src.getValue()) : new org.hl7.fhir.r4.model.TimeType(); + org.hl7.fhir.r4.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.TimeType(src.getValueAsString()) : new org.hl7.fhir.r4.model.TimeType(); ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt); return tgt; } public static org.hl7.fhir.dstu2.model.TimeType convertTime(org.hl7.fhir.r4.model.TimeType src) throws FHIRException { - org.hl7.fhir.dstu2.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.TimeType(src.getValue()) : new org.hl7.fhir.dstu2.model.TimeType(); + org.hl7.fhir.dstu2.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.TimeType(src.getValueAsString()) : new org.hl7.fhir.dstu2.model.TimeType(); ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt); return tgt; } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/datatypes10_50/primitivetypes10_50/Time10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/datatypes10_50/primitivetypes10_50/Time10_50.java index 408087501..ff8e12c19 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/datatypes10_50/primitivetypes10_50/Time10_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/datatypes10_50/primitivetypes10_50/Time10_50.java @@ -5,13 +5,13 @@ import org.hl7.fhir.exceptions.FHIRException; public class Time10_50 { public static org.hl7.fhir.r5.model.TimeType convertTime(org.hl7.fhir.dstu2.model.TimeType src) throws FHIRException { - org.hl7.fhir.r5.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.TimeType(src.getValue()) : new org.hl7.fhir.r5.model.TimeType(); + org.hl7.fhir.r5.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.TimeType(src.getValueAsString()) : new org.hl7.fhir.r5.model.TimeType(); ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyElement(src, tgt); return tgt; } public static org.hl7.fhir.dstu2.model.TimeType convertTime(org.hl7.fhir.r5.model.TimeType src) throws FHIRException { - org.hl7.fhir.dstu2.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.TimeType(src.getValue()) : new org.hl7.fhir.dstu2.model.TimeType(); + org.hl7.fhir.dstu2.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.TimeType(src.getValueAsString()) : new org.hl7.fhir.dstu2.model.TimeType(); ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyElement(src, tgt); return tgt; } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/datatypes14_30/Type14_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/datatypes14_30/Type14_30.java index 2a0190342..bc181f6c7 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/datatypes14_30/Type14_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/datatypes14_30/Type14_30.java @@ -137,10 +137,10 @@ public class Type14_30 { return UnsignedInt14_30.convertUnsignedInt((org.hl7.fhir.dstu3.model.UnsignedIntType) src); if (src instanceof org.hl7.fhir.dstu3.model.IntegerType) return Integer14_30.convertInteger((org.hl7.fhir.dstu3.model.IntegerType) src); - if (src instanceof org.hl7.fhir.dstu3.model.UriType) - return Uri14_30.convertUri((org.hl7.fhir.dstu3.model.UriType) src); if (src instanceof org.hl7.fhir.dstu3.model.UuidType) return Uuid14_30.convertUuid((org.hl7.fhir.dstu3.model.UuidType) src); + if (src instanceof org.hl7.fhir.dstu3.model.UriType) + return Uri14_30.convertUri((org.hl7.fhir.dstu3.model.UriType) src); if (src instanceof org.hl7.fhir.dstu3.model.Extension) return Extension14_30.convertExtension((org.hl7.fhir.dstu3.model.Extension) src); if (src instanceof org.hl7.fhir.dstu3.model.Narrative) diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/datatypes14_30/primitivetypes14_30/Time14_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/datatypes14_30/primitivetypes14_30/Time14_30.java index e96ee22e7..a64aa2bc0 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/datatypes14_30/primitivetypes14_30/Time14_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/datatypes14_30/primitivetypes14_30/Time14_30.java @@ -5,15 +5,13 @@ import org.hl7.fhir.exceptions.FHIRException; public class Time14_30 { public static org.hl7.fhir.dstu3.model.TimeType convertTime(org.hl7.fhir.dstu2016may.model.TimeType src) throws FHIRException { - org.hl7.fhir.dstu3.model.TimeType tgt = new org.hl7.fhir.dstu3.model.TimeType(); - if (src.hasValue()) tgt.setValue(src.getValue()); + org.hl7.fhir.dstu3.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.TimeType(src.getValueAsString()) : new org.hl7.fhir.dstu3.model.TimeType(); ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); return tgt; } public static org.hl7.fhir.dstu2016may.model.TimeType convertTime(org.hl7.fhir.dstu3.model.TimeType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.TimeType tgt = new org.hl7.fhir.dstu2016may.model.TimeType(); - if (src.hasValue()) tgt.setValue(src.getValue()); + org.hl7.fhir.dstu2016may.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.dstu2016may.model.TimeType(src.getValueAsString()) : new org.hl7.fhir.dstu2016may.model.TimeType(); ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); return tgt; } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/datatypes14_40/Type14_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/datatypes14_40/Type14_40.java index 96832b3aa..45dd19c17 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/datatypes14_40/Type14_40.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/datatypes14_40/Type14_40.java @@ -134,9 +134,9 @@ public class Type14_40 { return UnsignedInt14_40.convertUnsignedInt((org.hl7.fhir.r4.model.UnsignedIntType) src); if (src instanceof org.hl7.fhir.r4.model.IntegerType) return Integer14_40.convertInteger((org.hl7.fhir.r4.model.IntegerType) src); - if (src instanceof org.hl7.fhir.r4.model.UriType) return Uri14_40.convertUri((org.hl7.fhir.r4.model.UriType) src); if (src instanceof org.hl7.fhir.r4.model.UuidType) return Uuid14_40.convertUuid((org.hl7.fhir.r4.model.UuidType) src); + if (src instanceof org.hl7.fhir.r4.model.UriType) return Uri14_40.convertUri((org.hl7.fhir.r4.model.UriType) src); if (src instanceof org.hl7.fhir.r4.model.Extension) return Extension14_40.convertExtension((org.hl7.fhir.r4.model.Extension) src); if (src instanceof org.hl7.fhir.r4.model.Narrative) diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/datatypes14_40/primitivetypes14_40/Time14_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/datatypes14_40/primitivetypes14_40/Time14_40.java index 460d59e5b..59ad8fb44 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/datatypes14_40/primitivetypes14_40/Time14_40.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/datatypes14_40/primitivetypes14_40/Time14_40.java @@ -5,15 +5,13 @@ import org.hl7.fhir.exceptions.FHIRException; public class Time14_40 { public static org.hl7.fhir.r4.model.TimeType convertTime(org.hl7.fhir.dstu2016may.model.TimeType src) throws FHIRException { - org.hl7.fhir.r4.model.TimeType tgt = new org.hl7.fhir.r4.model.TimeType(); - if (src.hasValue()) tgt.setValue(src.getValue()); + org.hl7.fhir.r4.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.TimeType(src.getValueAsString()) : new org.hl7.fhir.r4.model.TimeType(); ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt); return tgt; } public static org.hl7.fhir.dstu2016may.model.TimeType convertTime(org.hl7.fhir.r4.model.TimeType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.TimeType tgt = new org.hl7.fhir.dstu2016may.model.TimeType(); - if (src.hasValue()) tgt.setValue(src.getValue()); + org.hl7.fhir.dstu2016may.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.dstu2016may.model.TimeType(src.getValueAsString()) : new org.hl7.fhir.dstu2016may.model.TimeType(); ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt); return tgt; } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/datatypes14_50/primitivetypes14_50/Time14_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/datatypes14_50/primitivetypes14_50/Time14_50.java index 536fcd054..9f9c44e74 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/datatypes14_50/primitivetypes14_50/Time14_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/datatypes14_50/primitivetypes14_50/Time14_50.java @@ -5,15 +5,13 @@ import org.hl7.fhir.exceptions.FHIRException; public class Time14_50 { public static org.hl7.fhir.r5.model.TimeType convertTime(org.hl7.fhir.dstu2016may.model.TimeType src) throws FHIRException { - org.hl7.fhir.r5.model.TimeType tgt = new org.hl7.fhir.r5.model.TimeType(); - if (src.hasValue()) tgt.setValue(src.getValue()); + org.hl7.fhir.r5.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.TimeType(src.getValueAsString()) : new org.hl7.fhir.r5.model.TimeType(); ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt); return tgt; } public static org.hl7.fhir.dstu2016may.model.TimeType convertTime(org.hl7.fhir.r5.model.TimeType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.TimeType tgt = new org.hl7.fhir.dstu2016may.model.TimeType(); - if (src.hasValue()) tgt.setValue(src.getValue()); + org.hl7.fhir.dstu2016may.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.dstu2016may.model.TimeType(src.getValueAsString()) : new org.hl7.fhir.dstu2016may.model.TimeType(); ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt); return tgt; } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/datatypes30_40/primitivetypes30_40/Time30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/datatypes30_40/primitivetypes30_40/Time30_40.java index 476f67cd4..078dd3595 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/datatypes30_40/primitivetypes30_40/Time30_40.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/datatypes30_40/primitivetypes30_40/Time30_40.java @@ -5,13 +5,13 @@ import org.hl7.fhir.exceptions.FHIRException; public class Time30_40 { public static org.hl7.fhir.r4.model.TimeType convertTime(org.hl7.fhir.dstu3.model.TimeType src) throws FHIRException { - org.hl7.fhir.r4.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.TimeType(src.getValue()) : new org.hl7.fhir.r4.model.TimeType(); + org.hl7.fhir.r4.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.TimeType(src.getValueAsString()) : new org.hl7.fhir.r4.model.TimeType(); ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt); return tgt; } public static org.hl7.fhir.dstu3.model.TimeType convertTime(org.hl7.fhir.r4.model.TimeType src) throws FHIRException { - org.hl7.fhir.dstu3.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.TimeType(src.getValue()) : new org.hl7.fhir.dstu3.model.TimeType(); + org.hl7.fhir.dstu3.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.TimeType(src.getValueAsString()) : new org.hl7.fhir.dstu3.model.TimeType(); ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt); return tgt; } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/datatypes30_50/Type30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/datatypes30_50/Type30_50.java index 16c1c76c7..caa8d2c24 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/datatypes30_50/Type30_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/datatypes30_50/Type30_50.java @@ -151,9 +151,9 @@ public class Type30_50 { return String30_50.convertString((org.hl7.fhir.r5.model.StringType) src); if (src instanceof org.hl7.fhir.r5.model.TimeType) return Time30_50.convertTime((org.hl7.fhir.r5.model.TimeType) src); - if (src instanceof org.hl7.fhir.r5.model.UriType) return Uri30_50.convertUri((org.hl7.fhir.r5.model.UriType) src); if (src instanceof org.hl7.fhir.r5.model.UuidType) return Uuid30_50.convertUuid((org.hl7.fhir.r5.model.UuidType) src); + if (src instanceof org.hl7.fhir.r5.model.UriType) return Uri30_50.convertUri((org.hl7.fhir.r5.model.UriType) src); if (src instanceof org.hl7.fhir.r5.model.Extension) return Extension30_50.convertExtension((org.hl7.fhir.r5.model.Extension) src); if (src instanceof org.hl7.fhir.r5.model.Narrative) diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/datatypes30_50/primitivetypes30_50/Time30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/datatypes30_50/primitivetypes30_50/Time30_50.java index cee5cdb47..daf0cb258 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/datatypes30_50/primitivetypes30_50/Time30_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/datatypes30_50/primitivetypes30_50/Time30_50.java @@ -5,13 +5,13 @@ import org.hl7.fhir.exceptions.FHIRException; public class Time30_50 { public static org.hl7.fhir.r5.model.TimeType convertTime(org.hl7.fhir.dstu3.model.TimeType src) throws FHIRException { - org.hl7.fhir.r5.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.TimeType(src.getValue()) : new org.hl7.fhir.r5.model.TimeType(); + org.hl7.fhir.r5.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.TimeType(src.getValueAsString()) : new org.hl7.fhir.r5.model.TimeType(); ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); return tgt; } public static org.hl7.fhir.dstu3.model.TimeType convertTime(org.hl7.fhir.r5.model.TimeType src) throws FHIRException { - org.hl7.fhir.dstu3.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.TimeType(src.getValue()) : new org.hl7.fhir.dstu3.model.TimeType(); + org.hl7.fhir.dstu3.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.TimeType(src.getValueAsString()) : new org.hl7.fhir.dstu3.model.TimeType(); ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); return tgt; } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/datatypes40_50/Type40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/datatypes40_50/Type40_50.java index 959859331..26752d874 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/datatypes40_50/Type40_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/datatypes40_50/Type40_50.java @@ -44,14 +44,14 @@ public class Type40_50 { if (src instanceof org.hl7.fhir.r4.model.MarkdownType) return MarkDown40_50.convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src); if (src instanceof org.hl7.fhir.r4.model.OidType) return Oid40_50.convertOid((org.hl7.fhir.r4.model.OidType) src); - if (src instanceof org.hl7.fhir.r4.model.StringType) - return String40_50.convertString((org.hl7.fhir.r4.model.StringType) src); if (src instanceof org.hl7.fhir.r4.model.TimeType) return Time40_50.convertTime((org.hl7.fhir.r4.model.TimeType) src); if (src instanceof org.hl7.fhir.r4.model.UrlType) return Url40_50.convertUrl((org.hl7.fhir.r4.model.UrlType) src); if (src instanceof org.hl7.fhir.r4.model.UuidType) return Uuid40_50.convertUuid((org.hl7.fhir.r4.model.UuidType) src); if (src instanceof org.hl7.fhir.r4.model.UriType) return Uri40_50.convertUri((org.hl7.fhir.r4.model.UriType) src); + if (src instanceof org.hl7.fhir.r4.model.StringType) + return String40_50.convertString((org.hl7.fhir.r4.model.StringType) src); if (src instanceof org.hl7.fhir.r4.model.Extension) return Extension40_50.convertExtension((org.hl7.fhir.r4.model.Extension) src); if (src instanceof org.hl7.fhir.r4.model.Narrative) diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/datatypes40_50/primitive40_50/Time40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/datatypes40_50/primitive40_50/Time40_50.java index 9898f7767..c773979c6 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/datatypes40_50/primitive40_50/Time40_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/datatypes40_50/primitive40_50/Time40_50.java @@ -11,7 +11,7 @@ public class Time40_50 { } public static org.hl7.fhir.r4.model.TimeType convertTime(org.hl7.fhir.r5.model.TimeType src) throws FHIRException { - org.hl7.fhir.r4.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.TimeType(src.getValue()) : new org.hl7.fhir.r4.model.TimeType(); + org.hl7.fhir.r4.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.TimeType(src.getValueAsString()) : new org.hl7.fhir.r4.model.TimeType(); ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); return tgt; } diff --git a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveTypeTests.java b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveTypeTests.java index e593e1591..e85983bca 100644 --- a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveTypeTests.java +++ b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveTypeTests.java @@ -65,16 +65,23 @@ public class VersionConvertorPrimitiveTypeTests { private static String[] POSITIVE_INT_STRINGS = { "1", "12345", Integer.toString(Integer.MAX_VALUE) }; + + private static String[] TIME_STRINGS = { + "12:34:56", "12:34:56.789" + }; private static String[] UNSIGNED_INT_STRINGS = { "0", "12345", Integer.toString(Integer.MAX_VALUE) }; - private static String[] URI_STRINGS = { "foo://example.com:8042/find/bassist?name=lemmy#birthdate" }; + private static String[] URL_STRINGS = { + "http://example.com:8042/find/bassist?name=lemmy#birthdate" + }; + private static String[] UUID_STRINGS = { "123e4567-e89b-12d3-a456-426614174000" }; @@ -487,6 +494,44 @@ public class VersionConvertorPrimitiveTypeTests { org.hl7.fhir.r5.model.StringType.class, org.hl7.fhir.r5.model.DataType.class, STRING_STRINGS), + //Time + getFactoryConversionParams(VersionConvertorFactory_10_30.class, + org.hl7.fhir.dstu2.model.TimeType.class, org.hl7.fhir.dstu2.model.Type.class, + org.hl7.fhir.dstu3.model.TimeType.class, org.hl7.fhir.dstu3.model.Type.class, + TIME_STRINGS), + getFactoryConversionParams(VersionConvertorFactory_10_40.class, + org.hl7.fhir.dstu2.model.TimeType.class, org.hl7.fhir.dstu2.model.Type.class, + org.hl7.fhir.r4.model.TimeType.class, org.hl7.fhir.r4.model.Type.class, + TIME_STRINGS), + getFactoryConversionParams(VersionConvertorFactory_10_50.class, + org.hl7.fhir.dstu2.model.TimeType.class, org.hl7.fhir.dstu2.model.Type.class, + org.hl7.fhir.r5.model.TimeType.class, org.hl7.fhir.r5.model.DataType.class, + TIME_STRINGS), + getFactoryConversionParams(VersionConvertorFactory_14_30.class, + org.hl7.fhir.dstu2016may.model.TimeType.class, org.hl7.fhir.dstu2016may.model.Type.class, + org.hl7.fhir.dstu3.model.TimeType.class, org.hl7.fhir.dstu3.model.Type.class, + TIME_STRINGS), + getFactoryConversionParams(VersionConvertorFactory_14_40.class, + org.hl7.fhir.dstu2016may.model.TimeType.class, org.hl7.fhir.dstu2016may.model.Type.class, + org.hl7.fhir.r4.model.TimeType.class, org.hl7.fhir.r4.model.Type.class, + TIME_STRINGS), + getFactoryConversionParams(VersionConvertorFactory_14_50.class, + org.hl7.fhir.dstu2016may.model.TimeType.class, org.hl7.fhir.dstu2016may.model.Type.class, + org.hl7.fhir.r5.model.TimeType.class, org.hl7.fhir.r5.model.DataType.class, + TIME_STRINGS), + getFactoryConversionParams(VersionConvertorFactory_30_40.class, + org.hl7.fhir.dstu3.model.TimeType.class, org.hl7.fhir.dstu3.model.Type.class, + org.hl7.fhir.r4.model.TimeType.class, org.hl7.fhir.r4.model.Type.class, + TIME_STRINGS), + getFactoryConversionParams(VersionConvertorFactory_30_50.class, + org.hl7.fhir.dstu3.model.TimeType.class, org.hl7.fhir.dstu3.model.Type.class, + org.hl7.fhir.r5.model.TimeType.class, org.hl7.fhir.r5.model.DataType.class, + TIME_STRINGS), + getFactoryConversionParams(VersionConvertorFactory_40_50.class, + org.hl7.fhir.r4.model.TimeType.class, org.hl7.fhir.r4.model.Type.class, + org.hl7.fhir.r5.model.TimeType.class, org.hl7.fhir.r5.model.DataType.class, + TIME_STRINGS), + //UnsignedInt getFactoryConversionParams(VersionConvertorFactory_10_30.class, org.hl7.fhir.dstu2.model.UnsignedIntType.class, org.hl7.fhir.dstu2.model.Type.class,