001package org.hl7.fhir.convertors.conv30_40.resources30_40; 002 003import org.hl7.fhir.convertors.context.ConversionContext30_40; 004import org.hl7.fhir.convertors.conv30_40.datatypes30_40.ContactDetail30_40; 005import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.CodeableConcept30_40; 006import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.Period30_40; 007import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.Timing30_40; 008import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.Boolean30_40; 009import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.DateTime30_40; 010import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.MarkDown30_40; 011import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.String30_40; 012import org.hl7.fhir.exceptions.FHIRException; 013 014public class NamingSystem30_40 { 015 016 public static org.hl7.fhir.dstu3.model.NamingSystem convertNamingSystem(org.hl7.fhir.r4.model.NamingSystem src) throws FHIRException { 017 if (src == null) 018 return null; 019 org.hl7.fhir.dstu3.model.NamingSystem tgt = new org.hl7.fhir.dstu3.model.NamingSystem(); 020 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyDomainResource(src, tgt); 021 if (src.hasName()) 022 tgt.setNameElement(String30_40.convertString(src.getNameElement())); 023 if (src.hasStatus()) 024 tgt.setStatusElement(Enumerations30_40.convertPublicationStatus(src.getStatusElement())); 025 if (src.hasKind()) 026 tgt.setKindElement(convertNamingSystemType(src.getKindElement())); 027 if (src.hasDateElement()) 028 tgt.setDateElement(DateTime30_40.convertDateTime(src.getDateElement())); 029 if (src.hasPublisher()) 030 tgt.setPublisherElement(String30_40.convertString(src.getPublisherElement())); 031 for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) 032 tgt.addContact(ContactDetail30_40.convertContactDetail(t)); 033 if (src.hasResponsible()) 034 tgt.setResponsibleElement(String30_40.convertString(src.getResponsibleElement())); 035 if (src.hasType()) 036 tgt.setType(CodeableConcept30_40.convertCodeableConcept(src.getType())); 037 if (src.hasDescription()) 038 tgt.setDescriptionElement(MarkDown30_40.convertMarkdown(src.getDescriptionElement())); 039 for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) 040 tgt.addUseContext(Timing30_40.convertUsageContext(t)); 041 for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) 042 tgt.addJurisdiction(CodeableConcept30_40.convertCodeableConcept(t)); 043 if (src.hasUsage()) 044 tgt.setUsageElement(String30_40.convertString(src.getUsageElement())); 045 for (org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) 046 tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); 047 return tgt; 048 } 049 050 public static org.hl7.fhir.r4.model.NamingSystem convertNamingSystem(org.hl7.fhir.dstu3.model.NamingSystem src) throws FHIRException { 051 if (src == null) 052 return null; 053 org.hl7.fhir.r4.model.NamingSystem tgt = new org.hl7.fhir.r4.model.NamingSystem(); 054 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyDomainResource(src, tgt); 055 if (src.hasName()) 056 tgt.setNameElement(String30_40.convertString(src.getNameElement())); 057 if (src.hasStatus()) 058 tgt.setStatusElement(Enumerations30_40.convertPublicationStatus(src.getStatusElement())); 059 if (src.hasKind()) 060 tgt.setKindElement(convertNamingSystemType(src.getKindElement())); 061 if (src.hasDateElement()) 062 tgt.setDateElement(DateTime30_40.convertDateTime(src.getDateElement())); 063 if (src.hasPublisher()) 064 tgt.setPublisherElement(String30_40.convertString(src.getPublisherElement())); 065 for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) 066 tgt.addContact(ContactDetail30_40.convertContactDetail(t)); 067 if (src.hasResponsible()) 068 tgt.setResponsibleElement(String30_40.convertString(src.getResponsibleElement())); 069 if (src.hasType()) 070 tgt.setType(CodeableConcept30_40.convertCodeableConcept(src.getType())); 071 if (src.hasDescription()) 072 tgt.setDescriptionElement(MarkDown30_40.convertMarkdown(src.getDescriptionElement())); 073 for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) 074 tgt.addUseContext(Timing30_40.convertUsageContext(t)); 075 for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) 076 tgt.addJurisdiction(CodeableConcept30_40.convertCodeableConcept(t)); 077 if (src.hasUsage()) 078 tgt.setUsageElement(String30_40.convertString(src.getUsageElement())); 079 for (org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) 080 tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); 081 return tgt; 082 } 083 084 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType> convertNamingSystemIdentifierType(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType> src) throws FHIRException { 085 if (src == null || src.isEmpty()) 086 return null; 087 org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierTypeEnumFactory()); 088 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt); 089 switch (src.getValue()) { 090 case OID: 091 tgt.setValue(org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.OID); 092 break; 093 case UUID: 094 tgt.setValue(org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.UUID); 095 break; 096 case URI: 097 tgt.setValue(org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.URI); 098 break; 099 case OTHER: 100 tgt.setValue(org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.OTHER); 101 break; 102 default: 103 tgt.setValue(org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.NULL); 104 break; 105 } 106 return tgt; 107 } 108 109 static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType> convertNamingSystemIdentifierType(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType> src) throws FHIRException { 110 if (src == null || src.isEmpty()) 111 return null; 112 org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierTypeEnumFactory()); 113 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt); 114 switch (src.getValue()) { 115 case OID: 116 tgt.setValue(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.OID); 117 break; 118 case UUID: 119 tgt.setValue(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.UUID); 120 break; 121 case URI: 122 tgt.setValue(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.URI); 123 break; 124 case OTHER: 125 tgt.setValue(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.OTHER); 126 break; 127 default: 128 tgt.setValue(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.NULL); 129 break; 130 } 131 return tgt; 132 } 133 134 static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType> convertNamingSystemType(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.NamingSystem.NamingSystemType> src) throws FHIRException { 135 if (src == null || src.isEmpty()) 136 return null; 137 org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemTypeEnumFactory()); 138 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt); 139 switch (src.getValue()) { 140 case CODESYSTEM: 141 tgt.setValue(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.CODESYSTEM); 142 break; 143 case IDENTIFIER: 144 tgt.setValue(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.IDENTIFIER); 145 break; 146 case ROOT: 147 tgt.setValue(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.ROOT); 148 break; 149 default: 150 tgt.setValue(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.NULL); 151 break; 152 } 153 return tgt; 154 } 155 156 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.NamingSystem.NamingSystemType> convertNamingSystemType(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType> src) throws FHIRException { 157 if (src == null || src.isEmpty()) 158 return null; 159 org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.NamingSystem.NamingSystemType> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.NamingSystem.NamingSystemTypeEnumFactory()); 160 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt); 161 switch (src.getValue()) { 162 case CODESYSTEM: 163 tgt.setValue(org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.CODESYSTEM); 164 break; 165 case IDENTIFIER: 166 tgt.setValue(org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.IDENTIFIER); 167 break; 168 case ROOT: 169 tgt.setValue(org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.ROOT); 170 break; 171 default: 172 tgt.setValue(org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.NULL); 173 break; 174 } 175 return tgt; 176 } 177 178 public static org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { 179 if (src == null) 180 return null; 181 org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent(); 182 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt); 183 if (src.hasType()) 184 tgt.setTypeElement(convertNamingSystemIdentifierType(src.getTypeElement())); 185 if (src.hasValue()) 186 tgt.setValueElement(String30_40.convertString(src.getValueElement())); 187 if (src.hasPreferred()) 188 tgt.setPreferredElement(Boolean30_40.convertBoolean(src.getPreferredElement())); 189 if (src.hasComment()) 190 tgt.setCommentElement(String30_40.convertString(src.getCommentElement())); 191 if (src.hasPeriod()) 192 tgt.setPeriod(Period30_40.convertPeriod(src.getPeriod())); 193 return tgt; 194 } 195 196 public static org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { 197 if (src == null) 198 return null; 199 org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent(); 200 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt); 201 if (src.hasType()) 202 tgt.setTypeElement(convertNamingSystemIdentifierType(src.getTypeElement())); 203 if (src.hasValue()) 204 tgt.setValueElement(String30_40.convertString(src.getValueElement())); 205 if (src.hasPreferred()) 206 tgt.setPreferredElement(Boolean30_40.convertBoolean(src.getPreferredElement())); 207 if (src.hasComment()) 208 tgt.setCommentElement(String30_40.convertString(src.getCommentElement())); 209 if (src.hasPeriod()) 210 tgt.setPeriod(Period30_40.convertPeriod(src.getPeriod())); 211 return tgt; 212 } 213}