
001package org.hl7.fhir.convertors.conv10_40.resources10_40; 002 003import org.hl7.fhir.convertors.context.ConversionContext10_40; 004import org.hl7.fhir.exceptions.FHIRException; 005import org.hl7.fhir.r4.model.Enumerations; 006 007public class Enumerations10_40 { 008 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Enumerations.AdministrativeGender> convertAdministrativeGender(org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender> src) throws FHIRException { 009 if (src == null || src.isEmpty()) return null; 010 org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Enumerations.AdministrativeGender> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Enumerations.AdministrativeGenderEnumFactory()); 011 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt); 012 if (src.getValue() == null) { 013 tgt.setValue(null); 014} else { 015 switch(src.getValue()) { 016 case MALE: 017 tgt.setValue(Enumerations.AdministrativeGender.MALE); 018 break; 019 case FEMALE: 020 tgt.setValue(Enumerations.AdministrativeGender.FEMALE); 021 break; 022 case OTHER: 023 tgt.setValue(Enumerations.AdministrativeGender.OTHER); 024 break; 025 case UNKNOWN: 026 tgt.setValue(Enumerations.AdministrativeGender.UNKNOWN); 027 break; 028 default: 029 tgt.setValue(Enumerations.AdministrativeGender.NULL); 030 break; 031 } 032} 033 return tgt; 034 } 035 036 static public org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender> convertAdministrativeGender(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Enumerations.AdministrativeGender> src) throws FHIRException { 037 if (src == null || src.isEmpty()) return null; 038 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()); 039 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt); 040 if (src.getValue() == null) { 041 tgt.setValue(null); 042} else { 043 switch(src.getValue()) { 044 case MALE: 045 tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.MALE); 046 break; 047 case FEMALE: 048 tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.FEMALE); 049 break; 050 case OTHER: 051 tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.OTHER); 052 break; 053 case UNKNOWN: 054 tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.UNKNOWN); 055 break; 056 default: 057 tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.NULL); 058 break; 059 } 060} 061 return tgt; 062 } 063 064 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Enumerations.SearchParamType> convertSearchParamType(org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Enumerations.SearchParamType> src) throws FHIRException { 065 if (src == null || src.isEmpty()) return null; 066 org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Enumerations.SearchParamType> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Enumerations.SearchParamTypeEnumFactory()); 067 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt); 068 if (src.getValue() == null) { 069 tgt.setValue(null); 070} else { 071 switch(src.getValue()) { 072 case NUMBER: 073 tgt.setValue(Enumerations.SearchParamType.NUMBER); 074 break; 075 case DATE: 076 tgt.setValue(Enumerations.SearchParamType.DATE); 077 break; 078 case STRING: 079 tgt.setValue(Enumerations.SearchParamType.STRING); 080 break; 081 case TOKEN: 082 tgt.setValue(Enumerations.SearchParamType.TOKEN); 083 break; 084 case REFERENCE: 085 tgt.setValue(Enumerations.SearchParamType.REFERENCE); 086 break; 087 case COMPOSITE: 088 tgt.setValue(Enumerations.SearchParamType.COMPOSITE); 089 break; 090 case QUANTITY: 091 tgt.setValue(Enumerations.SearchParamType.QUANTITY); 092 break; 093 case URI: 094 tgt.setValue(Enumerations.SearchParamType.URI); 095 break; 096 default: 097 tgt.setValue(Enumerations.SearchParamType.NULL); 098 break; 099 } 100} 101 return tgt; 102 } 103 104 static public org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Enumerations.SearchParamType> convertSearchParamType(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Enumerations.SearchParamType> src) throws FHIRException { 105 if (src == null || src.isEmpty()) return null; 106 org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Enumerations.SearchParamType> tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Enumerations.SearchParamTypeEnumFactory()); 107 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt); 108 if (src.getValue() == null) { 109 tgt.setValue(null); 110} else { 111 switch(src.getValue()) { 112 case NUMBER: 113 tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.NUMBER); 114 break; 115 case DATE: 116 tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.DATE); 117 break; 118 case STRING: 119 tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.STRING); 120 break; 121 case TOKEN: 122 tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.TOKEN); 123 break; 124 case REFERENCE: 125 tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.REFERENCE); 126 break; 127 case COMPOSITE: 128 tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.COMPOSITE); 129 break; 130 case QUANTITY: 131 tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.QUANTITY); 132 break; 133 case URI: 134 tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.URI); 135 break; 136 default: 137 tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.NULL); 138 break; 139 } 140} 141 return tgt; 142 } 143 144 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Enumerations.PublicationStatus> convertConformanceResourceStatus(org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus> src) throws FHIRException { 145 if (src == null || src.isEmpty()) return null; 146 org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Enumerations.PublicationStatus> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Enumerations.PublicationStatusEnumFactory()); 147 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt); 148 if (src.getValue() == null) { 149 tgt.setValue(null); 150} else { 151 switch(src.getValue()) { 152 case DRAFT: 153 tgt.setValue(Enumerations.PublicationStatus.DRAFT); 154 break; 155 case ACTIVE: 156 tgt.setValue(Enumerations.PublicationStatus.ACTIVE); 157 break; 158 case RETIRED: 159 tgt.setValue(Enumerations.PublicationStatus.RETIRED); 160 break; 161 default: 162 tgt.setValue(Enumerations.PublicationStatus.NULL); 163 break; 164 } 165} 166 return tgt; 167 } 168 169 static public org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus> convertConformanceResourceStatus(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Enumerations.PublicationStatus> src) throws FHIRException { 170 if (src == null || src.isEmpty()) return null; 171 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()); 172 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt); 173 if (src.getValue() == null) { 174 tgt.setValue(null); 175} else { 176 switch(src.getValue()) { 177 case DRAFT: 178 tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.DRAFT); 179 break; 180 case ACTIVE: 181 tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.ACTIVE); 182 break; 183 case RETIRED: 184 tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.RETIRED); 185 break; 186 default: 187 tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.NULL); 188 break; 189 } 190} 191 return tgt; 192 } 193}