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.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.Identifier40_50;
007import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Integer40_50;
008import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.String40_50;
009import org.hl7.fhir.exceptions.FHIRException;
010
011/*
012  Copyright (c) 2011+, HL7, Inc.
013  All rights reserved.
014  
015  Redistribution and use in source and binary forms, with or without modification, 
016  are permitted provided that the following conditions are met:
017  
018   * Redistributions of source code must retain the above copyright notice, this 
019     list of conditions and the following disclaimer.
020   * Redistributions in binary form must reproduce the above copyright notice, 
021     this list of conditions and the following disclaimer in the documentation 
022     and/or other materials provided with the distribution.
023   * Neither the name of HL7 nor the names of its contributors may be used to 
024     endorse or promote products derived from this software without specific 
025     prior written permission.
026  
027  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
028  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
029  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
030  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
031  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
032  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
033  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
034  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
035  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
036  POSSIBILITY OF SUCH DAMAGE.
037  
038*/
039// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
040public class SubstanceNucleicAcid40_50 {
041
042  public static org.hl7.fhir.r5.model.SubstanceNucleicAcid convertSubstanceNucleicAcid(org.hl7.fhir.r4.model.SubstanceNucleicAcid src) throws FHIRException {
043    if (src == null)
044      return null;
045    org.hl7.fhir.r5.model.SubstanceNucleicAcid tgt = new org.hl7.fhir.r5.model.SubstanceNucleicAcid();
046    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt);
047    if (src.hasSequenceType())
048      tgt.setSequenceType(CodeableConcept40_50.convertCodeableConcept(src.getSequenceType()));
049    if (src.hasNumberOfSubunits())
050      tgt.setNumberOfSubunitsElement(Integer40_50.convertInteger(src.getNumberOfSubunitsElement()));
051    if (src.hasAreaOfHybridisation())
052      tgt.setAreaOfHybridisationElement(String40_50.convertString(src.getAreaOfHybridisationElement()));
053    if (src.hasOligoNucleotideType())
054      tgt.setOligoNucleotideType(CodeableConcept40_50.convertCodeableConcept(src.getOligoNucleotideType()));
055    for (org.hl7.fhir.r4.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent t : src.getSubunit())
056      tgt.addSubunit(convertSubstanceNucleicAcidSubunitComponent(t));
057    return tgt;
058  }
059
060  public static org.hl7.fhir.r4.model.SubstanceNucleicAcid convertSubstanceNucleicAcid(org.hl7.fhir.r5.model.SubstanceNucleicAcid src) throws FHIRException {
061    if (src == null)
062      return null;
063    org.hl7.fhir.r4.model.SubstanceNucleicAcid tgt = new org.hl7.fhir.r4.model.SubstanceNucleicAcid();
064    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt);
065    if (src.hasSequenceType())
066      tgt.setSequenceType(CodeableConcept40_50.convertCodeableConcept(src.getSequenceType()));
067    if (src.hasNumberOfSubunits())
068      tgt.setNumberOfSubunitsElement(Integer40_50.convertInteger(src.getNumberOfSubunitsElement()));
069    if (src.hasAreaOfHybridisation())
070      tgt.setAreaOfHybridisationElement(String40_50.convertString(src.getAreaOfHybridisationElement()));
071    if (src.hasOligoNucleotideType())
072      tgt.setOligoNucleotideType(CodeableConcept40_50.convertCodeableConcept(src.getOligoNucleotideType()));
073    for (org.hl7.fhir.r5.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent t : src.getSubunit())
074      tgt.addSubunit(convertSubstanceNucleicAcidSubunitComponent(t));
075    return tgt;
076  }
077
078  public static org.hl7.fhir.r5.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent convertSubstanceNucleicAcidSubunitComponent(org.hl7.fhir.r4.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent src) throws FHIRException {
079    if (src == null)
080      return null;
081    org.hl7.fhir.r5.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent tgt = new org.hl7.fhir.r5.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent();
082    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
083    if (src.hasSubunit())
084      tgt.setSubunitElement(Integer40_50.convertInteger(src.getSubunitElement()));
085    if (src.hasSequence())
086      tgt.setSequenceElement(String40_50.convertString(src.getSequenceElement()));
087    if (src.hasLength())
088      tgt.setLengthElement(Integer40_50.convertInteger(src.getLengthElement()));
089    if (src.hasSequenceAttachment())
090      tgt.setSequenceAttachment(Attachment40_50.convertAttachment(src.getSequenceAttachment()));
091    if (src.hasFivePrime())
092      tgt.setFivePrime(CodeableConcept40_50.convertCodeableConcept(src.getFivePrime()));
093    if (src.hasThreePrime())
094      tgt.setThreePrime(CodeableConcept40_50.convertCodeableConcept(src.getThreePrime()));
095    for (org.hl7.fhir.r4.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent t : src.getLinkage())
096      tgt.addLinkage(convertSubstanceNucleicAcidSubunitLinkageComponent(t));
097    for (org.hl7.fhir.r4.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent t : src.getSugar())
098      tgt.addSugar(convertSubstanceNucleicAcidSubunitSugarComponent(t));
099    return tgt;
100  }
101
102  public static org.hl7.fhir.r4.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent convertSubstanceNucleicAcidSubunitComponent(org.hl7.fhir.r5.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent src) throws FHIRException {
103    if (src == null)
104      return null;
105    org.hl7.fhir.r4.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent tgt = new org.hl7.fhir.r4.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent();
106    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
107    if (src.hasSubunit())
108      tgt.setSubunitElement(Integer40_50.convertInteger(src.getSubunitElement()));
109    if (src.hasSequence())
110      tgt.setSequenceElement(String40_50.convertString(src.getSequenceElement()));
111    if (src.hasLength())
112      tgt.setLengthElement(Integer40_50.convertInteger(src.getLengthElement()));
113    if (src.hasSequenceAttachment())
114      tgt.setSequenceAttachment(Attachment40_50.convertAttachment(src.getSequenceAttachment()));
115    if (src.hasFivePrime())
116      tgt.setFivePrime(CodeableConcept40_50.convertCodeableConcept(src.getFivePrime()));
117    if (src.hasThreePrime())
118      tgt.setThreePrime(CodeableConcept40_50.convertCodeableConcept(src.getThreePrime()));
119    for (org.hl7.fhir.r5.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent t : src.getLinkage())
120      tgt.addLinkage(convertSubstanceNucleicAcidSubunitLinkageComponent(t));
121    for (org.hl7.fhir.r5.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent t : src.getSugar())
122      tgt.addSugar(convertSubstanceNucleicAcidSubunitSugarComponent(t));
123    return tgt;
124  }
125
126  public static org.hl7.fhir.r5.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent convertSubstanceNucleicAcidSubunitLinkageComponent(org.hl7.fhir.r4.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent src) throws FHIRException {
127    if (src == null)
128      return null;
129    org.hl7.fhir.r5.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent tgt = new org.hl7.fhir.r5.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent();
130    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
131    if (src.hasConnectivity())
132      tgt.setConnectivityElement(String40_50.convertString(src.getConnectivityElement()));
133    if (src.hasIdentifier())
134      tgt.setIdentifier(Identifier40_50.convertIdentifier(src.getIdentifier()));
135    if (src.hasName())
136      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
137    if (src.hasResidueSite())
138      tgt.setResidueSiteElement(String40_50.convertString(src.getResidueSiteElement()));
139    return tgt;
140  }
141
142  public static org.hl7.fhir.r4.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent convertSubstanceNucleicAcidSubunitLinkageComponent(org.hl7.fhir.r5.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent src) throws FHIRException {
143    if (src == null)
144      return null;
145    org.hl7.fhir.r4.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent tgt = new org.hl7.fhir.r4.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent();
146    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
147    if (src.hasConnectivity())
148      tgt.setConnectivityElement(String40_50.convertString(src.getConnectivityElement()));
149    if (src.hasIdentifier())
150      tgt.setIdentifier(Identifier40_50.convertIdentifier(src.getIdentifier()));
151    if (src.hasName())
152      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
153    if (src.hasResidueSite())
154      tgt.setResidueSiteElement(String40_50.convertString(src.getResidueSiteElement()));
155    return tgt;
156  }
157
158  public static org.hl7.fhir.r5.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent convertSubstanceNucleicAcidSubunitSugarComponent(org.hl7.fhir.r4.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent src) throws FHIRException {
159    if (src == null)
160      return null;
161    org.hl7.fhir.r5.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent tgt = new org.hl7.fhir.r5.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent();
162    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
163    if (src.hasIdentifier())
164      tgt.setIdentifier(Identifier40_50.convertIdentifier(src.getIdentifier()));
165    if (src.hasName())
166      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
167    if (src.hasResidueSite())
168      tgt.setResidueSiteElement(String40_50.convertString(src.getResidueSiteElement()));
169    return tgt;
170  }
171
172  public static org.hl7.fhir.r4.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent convertSubstanceNucleicAcidSubunitSugarComponent(org.hl7.fhir.r5.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent src) throws FHIRException {
173    if (src == null)
174      return null;
175    org.hl7.fhir.r4.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent tgt = new org.hl7.fhir.r4.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent();
176    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
177    if (src.hasIdentifier())
178      tgt.setIdentifier(Identifier40_50.convertIdentifier(src.getIdentifier()));
179    if (src.hasName())
180      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
181    if (src.hasResidueSite())
182      tgt.setResidueSiteElement(String40_50.convertString(src.getResidueSiteElement()));
183    return tgt;
184  }
185}