001package org.hl7.fhir.convertors.conv40_50.resources40_50;
002
003import org.hl7.fhir.convertors.context.ConversionContext40_50;
004import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.String40_50;
005import org.hl7.fhir.exceptions.FHIRException;
006
007/*
008  Copyright (c) 2011+, HL7, Inc.
009  All rights reserved.
010  
011  Redistribution and use in source and binary forms, with or without modification, 
012  are permitted provided that the following conditions are met:
013  
014   * Redistributions of source code must retain the above copyright notice, this 
015     list of conditions and the following disclaimer.
016   * Redistributions in binary form must reproduce the above copyright notice, 
017     this list of conditions and the following disclaimer in the documentation 
018     and/or other materials provided with the distribution.
019   * Neither the name of HL7 nor the names of its contributors may be used to 
020     endorse or promote products derived from this software without specific 
021     prior written permission.
022  
023  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
024  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
025  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
026  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
027  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
028  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
029  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
030  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
031  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
032  POSSIBILITY OF SUCH DAMAGE.
033  
034*/
035// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
036public class Parameters40_50 {
037
038  public static org.hl7.fhir.r5.model.Parameters convertParameters(org.hl7.fhir.r4.model.Parameters src) throws FHIRException {
039    if (src == null)
040      return null;
041    org.hl7.fhir.r5.model.Parameters tgt = new org.hl7.fhir.r5.model.Parameters();
042    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyResource(src, tgt);
043    for (org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent t : src.getParameter())
044      tgt.addParameter(convertParametersParameterComponent(t));
045    return tgt;
046  }
047
048  public static org.hl7.fhir.r4.model.Parameters convertParameters(org.hl7.fhir.r5.model.Parameters src) throws FHIRException {
049    if (src == null)
050      return null;
051    org.hl7.fhir.r4.model.Parameters tgt = new org.hl7.fhir.r4.model.Parameters();
052    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyResource(src, tgt);
053    for (org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent t : src.getParameter())
054      tgt.addParameter(convertParametersParameterComponent(t));
055    return tgt;
056  }
057
058  public static org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent src) throws FHIRException {
059    if (src == null)
060      return null;
061    org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent();
062    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
063    if (src.hasName())
064      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
065    if (src.hasValue())
066      tgt.setValue(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getValue()));
067    if (src.hasResource())
068      tgt.setResource(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertResource(src.getResource()));
069    for (org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent t : src.getPart())
070      tgt.addPart(convertParametersParameterComponent(t));
071    return tgt;
072  }
073
074  public static org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent src) throws FHIRException {
075    if (src == null)
076      return null;
077    org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent();
078    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
079    if (src.hasName())
080      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
081    if (src.hasValue())
082      tgt.setValue(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getValue()));
083    if (src.hasResource())
084      tgt.setResource(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertResource(src.getResource()));
085    for (org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent t : src.getPart())
086      tgt.addPart(convertParametersParameterComponent(t));
087    return tgt;
088  }
089}