use of org.openehealth.ipf.commons.ihe.xds.core.metadata.Timestamp.Precision in project MobileAccessGateway by i4mi.
the class BaseQueryResponseConverter method transformToDate.
/**
* XDS Timestamp -> FHIR Date
* @param timestamp
* @return
*/
public DateType transformToDate(Timestamp timestamp) {
if (timestamp == null)
return null;
Date date = Date.from(timestamp.getDateTime().toInstant());
Precision precision = timestamp.getPrecision();
TemporalPrecisionEnum fhirPrecision;
switch(precision) {
case YEAR:
fhirPrecision = TemporalPrecisionEnum.YEAR;
break;
case DAY:
fhirPrecision = TemporalPrecisionEnum.DAY;
break;
// case SECOND: fhirPrecision = TemporalPrecisionEnum.SECOND;break;
default:
fhirPrecision = TemporalPrecisionEnum.DAY;
break;
}
return new DateType(date, fhirPrecision);
}
use of org.openehealth.ipf.commons.ihe.xds.core.metadata.Timestamp.Precision in project MobileAccessGateway by i4mi.
the class BaseQueryResponseConverter method transform.
/**
* XDS timestamp -> FHIR DateTime
* @param timestamp
* @return
*/
public DateTimeType transform(Timestamp timestamp) {
if (timestamp == null)
return null;
Date date = Date.from(timestamp.getDateTime().toInstant());
Precision precision = timestamp.getPrecision();
TemporalPrecisionEnum fhirPrecision;
switch(precision) {
case YEAR:
fhirPrecision = TemporalPrecisionEnum.YEAR;
break;
case DAY:
fhirPrecision = TemporalPrecisionEnum.DAY;
break;
// There is no mapping for HOUR; MINUTE is not accepted
case HOUR:
fhirPrecision = TemporalPrecisionEnum.SECOND;
break;
case MINUTE:
fhirPrecision = TemporalPrecisionEnum.SECOND;
break;
case SECOND:
fhirPrecision = TemporalPrecisionEnum.SECOND;
break;
default:
fhirPrecision = TemporalPrecisionEnum.MILLI;
break;
}
return new DateTimeType(date, fhirPrecision);
}
Aggregations