001package org.hl7.fhir.convertors.conv40_50.datatypes40_50.special40_50;
002
003import org.hl7.fhir.convertors.context.ConversionContext40_50;
004import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.Coding40_50;
005import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Canonical40_50;
006import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Id40_50;
007import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Instant40_50;
008import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Uri40_50;
009import org.hl7.fhir.exceptions.FHIRException;
010
011public class Meta40_50 {
012  public static org.hl7.fhir.r5.model.Meta convertMeta(org.hl7.fhir.r4.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    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
016    if (src.hasVersionId()) tgt.setVersionIdElement(Id40_50.convertId(src.getVersionIdElement()));
017    if (src.hasLastUpdated()) tgt.setLastUpdatedElement(Instant40_50.convertInstant(src.getLastUpdatedElement()));
018    if (src.hasSource()) tgt.setSourceElement(Uri40_50.convertUri(src.getSourceElement()));
019    for (org.hl7.fhir.r4.model.CanonicalType t : src.getProfile())
020      tgt.getProfile().add(Canonical40_50.convertCanonical(t));
021    for (org.hl7.fhir.r4.model.Coding t : src.getSecurity()) tgt.addSecurity(Coding40_50.convertCoding(t));
022    for (org.hl7.fhir.r4.model.Coding t : src.getTag()) tgt.addTag(Coding40_50.convertCoding(t));
023    return tgt;
024  }
025
026  public static org.hl7.fhir.r4.model.Meta convertMeta(org.hl7.fhir.r5.model.Meta src) throws FHIRException {
027    if (src == null) return null;
028    org.hl7.fhir.r4.model.Meta tgt = new org.hl7.fhir.r4.model.Meta();
029    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
030    if (src.hasVersionId()) tgt.setVersionIdElement(Id40_50.convertId(src.getVersionIdElement()));
031    if (src.hasLastUpdated()) tgt.setLastUpdatedElement(Instant40_50.convertInstant(src.getLastUpdatedElement()));
032    if (src.hasSource()) tgt.setSourceElement(Uri40_50.convertUri(src.getSourceElement()));
033    for (org.hl7.fhir.r5.model.CanonicalType t : src.getProfile())
034      tgt.getProfile().add(Canonical40_50.convertCanonical(t));
035    for (org.hl7.fhir.r5.model.Coding t : src.getSecurity()) tgt.addSecurity(Coding40_50.convertCoding(t));
036    for (org.hl7.fhir.r5.model.Coding t : src.getTag()) tgt.addTag(Coding40_50.convertCoding(t));
037    return tgt;
038  }
039}