
001package org.hl7.fhir.convertors.conv10_30.resources10_30; 002 003import org.hl7.fhir.convertors.context.ConversionContext10_30; 004import org.hl7.fhir.dstu3.model.Enumerations; 005import org.hl7.fhir.exceptions.FHIRException; 006 007public class Enumerations10_30 { 008 static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus> convertConformanceResourceStatus(org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus> src) throws FHIRException { 009 if (src == null || src.isEmpty()) return null; 010 org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Enumerations.PublicationStatusEnumFactory()); 011 ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyElement(src, tgt); 012 if (src.getValue() == null) { 013 tgt.setValue(null); 014} else { 015 switch(src.getValue()) { 016 case DRAFT: 017 tgt.setValue(Enumerations.PublicationStatus.DRAFT); 018 break; 019 case ACTIVE: 020 tgt.setValue(Enumerations.PublicationStatus.ACTIVE); 021 break; 022 case RETIRED: 023 tgt.setValue(Enumerations.PublicationStatus.RETIRED); 024 break; 025 default: 026 tgt.setValue(Enumerations.PublicationStatus.NULL); 027 break; 028 } 029} 030 return tgt; 031 } 032 033 static public org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus> convertConformanceResourceStatus(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus> src) throws FHIRException { 034 if (src == null || src.isEmpty()) return null; 035 org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus> tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatusEnumFactory()); 036 ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyElement(src, tgt); 037 if (src.getValue() == null) { 038 tgt.setValue(null); 039} else { 040 switch(src.getValue()) { 041 case DRAFT: 042 tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.DRAFT); 043 break; 044 case ACTIVE: 045 tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.ACTIVE); 046 break; 047 case RETIRED: 048 tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.RETIRED); 049 break; 050 default: 051 tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.NULL); 052 break; 053 } 054} 055 return tgt; 056 } 057 058 static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender> convertAdministrativeGender(org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender> src) throws FHIRException { 059 if (src == null || src.isEmpty()) return null; 060 org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGenderEnumFactory()); 061 ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyElement(src, tgt); 062 if (src.getValue() == null) { 063 tgt.setValue(null); 064} else { 065 switch(src.getValue()) { 066 case MALE: 067 tgt.setValue(Enumerations.AdministrativeGender.MALE); 068 break; 069 case FEMALE: 070 tgt.setValue(Enumerations.AdministrativeGender.FEMALE); 071 break; 072 case OTHER: 073 tgt.setValue(Enumerations.AdministrativeGender.OTHER); 074 break; 075 case UNKNOWN: 076 tgt.setValue(Enumerations.AdministrativeGender.UNKNOWN); 077 break; 078 default: 079 tgt.setValue(Enumerations.AdministrativeGender.NULL); 080 break; 081 } 082} 083 return tgt; 084 } 085 086 static public org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender> convertAdministrativeGender(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender> src) throws FHIRException { 087 if (src == null || src.isEmpty()) return null; 088 org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender> tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGenderEnumFactory()); 089 ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyElement(src, tgt); 090 if (src.getValue() == null) { 091 tgt.setValue(null); 092} else { 093 switch(src.getValue()) { 094 case MALE: 095 tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.MALE); 096 break; 097 case FEMALE: 098 tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.FEMALE); 099 break; 100 case OTHER: 101 tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.OTHER); 102 break; 103 case UNKNOWN: 104 tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.UNKNOWN); 105 break; 106 default: 107 tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.NULL); 108 break; 109 } 110} 111 return tgt; 112 } 113}