001package org.hl7.fhir.convertors.conv10_30.resources10_30;
002
003import org.hl7.fhir.convertors.context.ConversionContext10_30;
004import org.hl7.fhir.convertors.conv10_30.datatypes10_30.Reference10_30;
005import org.hl7.fhir.convertors.conv10_30.datatypes10_30.complextypes10_30.CodeableConcept10_30;
006import org.hl7.fhir.convertors.conv10_30.datatypes10_30.complextypes10_30.Identifier10_30;
007import org.hl7.fhir.convertors.conv10_30.datatypes10_30.primitivetypes10_30.Instant10_30;
008import org.hl7.fhir.convertors.conv10_30.datatypes10_30.primitivetypes10_30.String10_30;
009import org.hl7.fhir.exceptions.FHIRException;
010
011public class DeviceComponent10_30 {
012
013  public static org.hl7.fhir.dstu2.model.DeviceComponent convertDeviceComponent(org.hl7.fhir.dstu3.model.DeviceComponent src) throws FHIRException {
014    if (src == null || src.isEmpty())
015      return null;
016    org.hl7.fhir.dstu2.model.DeviceComponent tgt = new org.hl7.fhir.dstu2.model.DeviceComponent();
017    ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyDomainResource(src, tgt);
018    if (src.hasType())
019      tgt.setType(CodeableConcept10_30.convertCodeableConcept(src.getType()));
020    if (src.hasIdentifier())
021      tgt.setIdentifier(Identifier10_30.convertIdentifier(src.getIdentifier()));
022    if (src.hasLastSystemChangeElement())
023      tgt.setLastSystemChangeElement(Instant10_30.convertInstant(src.getLastSystemChangeElement()));
024    if (src.hasSource())
025      tgt.setSource(Reference10_30.convertReference(src.getSource()));
026    if (src.hasParent())
027      tgt.setParent(Reference10_30.convertReference(src.getParent()));
028    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getOperationalStatus())
029      tgt.addOperationalStatus(CodeableConcept10_30.convertCodeableConcept(t));
030    if (src.hasParameterGroup())
031      tgt.setParameterGroup(CodeableConcept10_30.convertCodeableConcept(src.getParameterGroup()));
032    if (src.hasMeasurementPrinciple())
033      tgt.setMeasurementPrincipleElement(convertMeasmntPrinciple(src.getMeasurementPrincipleElement()));
034    for (org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent t : src.getProductionSpecification())
035      tgt.addProductionSpecification(convertDeviceComponentProductionSpecificationComponent(t));
036    if (src.hasLanguageCode())
037      tgt.setLanguageCode(CodeableConcept10_30.convertCodeableConcept(src.getLanguageCode()));
038    return tgt;
039  }
040
041  public static org.hl7.fhir.dstu3.model.DeviceComponent convertDeviceComponent(org.hl7.fhir.dstu2.model.DeviceComponent src) throws FHIRException {
042    if (src == null || src.isEmpty())
043      return null;
044    org.hl7.fhir.dstu3.model.DeviceComponent tgt = new org.hl7.fhir.dstu3.model.DeviceComponent();
045    ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyDomainResource(src, tgt);
046    if (src.hasType())
047      tgt.setType(CodeableConcept10_30.convertCodeableConcept(src.getType()));
048    if (src.hasIdentifier())
049      tgt.setIdentifier(Identifier10_30.convertIdentifier(src.getIdentifier()));
050    if (src.hasLastSystemChangeElement())
051      tgt.setLastSystemChangeElement(Instant10_30.convertInstant(src.getLastSystemChangeElement()));
052    if (src.hasSource())
053      tgt.setSource(Reference10_30.convertReference(src.getSource()));
054    if (src.hasParent())
055      tgt.setParent(Reference10_30.convertReference(src.getParent()));
056    for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getOperationalStatus())
057      tgt.addOperationalStatus(CodeableConcept10_30.convertCodeableConcept(t));
058    if (src.hasParameterGroup())
059      tgt.setParameterGroup(CodeableConcept10_30.convertCodeableConcept(src.getParameterGroup()));
060    if (src.hasMeasurementPrinciple())
061      tgt.setMeasurementPrincipleElement(convertMeasmntPrinciple(src.getMeasurementPrincipleElement()));
062    for (org.hl7.fhir.dstu2.model.DeviceComponent.DeviceComponentProductionSpecificationComponent t : src.getProductionSpecification())
063      tgt.addProductionSpecification(convertDeviceComponentProductionSpecificationComponent(t));
064    if (src.hasLanguageCode())
065      tgt.setLanguageCode(CodeableConcept10_30.convertCodeableConcept(src.getLanguageCode()));
066    return tgt;
067  }
068
069  public static org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent convertDeviceComponentProductionSpecificationComponent(org.hl7.fhir.dstu2.model.DeviceComponent.DeviceComponentProductionSpecificationComponent src) throws FHIRException {
070    if (src == null || src.isEmpty())
071      return null;
072    org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent tgt = new org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent();
073    ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyBackboneElement(src,tgt);
074    if (src.hasSpecType())
075      tgt.setSpecType(CodeableConcept10_30.convertCodeableConcept(src.getSpecType()));
076    if (src.hasComponentId())
077      tgt.setComponentId(Identifier10_30.convertIdentifier(src.getComponentId()));
078    if (src.hasProductionSpecElement())
079      tgt.setProductionSpecElement(String10_30.convertString(src.getProductionSpecElement()));
080    return tgt;
081  }
082
083  public static org.hl7.fhir.dstu2.model.DeviceComponent.DeviceComponentProductionSpecificationComponent convertDeviceComponentProductionSpecificationComponent(org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent src) throws FHIRException {
084    if (src == null || src.isEmpty())
085      return null;
086    org.hl7.fhir.dstu2.model.DeviceComponent.DeviceComponentProductionSpecificationComponent tgt = new org.hl7.fhir.dstu2.model.DeviceComponent.DeviceComponentProductionSpecificationComponent();
087    ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyBackboneElement(src,tgt);
088    if (src.hasSpecType())
089      tgt.setSpecType(CodeableConcept10_30.convertCodeableConcept(src.getSpecType()));
090    if (src.hasComponentId())
091      tgt.setComponentId(Identifier10_30.convertIdentifier(src.getComponentId()));
092    if (src.hasProductionSpecElement())
093      tgt.setProductionSpecElement(String10_30.convertString(src.getProductionSpecElement()));
094    return tgt;
095  }
096
097  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple> convertMeasmntPrinciple(org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple> src) throws FHIRException {
098    if (src == null || src.isEmpty())
099      return null;
100    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrincipleEnumFactory());
101    ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyElement(src, tgt);
102    switch (src.getValue()) {
103      case OTHER:
104        tgt.setValue(org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.OTHER);
105        break;
106      case CHEMICAL:
107        tgt.setValue(org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.CHEMICAL);
108        break;
109      case ELECTRICAL:
110        tgt.setValue(org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.ELECTRICAL);
111        break;
112      case IMPEDANCE:
113        tgt.setValue(org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.IMPEDANCE);
114        break;
115      case NUCLEAR:
116        tgt.setValue(org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.NUCLEAR);
117        break;
118      case OPTICAL:
119        tgt.setValue(org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.OPTICAL);
120        break;
121      case THERMAL:
122        tgt.setValue(org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.THERMAL);
123        break;
124      case BIOLOGICAL:
125        tgt.setValue(org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.BIOLOGICAL);
126        break;
127      case MECHANICAL:
128        tgt.setValue(org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.MECHANICAL);
129        break;
130      case ACOUSTICAL:
131        tgt.setValue(org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.ACOUSTICAL);
132        break;
133      case MANUAL:
134        tgt.setValue(org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.MANUAL);
135        break;
136      default:
137        tgt.setValue(org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.NULL);
138        break;
139    }
140    return tgt;
141  }
142
143  static public org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple> convertMeasmntPrinciple(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple> src) throws FHIRException {
144    if (src == null || src.isEmpty())
145      return null;
146    org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple> tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrincipleEnumFactory());
147    ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyElement(src, tgt);
148    switch (src.getValue()) {
149      case OTHER:
150        tgt.setValue(org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.OTHER);
151        break;
152      case CHEMICAL:
153        tgt.setValue(org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.CHEMICAL);
154        break;
155      case ELECTRICAL:
156        tgt.setValue(org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.ELECTRICAL);
157        break;
158      case IMPEDANCE:
159        tgt.setValue(org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.IMPEDANCE);
160        break;
161      case NUCLEAR:
162        tgt.setValue(org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.NUCLEAR);
163        break;
164      case OPTICAL:
165        tgt.setValue(org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.OPTICAL);
166        break;
167      case THERMAL:
168        tgt.setValue(org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.THERMAL);
169        break;
170      case BIOLOGICAL:
171        tgt.setValue(org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.BIOLOGICAL);
172        break;
173      case MECHANICAL:
174        tgt.setValue(org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.MECHANICAL);
175        break;
176      case ACOUSTICAL:
177        tgt.setValue(org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.ACOUSTICAL);
178        break;
179      case MANUAL:
180        tgt.setValue(org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.MANUAL);
181        break;
182      default:
183        tgt.setValue(org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.NULL);
184        break;
185    }
186    return tgt;
187  }
188}