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.ElementDefinition30_40; 006import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.CodeableConcept30_40; 007import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.Identifier30_40; 008import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.Timing30_40; 009import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.Boolean30_40; 010import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.DateTime30_40; 011import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.Id30_40; 012import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.MarkDown30_40; 013import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.String30_40; 014import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.Uri30_40; 015import org.hl7.fhir.exceptions.FHIRException; 016 017public class DataElement30_40 { 018 019 public static org.hl7.fhir.r4.model.StructureDefinition convertDataElement(org.hl7.fhir.dstu3.model.DataElement src) throws FHIRException { 020 if (src == null) 021 return null; 022 org.hl7.fhir.r4.model.StructureDefinition tgt = new org.hl7.fhir.r4.model.StructureDefinition(); 023 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyDomainResource(src, tgt); 024 if (src.hasUrl()) 025 tgt.setUrl(src.getUrl().replace("/DataElement/", "/StructureDefinition/de-")); 026 for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) 027 tgt.addIdentifier(Identifier30_40.convertIdentifier(t)); 028 if (src.hasVersion()) 029 tgt.setVersionElement(String30_40.convertString(src.getVersionElement())); 030 if (src.hasStatus()) 031 tgt.setStatusElement(Enumerations30_40.convertPublicationStatus(src.getStatusElement())); 032 if (src.hasExperimental()) 033 tgt.setExperimentalElement(Boolean30_40.convertBoolean(src.getExperimentalElement())); 034 if (src.hasDateElement()) 035 tgt.setDateElement(DateTime30_40.convertDateTime(src.getDateElement())); 036 if (src.hasPublisher()) 037 tgt.setPublisherElement(String30_40.convertString(src.getPublisherElement())); 038 if (src.hasName()) 039 tgt.setNameElement(String30_40.convertString(src.getNameElement())); 040 if (src.hasTitle()) 041 tgt.setTitleElement(String30_40.convertString(src.getTitleElement())); 042 for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) 043 tgt.addContact(ContactDetail30_40.convertContactDetail(t)); 044 for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) 045 tgt.addUseContext(Timing30_40.convertUsageContext(t)); 046 for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) 047 tgt.addJurisdiction(CodeableConcept30_40.convertCodeableConcept(t)); 048 if (src.hasCopyright()) 049 tgt.setCopyrightElement(MarkDown30_40.convertMarkdown(src.getCopyrightElement())); 050 for (org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent t : src.getMapping()) 051 tgt.addMapping(convertDataElementMappingComponent(t)); 052 for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) 053 tgt.getSnapshot().addElement(ElementDefinition30_40.convertElementDefinition(t)); 054 tgt.setKind(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE); 055 tgt.setAbstract(false); 056 tgt.setType(tgt.getName()); 057 tgt.setBaseDefinition("http://hl7.org/fhir/StructureDefinition/Element"); 058 tgt.setDerivation(org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION); 059 return tgt; 060 } 061 062 public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent convertDataElementMappingComponent(org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent src) throws FHIRException { 063 if (src == null) 064 return null; 065 org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent(); 066 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt); 067 if (src.hasIdentity()) 068 tgt.setIdentityElement(Id30_40.convertId(src.getIdentityElement())); 069 if (src.hasUri()) 070 tgt.setUriElement(Uri30_40.convertUri(src.getUriElement())); 071 if (src.hasName()) 072 tgt.setNameElement(String30_40.convertString(src.getNameElement())); 073 if (src.hasComment()) 074 tgt.setCommentElement(String30_40.convertString(src.getCommentElement())); 075 return tgt; 076 } 077}