
001package org.hl7.fhir.convertors.conv30_40.datatypes30_40; 002 003import org.hl7.fhir.convertors.context.ConversionContext30_40; 004import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.Code30_40; 005import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.Integer30_40; 006import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.String30_40; 007import org.hl7.fhir.exceptions.FHIRException; 008 009public class ParameterDefinition30_40 { 010 public static org.hl7.fhir.r4.model.ParameterDefinition convertParameterDefinition(org.hl7.fhir.dstu3.model.ParameterDefinition src) throws FHIRException { 011 if (src == null) return null; 012 org.hl7.fhir.r4.model.ParameterDefinition tgt = new org.hl7.fhir.r4.model.ParameterDefinition(); 013 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt); 014 if (src.hasName()) tgt.setNameElement(Code30_40.convertCode(src.getNameElement())); 015 if (src.hasUse()) tgt.setUseElement(convertParameterUse(src.getUseElement())); 016 if (src.hasMin()) tgt.setMinElement(Integer30_40.convertInteger(src.getMinElement())); 017 if (src.hasMax()) tgt.setMaxElement(String30_40.convertString(src.getMaxElement())); 018 if (src.hasDocumentation()) tgt.setDocumentationElement(String30_40.convertString(src.getDocumentationElement())); 019 if (src.hasType()) tgt.setTypeElement(Code30_40.convertCode(src.getTypeElement())); 020 if (src.hasProfile()) { 021 tgt.setProfile(Reference30_40.convertReference(src.getProfile()).getReference()); 022 } 023 return tgt; 024 } 025 026 public static org.hl7.fhir.dstu3.model.ParameterDefinition convertParameterDefinition(org.hl7.fhir.r4.model.ParameterDefinition src) throws FHIRException { 027 if (src == null) return null; 028 org.hl7.fhir.dstu3.model.ParameterDefinition tgt = new org.hl7.fhir.dstu3.model.ParameterDefinition(); 029 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt); 030 if (src.hasName()) tgt.setNameElement(Code30_40.convertCode(src.getNameElement())); 031 if (src.hasUse()) tgt.setUseElement(convertParameterUse(src.getUseElement())); 032 if (src.hasMin()) tgt.setMinElement(Integer30_40.convertInteger(src.getMinElement())); 033 if (src.hasMax()) tgt.setMaxElement(String30_40.convertString(src.getMaxElement())); 034 if (src.hasDocumentation()) tgt.setDocumentationElement(String30_40.convertString(src.getDocumentationElement())); 035 if (src.hasType()) tgt.setTypeElement(Code30_40.convertCode(src.getTypeElement())); 036 if (src.hasProfile()) tgt.setProfile(new org.hl7.fhir.dstu3.model.Reference(src.getProfile())); 037 return tgt; 038 } 039 040 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ParameterDefinition.ParameterUse> convertParameterUse(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.ParameterDefinition.ParameterUse> src) throws FHIRException { 041 if (src == null || src.isEmpty()) return null; 042 org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ParameterDefinition.ParameterUse> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.ParameterDefinition.ParameterUseEnumFactory()); 043 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt); 044 if (src.getValue() == null) { 045 tgt.setValue(org.hl7.fhir.r4.model.ParameterDefinition.ParameterUse.NULL); 046 } else { 047 switch (src.getValue()) { 048 case IN: 049 tgt.setValue(org.hl7.fhir.r4.model.ParameterDefinition.ParameterUse.IN); 050 break; 051 case OUT: 052 tgt.setValue(org.hl7.fhir.r4.model.ParameterDefinition.ParameterUse.OUT); 053 break; 054 default: 055 tgt.setValue(org.hl7.fhir.r4.model.ParameterDefinition.ParameterUse.NULL); 056 break; 057 } 058 } 059 return tgt; 060 } 061 062 static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.ParameterDefinition.ParameterUse> convertParameterUse(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ParameterDefinition.ParameterUse> src) throws FHIRException { 063 if (src == null || src.isEmpty()) return null; 064 org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.ParameterDefinition.ParameterUse> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.ParameterDefinition.ParameterUseEnumFactory()); 065 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt); 066 if (src.getValue() == null) { 067 tgt.setValue(org.hl7.fhir.dstu3.model.ParameterDefinition.ParameterUse.NULL); 068 } else { 069 switch (src.getValue()) { 070 case IN: 071 tgt.setValue(org.hl7.fhir.dstu3.model.ParameterDefinition.ParameterUse.IN); 072 break; 073 case OUT: 074 tgt.setValue(org.hl7.fhir.dstu3.model.ParameterDefinition.ParameterUse.OUT); 075 break; 076 default: 077 tgt.setValue(org.hl7.fhir.dstu3.model.ParameterDefinition.ParameterUse.NULL); 078 break; 079 } 080 } 081 return tgt; 082 } 083}