001package org.hl7.fhir.convertors.conv10_30.datatypes10_30.complextypes10_30;
002
003import org.hl7.fhir.convertors.context.ConversionContext10_30;
004import org.hl7.fhir.convertors.conv10_30.datatypes10_30.primitivetypes10_30.DateTime10_30;
005import org.hl7.fhir.exceptions.FHIRException;
006
007public class Period10_30 {
008  public static org.hl7.fhir.dstu3.model.Period convertPeriod(org.hl7.fhir.dstu2.model.Period src) throws FHIRException {
009    if (src == null || src.isEmpty()) return null;
010    org.hl7.fhir.dstu3.model.Period tgt = new org.hl7.fhir.dstu3.model.Period();
011    ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyElement(src, tgt);
012    if (src.hasStartElement()) tgt.setStartElement(DateTime10_30.convertDateTime(src.getStartElement()));
013    if (src.hasEndElement()) tgt.setEndElement(DateTime10_30.convertDateTime(src.getEndElement()));
014    return tgt;
015  }
016
017  public static org.hl7.fhir.dstu2.model.Period convertPeriod(org.hl7.fhir.dstu3.model.Period src) throws FHIRException {
018    if (src == null || src.isEmpty()) return null;
019    org.hl7.fhir.dstu2.model.Period tgt = new org.hl7.fhir.dstu2.model.Period();
020    ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyElement(src, tgt);
021    if (src.hasStartElement()) tgt.setStartElement(DateTime10_30.convertDateTime(src.getStartElement()));
022    if (src.hasEndElement()) tgt.setEndElement(DateTime10_30.convertDateTime(src.getEndElement()));
023    return tgt;
024  }
025}