001package org.hl7.fhir.convertors.conv10_30;
002
003import org.hl7.fhir.convertors.VersionConvertor_10_30;
004import org.hl7.fhir.exceptions.FHIRException;
005
006public class EnrollmentRequest10_30 {
007
008    public static org.hl7.fhir.dstu3.model.EnrollmentRequest convertEnrollmentRequest(org.hl7.fhir.dstu2.model.EnrollmentRequest src) throws FHIRException {
009        if (src == null || src.isEmpty())
010            return null;
011        org.hl7.fhir.dstu3.model.EnrollmentRequest tgt = new org.hl7.fhir.dstu3.model.EnrollmentRequest();
012        VersionConvertor_10_30.copyDomainResource(src, tgt);
013        for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t));
014        if (src.hasCreatedElement())
015            tgt.setCreatedElement(VersionConvertor_10_30.convertDateTime(src.getCreatedElement()));
016        if (src.hasProvider())
017            tgt.setProvider(VersionConvertor_10_30.convertReference(src.getProvider()));
018        if (src.hasOrganization())
019            tgt.setOrganization(VersionConvertor_10_30.convertReference(src.getOrganization()));
020        if (src.hasSubject())
021            tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject()));
022        if (src.hasCoverage())
023            tgt.setCoverage(VersionConvertor_10_30.convertReference(src.getCoverage()));
024        return tgt;
025    }
026
027    public static org.hl7.fhir.dstu2.model.EnrollmentRequest convertEnrollmentRequest(org.hl7.fhir.dstu3.model.EnrollmentRequest src) throws FHIRException {
028        if (src == null || src.isEmpty())
029            return null;
030        org.hl7.fhir.dstu2.model.EnrollmentRequest tgt = new org.hl7.fhir.dstu2.model.EnrollmentRequest();
031        VersionConvertor_10_30.copyDomainResource(src, tgt);
032        for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t));
033        if (src.hasCreatedElement())
034            tgt.setCreatedElement(VersionConvertor_10_30.convertDateTime(src.getCreatedElement()));
035        if (src.hasCoverage())
036            tgt.setCoverage(VersionConvertor_10_30.convertReference(src.getCoverage()));
037        return tgt;
038    }
039}