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;
011import org.hl7.fhir.r5.model.CodeableReference;
012
013public class Schedule30_50 {
014
015  public static org.hl7.fhir.dstu3.model.Schedule convertSchedule(org.hl7.fhir.r5.model.Schedule src) throws FHIRException {
016    if (src == null)
017      return null;
018    org.hl7.fhir.dstu3.model.Schedule tgt = new org.hl7.fhir.dstu3.model.Schedule();
019    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
020    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
021      tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
022    if (src.hasActive())
023      tgt.setActiveElement(Boolean30_50.convertBoolean(src.getActiveElement()));
024    if (src.hasServiceCategory())
025      tgt.setServiceCategory(CodeableConcept30_50.convertCodeableConcept(src.getServiceCategoryFirstRep()));
026    for (CodeableReference t : src.getServiceType())
027      if (t.hasConcept())
028        tgt.addServiceType(CodeableConcept30_50.convertCodeableConcept(t.getConcept() ));
029    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialty())
030      tgt.addSpecialty(CodeableConcept30_50.convertCodeableConcept(t));
031    for (org.hl7.fhir.r5.model.Reference t : src.getActor()) tgt.addActor(Reference30_50.convertReference(t));
032    if (src.hasPlanningHorizon())
033      tgt.setPlanningHorizon(Period30_50.convertPeriod(src.getPlanningHorizon()));
034    if (src.hasComment())
035      tgt.setCommentElement(String30_50.convertString(src.getCommentElement()));
036    return tgt;
037  }
038
039  public static org.hl7.fhir.r5.model.Schedule convertSchedule(org.hl7.fhir.dstu3.model.Schedule src) throws FHIRException {
040    if (src == null)
041      return null;
042    org.hl7.fhir.r5.model.Schedule tgt = new org.hl7.fhir.r5.model.Schedule();
043    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
044    for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())
045      tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
046    if (src.hasActive())
047      tgt.setActiveElement(Boolean30_50.convertBoolean(src.getActiveElement()));
048    if (src.hasServiceCategory())
049      tgt.addServiceCategory(CodeableConcept30_50.convertCodeableConcept(src.getServiceCategory()));
050    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType())
051      tgt.addServiceType(new CodeableReference().setConcept(CodeableConcept30_50.convertCodeableConcept(t)));
052    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty())
053      tgt.addSpecialty(CodeableConcept30_50.convertCodeableConcept(t));
054    for (org.hl7.fhir.dstu3.model.Reference t : src.getActor()) tgt.addActor(Reference30_50.convertReference(t));
055    if (src.hasPlanningHorizon())
056      tgt.setPlanningHorizon(Period30_50.convertPeriod(src.getPlanningHorizon()));
057    if (src.hasComment())
058      tgt.setCommentElement(String30_50.convertStringToMarkdown(src.getCommentElement()));
059    return tgt;
060  }
061}