001package org.hl7.fhir.convertors.conv40_50;
002
003
004import org.hl7.fhir.convertors.VersionConvertor_40_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 BodyStructure40_50 extends VersionConvertor_40_50 {
037
038    public static org.hl7.fhir.r5.model.BodyStructure convertBodyStructure(org.hl7.fhir.r4.model.BodyStructure src) throws FHIRException {
039        if (src == null)
040            return null;
041        org.hl7.fhir.r5.model.BodyStructure tgt = new org.hl7.fhir.r5.model.BodyStructure();
042        copyDomainResource(src, tgt);
043        for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(convertIdentifier(t));
044        if (src.hasActive())
045            tgt.setActiveElement(convertBoolean(src.getActiveElement()));
046        if (src.hasMorphology())
047            tgt.setMorphology(convertCodeableConcept(src.getMorphology()));
048        if (src.hasLocation())
049            tgt.setLocation(convertCodeableConcept(src.getLocation()));
050        for (org.hl7.fhir.r4.model.CodeableConcept t : src.getLocationQualifier()) tgt.addLocationQualifier(convertCodeableConcept(t));
051        if (src.hasDescription())
052            tgt.setDescriptionElement(convertString(src.getDescriptionElement()));
053        for (org.hl7.fhir.r4.model.Attachment t : src.getImage()) tgt.addImage(convertAttachment(t));
054        if (src.hasPatient())
055            tgt.setPatient(convertReference(src.getPatient()));
056        return tgt;
057    }
058
059    public static org.hl7.fhir.r4.model.BodyStructure convertBodyStructure(org.hl7.fhir.r5.model.BodyStructure src) throws FHIRException {
060        if (src == null)
061            return null;
062        org.hl7.fhir.r4.model.BodyStructure tgt = new org.hl7.fhir.r4.model.BodyStructure();
063        copyDomainResource(src, tgt);
064        for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(convertIdentifier(t));
065        if (src.hasActive())
066            tgt.setActiveElement(convertBoolean(src.getActiveElement()));
067        if (src.hasMorphology())
068            tgt.setMorphology(convertCodeableConcept(src.getMorphology()));
069        if (src.hasLocation())
070            tgt.setLocation(convertCodeableConcept(src.getLocation()));
071        for (org.hl7.fhir.r5.model.CodeableConcept t : src.getLocationQualifier()) tgt.addLocationQualifier(convertCodeableConcept(t));
072        if (src.hasDescription())
073            tgt.setDescriptionElement(convertString(src.getDescriptionElement()));
074        for (org.hl7.fhir.r5.model.Attachment t : src.getImage()) tgt.addImage(convertAttachment(t));
075        if (src.hasPatient())
076            tgt.setPatient(convertReference(src.getPatient()));
077        return tgt;
078    }
079}