001package org.hl7.fhir.convertors.conv43_50.resources43_50;
002
003import org.hl7.fhir.convertors.context.ConversionContext43_50;
004import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Annotation43_50;
005import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.CodeableConcept43_50;
006import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.ContactPoint43_50;
007import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Identifier43_50;
008import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Quantity43_50;
009import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Boolean43_50;
010import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.String43_50;
011import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Uri43_50;
012import org.hl7.fhir.convertors.conv43_50.datatypes43_50.special43_50.Reference43_50;
013import org.hl7.fhir.exceptions.FHIRException;
014import org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionClassificationComponent;
015import org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionVersionComponent;
016
017/*
018  Copyright (c) 2011+, HL7, Inc.
019  All rights reserved.
020  
021  Redistribution and use in source and binary forms, with or without modification, 
022  are permitted provided that the following conditions are met:
023  
024   * Redistributions of source code must retain the above copyright notice, this 
025     list of conditions and the following disclaimer.
026   * Redistributions in binary form must reproduce the above copyright notice, 
027     this list of conditions and the following disclaimer in the documentation 
028     and/or other materials provided with the distribution.
029   * Neither the name of HL7 nor the names of its contributors may be used to 
030     endorse or promote products derived from this software without specific 
031     prior written permission.
032  
033  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
034  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
035  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
036  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
037  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
038  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
039  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
040  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
041  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
042  POSSIBILITY OF SUCH DAMAGE.
043  
044*/
045// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
046public class DeviceDefinition43_50 {
047
048  public static org.hl7.fhir.r5.model.DeviceDefinition convertDeviceDefinition(org.hl7.fhir.r4b.model.DeviceDefinition src) throws FHIRException {
049    if (src == null)
050      return null;
051    org.hl7.fhir.r5.model.DeviceDefinition tgt = new org.hl7.fhir.r5.model.DeviceDefinition();
052    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt);
053    for (org.hl7.fhir.r4b.model.Identifier t : src.getIdentifier())
054      tgt.addIdentifier(Identifier43_50.convertIdentifier(t));
055    for (org.hl7.fhir.r4b.model.DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent t : src.getUdiDeviceIdentifier())
056      tgt.addUdiDeviceIdentifier(convertDeviceDefinitionUdiDeviceIdentifierComponent(t));
057    if (src.hasManufacturerReference())
058      tgt.setManufacturer(Reference43_50.convertReference(src.getManufacturerReference()));
059    for (org.hl7.fhir.r4b.model.DeviceDefinition.DeviceDefinitionDeviceNameComponent t : src.getDeviceName())
060      tgt.addDeviceName(convertDeviceDefinitionDeviceNameComponent(t));
061    if (src.hasModelNumber())
062      tgt.setModelNumberElement(String43_50.convertString(src.getModelNumberElement()));
063    if (src.hasType())
064      tgt.addClassification().setType(CodeableConcept43_50.convertCodeableConcept(src.getType()));
065//    for (org.hl7.fhir.r4b.model.DeviceDefinition.DeviceDefinitionSpecializationComponent t : src.getSpecialization())
066//      tgt.addSpecialization(convertDeviceDefinitionSpecializationComponent(t));
067    for (org.hl7.fhir.r4b.model.StringType t : src.getVersion())
068      tgt.getVersion().add(new DeviceDefinitionVersionComponent().setValueElement(String43_50.convertString(t)));
069    for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getSafety())
070      tgt.addSafety(CodeableConcept43_50.convertCodeableConcept(t));
071    for (org.hl7.fhir.r4b.model.ProductShelfLife t : src.getShelfLifeStorage())
072      tgt.addShelfLifeStorage(ProductShelfLife43_50.convertProductShelfLife(t));
073//    if (src.hasPhysicalCharacteristics())
074//      tgt.setPhysicalCharacteristics(ProdCharacteristic43_50.convertProdCharacteristic(src.getPhysicalCharacteristics()));
075    for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getLanguageCode())
076      tgt.addLanguageCode(CodeableConcept43_50.convertCodeableConcept(t));
077//    for (org.hl7.fhir.r4b.model.DeviceDefinition.DeviceDefinitionCapabilityComponent t : src.getCapability())
078//      tgt.addCapability(convertDeviceDefinitionCapabilityComponent(t));
079    for (org.hl7.fhir.r4b.model.DeviceDefinition.DeviceDefinitionPropertyComponent t : src.getProperty())
080      tgt.addProperty(convertDeviceDefinitionPropertyComponent(t));
081    if (src.hasOwner())
082      tgt.setOwner(Reference43_50.convertReference(src.getOwner()));
083    for (org.hl7.fhir.r4b.model.ContactPoint t : src.getContact())
084      tgt.addContact(ContactPoint43_50.convertContactPoint(t));
085//    if (src.hasOnlineInformation())
086//      tgt.setOnlineInformationElement(Uri43_50.convertUri(src.getOnlineInformationElement()));
087    for (org.hl7.fhir.r4b.model.Annotation t : src.getNote()) tgt.addNote(Annotation43_50.convertAnnotation(t));
088//    if (src.hasParentDevice())
089//      tgt.setParentDevice(Reference43_50.convertReference(src.getParentDevice()));
090    for (org.hl7.fhir.r4b.model.DeviceDefinition.DeviceDefinitionMaterialComponent t : src.getMaterial())
091      tgt.addMaterial(convertDeviceDefinitionMaterialComponent(t));
092    return tgt;
093  }
094
095  public static org.hl7.fhir.r4b.model.DeviceDefinition convertDeviceDefinition(org.hl7.fhir.r5.model.DeviceDefinition src) throws FHIRException {
096    if (src == null)
097      return null;
098    org.hl7.fhir.r4b.model.DeviceDefinition tgt = new org.hl7.fhir.r4b.model.DeviceDefinition();
099    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt);
100    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
101      tgt.addIdentifier(Identifier43_50.convertIdentifier(t));
102    for (org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent t : src.getUdiDeviceIdentifier())
103      tgt.addUdiDeviceIdentifier(convertDeviceDefinitionUdiDeviceIdentifierComponent(t));
104    if (src.hasManufacturer())
105      tgt.setManufacturer(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getManufacturer()));
106    for (org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionDeviceNameComponent t : src.getDeviceName())
107      tgt.addDeviceName(convertDeviceDefinitionDeviceNameComponent(t));
108    if (src.hasModelNumber())
109      tgt.setModelNumberElement(String43_50.convertString(src.getModelNumberElement()));
110    for (DeviceDefinitionClassificationComponent t : src.getClassification())
111      tgt.setType(CodeableConcept43_50.convertCodeableConcept(t.getType()));
112//    for (org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionSpecializationComponent t : src.getSpecialization())
113//      tgt.addSpecialization(convertDeviceDefinitionSpecializationComponent(t));
114    for (DeviceDefinitionVersionComponent t : src.getVersion())
115      tgt.getVersion().add(String43_50.convertString(t.getValueElement()));
116    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSafety())
117      tgt.addSafety(CodeableConcept43_50.convertCodeableConcept(t));
118    for (org.hl7.fhir.r5.model.ProductShelfLife t : src.getShelfLifeStorage())
119      tgt.addShelfLifeStorage(ProductShelfLife43_50.convertProductShelfLife(t));
120//    if (src.hasPhysicalCharacteristics())
121//      tgt.setPhysicalCharacteristics(ProdCharacteristic43_50.convertProdCharacteristic(src.getPhysicalCharacteristics()));
122    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getLanguageCode())
123      tgt.addLanguageCode(CodeableConcept43_50.convertCodeableConcept(t));
124//    for (org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionCapabilityComponent t : src.getCapability())
125//      tgt.addCapability(convertDeviceDefinitionCapabilityComponent(t));
126    for (org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionPropertyComponent t : src.getProperty())
127      tgt.addProperty(convertDeviceDefinitionPropertyComponent(t));
128    if (src.hasOwner())
129      tgt.setOwner(Reference43_50.convertReference(src.getOwner()));
130    for (org.hl7.fhir.r5.model.ContactPoint t : src.getContact())
131      tgt.addContact(ContactPoint43_50.convertContactPoint(t));
132//    if (src.hasOnlineInformation())
133//      tgt.setOnlineInformationElement(Uri43_50.convertUri(src.getOnlineInformationElement()));
134    for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(Annotation43_50.convertAnnotation(t));
135//    if (src.hasParentDevice())
136//      tgt.setParentDevice(Reference43_50.convertReference(src.getParentDevice()));
137    for (org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionMaterialComponent t : src.getMaterial())
138      tgt.addMaterial(convertDeviceDefinitionMaterialComponent(t));
139    return tgt;
140  }
141
142  public static org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent convertDeviceDefinitionUdiDeviceIdentifierComponent(org.hl7.fhir.r4b.model.DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent src) throws FHIRException {
143    if (src == null)
144      return null;
145    org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent tgt = new org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent();
146    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
147    if (src.hasDeviceIdentifier())
148      tgt.setDeviceIdentifierElement(String43_50.convertString(src.getDeviceIdentifierElement()));
149    if (src.hasIssuer())
150      tgt.setIssuerElement(Uri43_50.convertUri(src.getIssuerElement()));
151    if (src.hasJurisdiction())
152      tgt.setJurisdictionElement(Uri43_50.convertUri(src.getJurisdictionElement()));
153    return tgt;
154  }
155
156  public static org.hl7.fhir.r4b.model.DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent convertDeviceDefinitionUdiDeviceIdentifierComponent(org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent src) throws FHIRException {
157    if (src == null)
158      return null;
159    org.hl7.fhir.r4b.model.DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent tgt = new org.hl7.fhir.r4b.model.DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent();
160    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
161    if (src.hasDeviceIdentifier())
162      tgt.setDeviceIdentifierElement(String43_50.convertString(src.getDeviceIdentifierElement()));
163    if (src.hasIssuer())
164      tgt.setIssuerElement(Uri43_50.convertUri(src.getIssuerElement()));
165    if (src.hasJurisdiction())
166      tgt.setJurisdictionElement(Uri43_50.convertUri(src.getJurisdictionElement()));
167    return tgt;
168  }
169
170  public static org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionDeviceNameComponent convertDeviceDefinitionDeviceNameComponent(org.hl7.fhir.r4b.model.DeviceDefinition.DeviceDefinitionDeviceNameComponent src) throws FHIRException {
171    if (src == null)
172      return null;
173    org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionDeviceNameComponent tgt = new org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionDeviceNameComponent();
174    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
175    if (src.hasName())
176      tgt.setNameElement(String43_50.convertString(src.getNameElement()));
177    if (src.hasType())
178      tgt.setTypeElement(convertDeviceNameType(src.getTypeElement()));
179    return tgt;
180  }
181
182  public static org.hl7.fhir.r4b.model.DeviceDefinition.DeviceDefinitionDeviceNameComponent convertDeviceDefinitionDeviceNameComponent(org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionDeviceNameComponent src) throws FHIRException {
183    if (src == null)
184      return null;
185    org.hl7.fhir.r4b.model.DeviceDefinition.DeviceDefinitionDeviceNameComponent tgt = new org.hl7.fhir.r4b.model.DeviceDefinition.DeviceDefinitionDeviceNameComponent();
186    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
187    if (src.hasName())
188      tgt.setNameElement(String43_50.convertString(src.getNameElement()));
189    if (src.hasType())
190      tgt.setTypeElement(convertDeviceNameType(src.getTypeElement()));
191    return tgt;
192  }
193
194  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.DeviceNameType> convertDeviceNameType(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.DeviceNameType> src) throws FHIRException {
195    if (src == null || src.isEmpty())
196      return null;
197    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.DeviceNameType> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.DeviceNameTypeEnumFactory());
198    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
199    switch (src.getValue()) {
200      case USERFRIENDLYNAME:
201        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.DeviceNameType.USERFRIENDLYNAME);
202        break;
203      case PATIENTREPORTEDNAME:
204        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.DeviceNameType.PATIENTREPORTEDNAME);
205        break;
206      case MANUFACTURERNAME:
207        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.DeviceNameType.REGISTEREDNAME);
208        break;
209      case MODELNAME:
210        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.DeviceNameType.USERFRIENDLYNAME);
211        break;
212      default:
213        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.DeviceNameType.NULL);
214        break;
215    }
216    return tgt;
217  }
218
219  static public org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.DeviceNameType> convertDeviceNameType(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.DeviceNameType> src) throws FHIRException {
220    if (src == null || src.isEmpty())
221      return null;
222    org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.DeviceNameType> tgt = new org.hl7.fhir.r4b.model.Enumeration<>(new org.hl7.fhir.r4b.model.Enumerations.DeviceNameTypeEnumFactory());
223    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
224    switch (src.getValue()) {
225      case USERFRIENDLYNAME:
226        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.DeviceNameType.USERFRIENDLYNAME);
227        break;
228      case PATIENTREPORTEDNAME:
229        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.DeviceNameType.PATIENTREPORTEDNAME);
230        break;
231      case REGISTEREDNAME:
232        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.DeviceNameType.MANUFACTURERNAME);
233        break;
234      default:
235        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.DeviceNameType.NULL);
236        break;
237    }
238    return tgt;
239  }
240//
241//  public static org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionSpecializationComponent convertDeviceDefinitionSpecializationComponent(org.hl7.fhir.r4b.model.DeviceDefinition.DeviceDefinitionSpecializationComponent src) throws FHIRException {
242//    if (src == null)
243//      return null;
244//    org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionSpecializationComponent tgt = new org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionSpecializationComponent();
245//    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
246//    if (src.hasSystemType())
247//      tgt.setSystemTypeElement(String43_50.convertString(src.getSystemTypeElement()));
248//    if (src.hasVersion())
249//      tgt.setVersionElement(String43_50.convertString(src.getVersionElement()));
250//    return tgt;
251//  }
252//
253//  public static org.hl7.fhir.r4b.model.DeviceDefinition.DeviceDefinitionSpecializationComponent convertDeviceDefinitionSpecializationComponent(org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionSpecializationComponent src) throws FHIRException {
254//    if (src == null)
255//      return null;
256//    org.hl7.fhir.r4b.model.DeviceDefinition.DeviceDefinitionSpecializationComponent tgt = new org.hl7.fhir.r4b.model.DeviceDefinition.DeviceDefinitionSpecializationComponent();
257//    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
258//    if (src.hasSystemType())
259//      tgt.setSystemTypeElement(String43_50.convertString(src.getSystemTypeElement()));
260//    if (src.hasVersion())
261//      tgt.setVersionElement(String43_50.convertString(src.getVersionElement()));
262//    return tgt;
263//  }
264//
265//  public static org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionCapabilityComponent convertDeviceDefinitionCapabilityComponent(org.hl7.fhir.r4b.model.DeviceDefinition.DeviceDefinitionCapabilityComponent src) throws FHIRException {
266//    if (src == null)
267//      return null;
268//    org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionCapabilityComponent tgt = new org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionCapabilityComponent();
269//    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
270//    if (src.hasType())
271//      tgt.setType(CodeableConcept43_50.convertCodeableConcept(src.getType()));
272//    for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getDescription())
273//      tgt.addDescription(CodeableConcept43_50.convertCodeableConcept(t));
274//    return tgt;
275//  }
276//
277//  public static org.hl7.fhir.r4b.model.DeviceDefinition.DeviceDefinitionCapabilityComponent convertDeviceDefinitionCapabilityComponent(org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionCapabilityComponent src) throws FHIRException {
278//    if (src == null)
279//      return null;
280//    org.hl7.fhir.r4b.model.DeviceDefinition.DeviceDefinitionCapabilityComponent tgt = new org.hl7.fhir.r4b.model.DeviceDefinition.DeviceDefinitionCapabilityComponent();
281//    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
282//    if (src.hasType())
283//      tgt.setType(CodeableConcept43_50.convertCodeableConcept(src.getType()));
284//    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getDescription())
285//      tgt.addDescription(CodeableConcept43_50.convertCodeableConcept(t));
286//    return tgt;
287//  }
288
289  public static org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionPropertyComponent convertDeviceDefinitionPropertyComponent(org.hl7.fhir.r4b.model.DeviceDefinition.DeviceDefinitionPropertyComponent src) throws FHIRException {
290    if (src == null)
291      return null;
292    org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionPropertyComponent tgt = new org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionPropertyComponent();
293    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
294    if (src.hasType())
295      tgt.setType(CodeableConcept43_50.convertCodeableConcept(src.getType()));
296    for (org.hl7.fhir.r4b.model.Quantity t : src.getValueQuantity())
297      tgt.setValue(Quantity43_50.convertQuantity(t));
298    for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getValueCode())
299      tgt.setValue(CodeableConcept43_50.convertCodeableConcept(t));
300    return tgt;
301  }
302
303  public static org.hl7.fhir.r4b.model.DeviceDefinition.DeviceDefinitionPropertyComponent convertDeviceDefinitionPropertyComponent(org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionPropertyComponent src) throws FHIRException {
304    if (src == null)
305      return null;
306    org.hl7.fhir.r4b.model.DeviceDefinition.DeviceDefinitionPropertyComponent tgt = new org.hl7.fhir.r4b.model.DeviceDefinition.DeviceDefinitionPropertyComponent();
307    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
308    if (src.hasType())
309      tgt.setType(CodeableConcept43_50.convertCodeableConcept(src.getType()));
310    if (src.hasValueQuantity())
311      tgt.addValueQuantity(Quantity43_50.convertQuantity(src.getValueQuantity()));
312    if (src.hasValueCodeableConcept())
313      tgt.addValueCode(CodeableConcept43_50.convertCodeableConcept(src.getValueCodeableConcept()));
314    return tgt;
315  }
316
317  public static org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionMaterialComponent convertDeviceDefinitionMaterialComponent(org.hl7.fhir.r4b.model.DeviceDefinition.DeviceDefinitionMaterialComponent src) throws FHIRException {
318    if (src == null)
319      return null;
320    org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionMaterialComponent tgt = new org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionMaterialComponent();
321    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
322    if (src.hasSubstance())
323      tgt.setSubstance(CodeableConcept43_50.convertCodeableConcept(src.getSubstance()));
324    if (src.hasAlternate())
325      tgt.setAlternateElement(Boolean43_50.convertBoolean(src.getAlternateElement()));
326    if (src.hasAllergenicIndicator())
327      tgt.setAllergenicIndicatorElement(Boolean43_50.convertBoolean(src.getAllergenicIndicatorElement()));
328    return tgt;
329  }
330
331  public static org.hl7.fhir.r4b.model.DeviceDefinition.DeviceDefinitionMaterialComponent convertDeviceDefinitionMaterialComponent(org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionMaterialComponent src) throws FHIRException {
332    if (src == null)
333      return null;
334    org.hl7.fhir.r4b.model.DeviceDefinition.DeviceDefinitionMaterialComponent tgt = new org.hl7.fhir.r4b.model.DeviceDefinition.DeviceDefinitionMaterialComponent();
335    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
336    if (src.hasSubstance())
337      tgt.setSubstance(CodeableConcept43_50.convertCodeableConcept(src.getSubstance()));
338    if (src.hasAlternate())
339      tgt.setAlternateElement(Boolean43_50.convertBoolean(src.getAlternateElement()));
340    if (src.hasAllergenicIndicator())
341      tgt.setAllergenicIndicatorElement(Boolean43_50.convertBoolean(src.getAllergenicIndicatorElement()));
342    return tgt;
343  }
344}