001package org.hl7.fhir.convertors.conv43_50.datatypes43_50.special43_50;
002
003import org.hl7.fhir.convertors.context.ConversionContext43_50;
004import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Coding43_50;
005import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Canonical43_50;
006import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Id43_50;
007import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Instant43_50;
008import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Uri43_50;
009import org.hl7.fhir.exceptions.FHIRException;
010
011public class Meta43_50 {
012  public static org.hl7.fhir.r5.model.Meta convertMeta(org.hl7.fhir.r4b.model.Meta src) throws FHIRException {
013    if (src == null) return null;
014    org.hl7.fhir.r5.model.Meta tgt = new org.hl7.fhir.r5.model.Meta();
015    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
016    if (src.hasVersionId()) tgt.setVersionIdElement(Id43_50.convertId(src.getVersionIdElement()));
017    if (src.hasLastUpdated()) tgt.setLastUpdatedElement(Instant43_50.convertInstant(src.getLastUpdatedElement()));
018    if (src.hasSource()) tgt.setSourceElement(Uri43_50.convertUri(src.getSourceElement()));
019    for (org.hl7.fhir.r4b.model.CanonicalType t : src.getProfile())
020      tgt.getProfile().add(Canonical43_50.convertCanonical(t));
021    for (org.hl7.fhir.r4b.model.Coding t : src.getSecurity()) tgt.addSecurity(Coding43_50.convertCoding(t));
022    for (org.hl7.fhir.r4b.model.Coding t : src.getTag()) tgt.addTag(Coding43_50.convertCoding(t));
023    return tgt;
024  }
025
026  public static org.hl7.fhir.r4b.model.Meta convertMeta(org.hl7.fhir.r5.model.Meta src) throws FHIRException {
027    if (src == null) return null;
028    org.hl7.fhir.r4b.model.Meta tgt = new org.hl7.fhir.r4b.model.Meta();
029    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
030    if (src.hasVersionId()) tgt.setVersionIdElement(Id43_50.convertId(src.getVersionIdElement()));
031    if (src.hasLastUpdated()) tgt.setLastUpdatedElement(Instant43_50.convertInstant(src.getLastUpdatedElement()));
032    if (src.hasSource()) tgt.setSourceElement(Uri43_50.convertUri(src.getSourceElement()));
033    for (org.hl7.fhir.r5.model.CanonicalType t : src.getProfile())
034      tgt.getProfile().add(Canonical43_50.convertCanonical(t));
035    for (org.hl7.fhir.r5.model.Coding t : src.getSecurity()) tgt.addSecurity(Coding43_50.convertCoding(t));
036    for (org.hl7.fhir.r5.model.Coding t : src.getTag()) tgt.addTag(Coding43_50.convertCoding(t));
037    return tgt;
038  }
039}