001package org.hl7.fhir.convertors.conv30_50.resources30_50;
002
003import org.hl7.fhir.convertors.context.ConversionContext30_50;
004import org.hl7.fhir.convertors.conv30_50.datatypes30_50.Reference30_50;
005import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.CodeableConcept30_50;
006import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.Identifier30_50;
007import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.Period30_50;
008import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Boolean30_50;
009import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.String30_50;
010import org.hl7.fhir.exceptions.FHIRException;
011
012public class Schedule30_50 {
013
014  public static org.hl7.fhir.dstu3.model.Schedule convertSchedule(org.hl7.fhir.r5.model.Schedule src) throws FHIRException {
015    if (src == null)
016      return null;
017    org.hl7.fhir.dstu3.model.Schedule tgt = new org.hl7.fhir.dstu3.model.Schedule();
018    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
019    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
020      tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
021    if (src.hasActive())
022      tgt.setActiveElement(Boolean30_50.convertBoolean(src.getActiveElement()));
023    if (src.hasServiceCategory())
024      tgt.setServiceCategory(CodeableConcept30_50.convertCodeableConcept(src.getServiceCategoryFirstRep()));
025    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceType())
026      tgt.addServiceType(CodeableConcept30_50.convertCodeableConcept(t));
027    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialty())
028      tgt.addSpecialty(CodeableConcept30_50.convertCodeableConcept(t));
029    for (org.hl7.fhir.r5.model.Reference t : src.getActor()) tgt.addActor(Reference30_50.convertReference(t));
030    if (src.hasPlanningHorizon())
031      tgt.setPlanningHorizon(Period30_50.convertPeriod(src.getPlanningHorizon()));
032    if (src.hasComment())
033      tgt.setCommentElement(String30_50.convertString(src.getCommentElement()));
034    return tgt;
035  }
036
037  public static org.hl7.fhir.r5.model.Schedule convertSchedule(org.hl7.fhir.dstu3.model.Schedule src) throws FHIRException {
038    if (src == null)
039      return null;
040    org.hl7.fhir.r5.model.Schedule tgt = new org.hl7.fhir.r5.model.Schedule();
041    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
042    for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())
043      tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
044    if (src.hasActive())
045      tgt.setActiveElement(Boolean30_50.convertBoolean(src.getActiveElement()));
046    if (src.hasServiceCategory())
047      tgt.addServiceCategory(CodeableConcept30_50.convertCodeableConcept(src.getServiceCategory()));
048    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType())
049      tgt.addServiceType(CodeableConcept30_50.convertCodeableConcept(t));
050    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty())
051      tgt.addSpecialty(CodeableConcept30_50.convertCodeableConcept(t));
052    for (org.hl7.fhir.dstu3.model.Reference t : src.getActor()) tgt.addActor(Reference30_50.convertReference(t));
053    if (src.hasPlanningHorizon())
054      tgt.setPlanningHorizon(Period30_50.convertPeriod(src.getPlanningHorizon()));
055    if (src.hasComment())
056      tgt.setCommentElement(String30_50.convertString(src.getCommentElement()));
057    return tgt;
058  }
059}