001package org.hl7.fhir.convertors.conv40_50.resources40_50;
002
003import org.hl7.fhir.convertors.conv40_50.datatypes40_50.BackboneElement40_50;
004import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.Attachment40_50;
005import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.CodeableConcept40_50;
006import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.Quantity40_50;
007import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.String40_50;
008import org.hl7.fhir.exceptions.FHIRException;
009
010public class ProdCharacteristic40_50 {
011  public static org.hl7.fhir.r5.model.ProdCharacteristic convertProdCharacteristic(org.hl7.fhir.r4.model.ProdCharacteristic src) throws FHIRException {
012    if (src == null) return null;
013    org.hl7.fhir.r5.model.ProdCharacteristic tgt = new org.hl7.fhir.r5.model.ProdCharacteristic();
014    BackboneElement40_50.copyBackboneElement(src, tgt);
015    if (src.hasHeight()) tgt.setHeight(Quantity40_50.convertQuantity(src.getHeight()));
016    if (src.hasWidth()) tgt.setWidth(Quantity40_50.convertQuantity(src.getWidth()));
017    if (src.hasDepth()) tgt.setDepth(Quantity40_50.convertQuantity(src.getDepth()));
018    if (src.hasWeight()) tgt.setWeight(Quantity40_50.convertQuantity(src.getWeight()));
019    if (src.hasNominalVolume()) tgt.setNominalVolume(Quantity40_50.convertQuantity(src.getNominalVolume()));
020    if (src.hasExternalDiameter()) tgt.setExternalDiameter(Quantity40_50.convertQuantity(src.getExternalDiameter()));
021    if (src.hasShape()) tgt.setShapeElement(String40_50.convertString(src.getShapeElement()));
022    for (org.hl7.fhir.r4.model.StringType t : src.getColor()) tgt.getColor().add(String40_50.convertString(t));
023    for (org.hl7.fhir.r4.model.StringType t : src.getImprint()) tgt.getImprint().add(String40_50.convertString(t));
024    for (org.hl7.fhir.r4.model.Attachment t : src.getImage()) tgt.addImage(Attachment40_50.convertAttachment(t));
025    if (src.hasScoring()) tgt.setScoring(CodeableConcept40_50.convertCodeableConcept(src.getScoring()));
026    return tgt;
027  }
028
029  public static org.hl7.fhir.r4.model.ProdCharacteristic convertProdCharacteristic(org.hl7.fhir.r5.model.ProdCharacteristic src) throws FHIRException {
030    if (src == null) return null;
031    org.hl7.fhir.r4.model.ProdCharacteristic tgt = new org.hl7.fhir.r4.model.ProdCharacteristic();
032    BackboneElement40_50.copyBackboneElement(src, tgt);
033    if (src.hasHeight()) tgt.setHeight(Quantity40_50.convertQuantity(src.getHeight()));
034    if (src.hasWidth()) tgt.setWidth(Quantity40_50.convertQuantity(src.getWidth()));
035    if (src.hasDepth()) tgt.setDepth(Quantity40_50.convertQuantity(src.getDepth()));
036    if (src.hasWeight()) tgt.setWeight(Quantity40_50.convertQuantity(src.getWeight()));
037    if (src.hasNominalVolume()) tgt.setNominalVolume(Quantity40_50.convertQuantity(src.getNominalVolume()));
038    if (src.hasExternalDiameter()) tgt.setExternalDiameter(Quantity40_50.convertQuantity(src.getExternalDiameter()));
039    if (src.hasShape()) tgt.setShapeElement(String40_50.convertString(src.getShapeElement()));
040    for (org.hl7.fhir.r5.model.StringType t : src.getColor()) tgt.getColor().add(String40_50.convertString(t));
041    for (org.hl7.fhir.r5.model.StringType t : src.getImprint()) tgt.getImprint().add(String40_50.convertString(t));
042    for (org.hl7.fhir.r5.model.Attachment t : src.getImage()) tgt.addImage(Attachment40_50.convertAttachment(t));
043    if (src.hasScoring()) tgt.setScoring(CodeableConcept40_50.convertCodeableConcept(src.getScoring()));
044    return tgt;
045  }
046}