001package org.hl7.fhir.convertors.conv10_40.resources10_40; 002 003import org.hl7.fhir.convertors.context.ConversionContext10_40; 004import org.hl7.fhir.convertors.conv10_40.datatypes10_40.Reference10_40; 005import org.hl7.fhir.convertors.conv10_40.datatypes10_40.complextypes10_40.CodeableConcept10_40; 006import org.hl7.fhir.convertors.conv10_40.datatypes10_40.complextypes10_40.Identifier10_40; 007import org.hl7.fhir.convertors.conv10_40.datatypes10_40.complextypes10_40.Period10_40; 008import org.hl7.fhir.convertors.conv10_40.datatypes10_40.primitivetypes10_40.String10_40; 009import org.hl7.fhir.exceptions.FHIRException; 010 011public class Schedule10_40 { 012 013 public static org.hl7.fhir.r4.model.Schedule convertSchedule(org.hl7.fhir.dstu2.model.Schedule src) throws FHIRException { 014 if (src == null || src.isEmpty()) 015 return null; 016 org.hl7.fhir.r4.model.Schedule tgt = new org.hl7.fhir.r4.model.Schedule(); 017 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyDomainResource(src, tgt); 018 for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) 019 tgt.addIdentifier(Identifier10_40.convertIdentifier(t)); 020 for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) 021 tgt.addServiceType(CodeableConcept10_40.convertCodeableConcept(t)); 022 if (src.hasActor()) 023 tgt.addActor(Reference10_40.convertReference(src.getActor())); 024 if (src.hasPlanningHorizon()) 025 tgt.setPlanningHorizon(Period10_40.convertPeriod(src.getPlanningHorizon())); 026 if (src.hasCommentElement()) 027 tgt.setCommentElement(String10_40.convertString(src.getCommentElement())); 028 return tgt; 029 } 030 031 public static org.hl7.fhir.dstu2.model.Schedule convertSchedule(org.hl7.fhir.r4.model.Schedule src) throws FHIRException { 032 if (src == null || src.isEmpty()) 033 return null; 034 org.hl7.fhir.dstu2.model.Schedule tgt = new org.hl7.fhir.dstu2.model.Schedule(); 035 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyDomainResource(src, tgt); 036 for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) 037 tgt.addIdentifier(Identifier10_40.convertIdentifier(t)); 038 for (org.hl7.fhir.r4.model.CodeableConcept t : src.getServiceType()) 039 tgt.addType(CodeableConcept10_40.convertCodeableConcept(t)); 040 if (src.hasActor()) 041 tgt.setActor(Reference10_40.convertReference(src.getActorFirstRep())); 042 if (src.hasPlanningHorizon()) 043 tgt.setPlanningHorizon(Period10_40.convertPeriod(src.getPlanningHorizon())); 044 if (src.hasCommentElement()) 045 tgt.setCommentElement(String10_40.convertString(src.getCommentElement())); 046 return tgt; 047 } 048}