Add tests and changes for DateTime conversion
This commit is contained in:
parent
209a5e777b
commit
02968b9b7a
|
@ -5,15 +5,13 @@ import org.hl7.fhir.exceptions.FHIRException;
|
|||
|
||||
public class DateTime14_30 {
|
||||
public static org.hl7.fhir.dstu3.model.DateTimeType convertDateTime(org.hl7.fhir.dstu2016may.model.DateTimeType src) throws FHIRException {
|
||||
org.hl7.fhir.dstu3.model.DateTimeType tgt = new org.hl7.fhir.dstu3.model.DateTimeType();
|
||||
if (src.hasValue()) tgt.setValue(src.getValue());
|
||||
org.hl7.fhir.dstu3.model.DateTimeType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.DateTimeType(src.getValueAsString()) : new org.hl7.fhir.dstu3.model.DateTimeType();
|
||||
ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt);
|
||||
return tgt;
|
||||
}
|
||||
|
||||
public static org.hl7.fhir.dstu2016may.model.DateTimeType convertDateTime(org.hl7.fhir.dstu3.model.DateTimeType src) throws FHIRException {
|
||||
org.hl7.fhir.dstu2016may.model.DateTimeType tgt = new org.hl7.fhir.dstu2016may.model.DateTimeType();
|
||||
if (src.hasValue()) tgt.setValue(src.getValue());
|
||||
org.hl7.fhir.dstu2016may.model.DateTimeType tgt = src.hasValue() ? new org.hl7.fhir.dstu2016may.model.DateTimeType(src.getValueAsString()) : new org.hl7.fhir.dstu2016may.model.DateTimeType();
|
||||
ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt);
|
||||
return tgt;
|
||||
}
|
||||
|
|
|
@ -5,15 +5,13 @@ import org.hl7.fhir.exceptions.FHIRException;
|
|||
|
||||
public class DateTime14_40 {
|
||||
public static org.hl7.fhir.r4.model.DateTimeType convertDateTime(org.hl7.fhir.dstu2016may.model.DateTimeType src) throws FHIRException {
|
||||
org.hl7.fhir.r4.model.DateTimeType tgt = new org.hl7.fhir.r4.model.DateTimeType();
|
||||
if (src.hasValue()) tgt.setValue(src.getValue());
|
||||
org.hl7.fhir.r4.model.DateTimeType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.DateTimeType(src.getValueAsString()) : new org.hl7.fhir.r4.model.DateTimeType();
|
||||
ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt);
|
||||
return tgt;
|
||||
}
|
||||
|
||||
public static org.hl7.fhir.dstu2016may.model.DateTimeType convertDateTime(org.hl7.fhir.r4.model.DateTimeType src) throws FHIRException {
|
||||
org.hl7.fhir.dstu2016may.model.DateTimeType tgt = new org.hl7.fhir.dstu2016may.model.DateTimeType();
|
||||
if (src.hasValue()) tgt.setValue(src.getValue());
|
||||
org.hl7.fhir.dstu2016may.model.DateTimeType tgt = src.hasValue() ? new org.hl7.fhir.dstu2016may.model.DateTimeType(src.getValueAsString()) : new org.hl7.fhir.dstu2016may.model.DateTimeType();
|
||||
ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt);
|
||||
return tgt;
|
||||
}
|
||||
|
|
|
@ -5,15 +5,13 @@ import org.hl7.fhir.exceptions.FHIRException;
|
|||
|
||||
public class DateTime14_50 {
|
||||
public static org.hl7.fhir.r5.model.DateTimeType convertDateTime(org.hl7.fhir.dstu2016may.model.DateTimeType src) throws FHIRException {
|
||||
org.hl7.fhir.r5.model.DateTimeType tgt = new org.hl7.fhir.r5.model.DateTimeType();
|
||||
if (src.hasValue()) tgt.setValue(src.getValue());
|
||||
org.hl7.fhir.r5.model.DateTimeType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.DateTimeType(src.getValueAsString()) : new org.hl7.fhir.r5.model.DateTimeType();
|
||||
ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
|
||||
return tgt;
|
||||
}
|
||||
|
||||
public static org.hl7.fhir.dstu2016may.model.DateTimeType convertDateTime(org.hl7.fhir.r5.model.DateTimeType src) throws FHIRException {
|
||||
org.hl7.fhir.dstu2016may.model.DateTimeType tgt = new org.hl7.fhir.dstu2016may.model.DateTimeType();
|
||||
if (src.hasValue()) tgt.setValue(src.getValue());
|
||||
org.hl7.fhir.dstu2016may.model.DateTimeType tgt = src.hasValue() ? new org.hl7.fhir.dstu2016may.model.DateTimeType(src.getValueAsString()) : new org.hl7.fhir.dstu2016may.model.DateTimeType();
|
||||
ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
|
||||
return tgt;
|
||||
}
|
||||
|
|
|
@ -99,7 +99,45 @@ public class VersionConvertorPrimitiveTypeTests {
|
|||
getDateTimeArgs(VersionConvertorFactory_10_50.class,
|
||||
org.hl7.fhir.dstu2.model.DateTimeType.class, org.hl7.fhir.dstu2.model.Type.class,
|
||||
org.hl7.fhir.r5.model.DateType.class, org.hl7.fhir.r5.model.DataType.class,
|
||||
DEFAULT_DATE_PRECISION_STRINGS)
|
||||
DEFAULT_DATE_PRECISION_STRINGS),
|
||||
|
||||
//DateTime
|
||||
getDateTimeArgs(VersionConvertorFactory_10_30.class,
|
||||
org.hl7.fhir.dstu2.model.DateTimeType.class, org.hl7.fhir.dstu2.model.Type.class,
|
||||
org.hl7.fhir.dstu3.model.DateTimeType.class, org.hl7.fhir.dstu3.model.Type.class,
|
||||
MILLISECOND_DATE_PRECISION_STRINGS),
|
||||
getDateTimeArgs(VersionConvertorFactory_10_40.class,
|
||||
org.hl7.fhir.dstu2.model.DateTimeType.class, org.hl7.fhir.dstu2.model.Type.class,
|
||||
org.hl7.fhir.r4.model.DateTimeType.class, org.hl7.fhir.r4.model.Type.class,
|
||||
MILLISECOND_DATE_PRECISION_STRINGS),
|
||||
getDateTimeArgs(VersionConvertorFactory_10_50.class,
|
||||
org.hl7.fhir.dstu2.model.DateTimeType.class, org.hl7.fhir.dstu2.model.Type.class,
|
||||
org.hl7.fhir.r5.model.DateTimeType.class, org.hl7.fhir.r5.model.DataType.class,
|
||||
MILLISECOND_DATE_PRECISION_STRINGS),
|
||||
getDateTimeArgs(VersionConvertorFactory_14_30.class,
|
||||
org.hl7.fhir.dstu2016may.model.DateTimeType.class, org.hl7.fhir.dstu2016may.model.Type.class,
|
||||
org.hl7.fhir.dstu3.model.DateTimeType.class, org.hl7.fhir.dstu3.model.Type.class,
|
||||
MILLISECOND_DATE_PRECISION_STRINGS),
|
||||
getDateTimeArgs(VersionConvertorFactory_14_40.class,
|
||||
org.hl7.fhir.dstu2016may.model.DateTimeType.class, org.hl7.fhir.dstu2016may.model.Type.class,
|
||||
org.hl7.fhir.r4.model.DateTimeType.class, org.hl7.fhir.r4.model.Type.class,
|
||||
MILLISECOND_DATE_PRECISION_STRINGS),
|
||||
getDateTimeArgs(VersionConvertorFactory_14_50.class,
|
||||
org.hl7.fhir.dstu2016may.model.DateTimeType.class, org.hl7.fhir.dstu2016may.model.Type.class,
|
||||
org.hl7.fhir.r5.model.DateTimeType.class, org.hl7.fhir.r5.model.DataType.class,
|
||||
MILLISECOND_DATE_PRECISION_STRINGS),
|
||||
getDateTimeArgs(VersionConvertorFactory_30_40.class,
|
||||
org.hl7.fhir.dstu3.model.DateTimeType.class, org.hl7.fhir.dstu3.model.Type.class,
|
||||
org.hl7.fhir.r4.model.DateTimeType.class, org.hl7.fhir.r4.model.Type.class,
|
||||
MILLISECOND_DATE_PRECISION_STRINGS),
|
||||
getDateTimeArgs(VersionConvertorFactory_30_50.class,
|
||||
org.hl7.fhir.dstu3.model.DateTimeType.class, org.hl7.fhir.dstu3.model.Type.class,
|
||||
org.hl7.fhir.r5.model.DateTimeType.class, org.hl7.fhir.r5.model.DataType.class,
|
||||
MILLISECOND_DATE_PRECISION_STRINGS),
|
||||
getDateTimeArgs(VersionConvertorFactory_40_50.class,
|
||||
org.hl7.fhir.r4.model.DateTimeType.class, org.hl7.fhir.r4.model.Type.class,
|
||||
org.hl7.fhir.r5.model.DateTimeType.class, org.hl7.fhir.r5.model.DataType.class,
|
||||
MILLISECOND_DATE_PRECISION_STRINGS)
|
||||
|
||||
).flatMap(i -> i);
|
||||
|
||||
|
|
Loading…
Reference in New Issue