001package org.hl7.fhir.convertors.conv14_30.datatypes14_30;
002
003import org.hl7.fhir.convertors.context.ConversionContext14_30;
004import org.hl7.fhir.convertors.conv14_30.datatypes14_30.primitivetypes14_30.Code14_30;
005import org.hl7.fhir.convertors.conv14_30.datatypes14_30.primitivetypes14_30.Id14_30;
006import org.hl7.fhir.convertors.conv14_30.datatypes14_30.primitivetypes14_30.Instant14_30;
007import org.hl7.fhir.exceptions.FHIRException;
008
009public class Meta14_30 {
010  public static org.hl7.fhir.dstu3.model.Meta convertMeta(org.hl7.fhir.dstu2016may.model.Meta src) throws FHIRException {
011    if (src == null || src.isEmpty()) return null;
012    org.hl7.fhir.dstu3.model.Meta tgt = new org.hl7.fhir.dstu3.model.Meta();
013    ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt);
014    if (src.hasVersionId()) tgt.setVersionIdElement(Id14_30.convertId(src.getVersionIdElement()));
015    if (src.hasLastUpdated()) tgt.setLastUpdatedElement(Instant14_30.convertInstant(src.getLastUpdatedElement()));
016    for (org.hl7.fhir.dstu2016may.model.UriType t : src.getProfile()) tgt.addProfile(t.getValue());
017    for (org.hl7.fhir.dstu2016may.model.Coding t : src.getSecurity()) tgt.addSecurity(Code14_30.convertCoding(t));
018    for (org.hl7.fhir.dstu2016may.model.Coding t : src.getTag()) tgt.addTag(Code14_30.convertCoding(t));
019    return tgt;
020  }
021
022  public static org.hl7.fhir.dstu2016may.model.Meta convertMeta(org.hl7.fhir.dstu3.model.Meta src) throws FHIRException {
023    if (src == null || src.isEmpty()) return null;
024    org.hl7.fhir.dstu2016may.model.Meta tgt = new org.hl7.fhir.dstu2016may.model.Meta();
025    ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt);
026    if (src.hasVersionId()) tgt.setVersionIdElement(Id14_30.convertId(src.getVersionIdElement()));
027    if (src.hasLastUpdated()) tgt.setLastUpdatedElement(Instant14_30.convertInstant(src.getLastUpdatedElement()));
028    for (org.hl7.fhir.dstu3.model.UriType t : src.getProfile()) tgt.addProfile(t.getValue());
029    for (org.hl7.fhir.dstu3.model.Coding t : src.getSecurity()) tgt.addSecurity(Code14_30.convertCoding(t));
030    for (org.hl7.fhir.dstu3.model.Coding t : src.getTag()) tgt.addTag(Code14_30.convertCoding(t));
031    return tgt;
032  }
033}