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.primitive43_50.Base64Binary43_50;
005import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Code43_50;
006import org.hl7.fhir.convertors.conv43_50.datatypes43_50.special43_50.Reference43_50;
007import org.hl7.fhir.exceptions.FHIRException;
008
009/*
010  Copyright (c) 2011+, HL7, Inc.
011  All rights reserved.
012  
013  Redistribution and use in source and binary forms, with or without modification, 
014  are permitted provided that the following conditions are met:
015  
016   * Redistributions of source code must retain the above copyright notice, this 
017     list of conditions and the following disclaimer.
018   * Redistributions in binary form must reproduce the above copyright notice, 
019     this list of conditions and the following disclaimer in the documentation 
020     and/or other materials provided with the distribution.
021   * Neither the name of HL7 nor the names of its contributors may be used to 
022     endorse or promote products derived from this software without specific 
023     prior written permission.
024  
025  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
026  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
027  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
028  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
029  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
030  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
031  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
032  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
033  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
034  POSSIBILITY OF SUCH DAMAGE.
035  
036*/
037// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
038public class Binary43_50 {
039
040  public static org.hl7.fhir.r5.model.Binary convertBinary(org.hl7.fhir.r4b.model.Binary src) throws FHIRException {
041    if (src == null)
042      return null;
043    org.hl7.fhir.r5.model.Binary tgt = new org.hl7.fhir.r5.model.Binary();
044    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyResource(src, tgt);
045    if (src.hasContentType())
046      tgt.setContentTypeElement(Code43_50.convertCode(src.getContentTypeElement()));
047    if (src.hasSecurityContext())
048      tgt.setSecurityContext(Reference43_50.convertReference(src.getSecurityContext()));
049    if (src.hasData())
050      tgt.setDataElement(Base64Binary43_50.convertBase64Binary(src.getDataElement()));
051    return tgt;
052  }
053
054  public static org.hl7.fhir.r4b.model.Binary convertBinary(org.hl7.fhir.r5.model.Binary src) throws FHIRException {
055    if (src == null)
056      return null;
057    org.hl7.fhir.r4b.model.Binary tgt = new org.hl7.fhir.r4b.model.Binary();
058    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyResource(src, tgt);
059    if (src.hasContentType())
060      tgt.setContentTypeElement(Code43_50.convertCode(src.getContentTypeElement()));
061    if (src.hasSecurityContext())
062      tgt.setSecurityContext(Reference43_50.convertReference(src.getSecurityContext()));
063    if (src.hasData())
064      tgt.setDataElement(Base64Binary43_50.convertBase64Binary(src.getDataElement()));
065    return tgt;
066  }
067}