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 SubstanceProtein40_50 {
041
042  public static org.hl7.fhir.r5.model.SubstanceProtein convertSubstanceProtein(org.hl7.fhir.r4.model.SubstanceProtein src) throws FHIRException {
043    if (src == null)
044      return null;
045    org.hl7.fhir.r5.model.SubstanceProtein tgt = new org.hl7.fhir.r5.model.SubstanceProtein();
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    for (org.hl7.fhir.r4.model.StringType t : src.getDisulfideLinkage())
052      tgt.getDisulfideLinkage().add(String40_50.convertString(t));
053    for (org.hl7.fhir.r4.model.SubstanceProtein.SubstanceProteinSubunitComponent t : src.getSubunit())
054      tgt.addSubunit(convertSubstanceProteinSubunitComponent(t));
055    return tgt;
056  }
057
058  public static org.hl7.fhir.r4.model.SubstanceProtein convertSubstanceProtein(org.hl7.fhir.r5.model.SubstanceProtein src) throws FHIRException {
059    if (src == null)
060      return null;
061    org.hl7.fhir.r4.model.SubstanceProtein tgt = new org.hl7.fhir.r4.model.SubstanceProtein();
062    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt);
063    if (src.hasSequenceType())
064      tgt.setSequenceType(CodeableConcept40_50.convertCodeableConcept(src.getSequenceType()));
065    if (src.hasNumberOfSubunits())
066      tgt.setNumberOfSubunitsElement(Integer40_50.convertInteger(src.getNumberOfSubunitsElement()));
067    for (org.hl7.fhir.r5.model.StringType t : src.getDisulfideLinkage())
068      tgt.getDisulfideLinkage().add(String40_50.convertString(t));
069    for (org.hl7.fhir.r5.model.SubstanceProtein.SubstanceProteinSubunitComponent t : src.getSubunit())
070      tgt.addSubunit(convertSubstanceProteinSubunitComponent(t));
071    return tgt;
072  }
073
074  public static org.hl7.fhir.r5.model.SubstanceProtein.SubstanceProteinSubunitComponent convertSubstanceProteinSubunitComponent(org.hl7.fhir.r4.model.SubstanceProtein.SubstanceProteinSubunitComponent src) throws FHIRException {
075    if (src == null)
076      return null;
077    org.hl7.fhir.r5.model.SubstanceProtein.SubstanceProteinSubunitComponent tgt = new org.hl7.fhir.r5.model.SubstanceProtein.SubstanceProteinSubunitComponent();
078    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
079    if (src.hasSubunit())
080      tgt.setSubunitElement(Integer40_50.convertInteger(src.getSubunitElement()));
081    if (src.hasSequence())
082      tgt.setSequenceElement(String40_50.convertString(src.getSequenceElement()));
083    if (src.hasLength())
084      tgt.setLengthElement(Integer40_50.convertInteger(src.getLengthElement()));
085    if (src.hasSequenceAttachment())
086      tgt.setSequenceAttachment(Attachment40_50.convertAttachment(src.getSequenceAttachment()));
087    if (src.hasNTerminalModificationId())
088      tgt.setNTerminalModificationId(Identifier40_50.convertIdentifier(src.getNTerminalModificationId()));
089    if (src.hasNTerminalModification())
090      tgt.setNTerminalModificationElement(String40_50.convertString(src.getNTerminalModificationElement()));
091    if (src.hasCTerminalModificationId())
092      tgt.setCTerminalModificationId(Identifier40_50.convertIdentifier(src.getCTerminalModificationId()));
093    if (src.hasCTerminalModification())
094      tgt.setCTerminalModificationElement(String40_50.convertString(src.getCTerminalModificationElement()));
095    return tgt;
096  }
097
098  public static org.hl7.fhir.r4.model.SubstanceProtein.SubstanceProteinSubunitComponent convertSubstanceProteinSubunitComponent(org.hl7.fhir.r5.model.SubstanceProtein.SubstanceProteinSubunitComponent src) throws FHIRException {
099    if (src == null)
100      return null;
101    org.hl7.fhir.r4.model.SubstanceProtein.SubstanceProteinSubunitComponent tgt = new org.hl7.fhir.r4.model.SubstanceProtein.SubstanceProteinSubunitComponent();
102    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
103    if (src.hasSubunit())
104      tgt.setSubunitElement(Integer40_50.convertInteger(src.getSubunitElement()));
105    if (src.hasSequence())
106      tgt.setSequenceElement(String40_50.convertString(src.getSequenceElement()));
107    if (src.hasLength())
108      tgt.setLengthElement(Integer40_50.convertInteger(src.getLengthElement()));
109    if (src.hasSequenceAttachment())
110      tgt.setSequenceAttachment(Attachment40_50.convertAttachment(src.getSequenceAttachment()));
111    if (src.hasNTerminalModificationId())
112      tgt.setNTerminalModificationId(Identifier40_50.convertIdentifier(src.getNTerminalModificationId()));
113    if (src.hasNTerminalModification())
114      tgt.setNTerminalModificationElement(String40_50.convertString(src.getNTerminalModificationElement()));
115    if (src.hasCTerminalModificationId())
116      tgt.setCTerminalModificationId(Identifier40_50.convertIdentifier(src.getCTerminalModificationId()));
117    if (src.hasCTerminalModification())
118      tgt.setCTerminalModificationElement(String40_50.convertString(src.getCTerminalModificationElement()));
119    return tgt;
120  }
121}