001package org.hl7.fhir.convertors.conv30_50.resources30_50; 002 003import org.hl7.fhir.convertors.context.ConversionContext30_50; 004import org.hl7.fhir.convertors.conv30_50.datatypes30_50.ContactDetail30_50; 005import org.hl7.fhir.convertors.conv30_50.datatypes30_50.UsageContext30_50; 006import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.CodeableConcept30_50; 007import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Boolean30_50; 008import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.DateTime30_50; 009import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.MarkDown30_50; 010import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.String30_50; 011import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Uri30_50; 012import org.hl7.fhir.exceptions.FHIRException; 013 014public class GraphDefinition30_50 { 015 016 static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode> convertCompartmentCode(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.CompartmentType> src) throws FHIRException { 017 if (src == null || src.isEmpty()) 018 return null; 019 org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCodeEnumFactory()); 020 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 021 switch (src.getValue()) { 022 case PATIENT: 023 tgt.setValue(org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode.PATIENT); 024 break; 025 case ENCOUNTER: 026 tgt.setValue(org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode.ENCOUNTER); 027 break; 028 case RELATEDPERSON: 029 tgt.setValue(org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode.RELATEDPERSON); 030 break; 031 case PRACTITIONER: 032 tgt.setValue(org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode.PRACTITIONER); 033 break; 034 case DEVICE: 035 tgt.setValue(org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode.DEVICE); 036 break; 037 default: 038 tgt.setValue(org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode.NULL); 039 break; 040 } 041 return tgt; 042 } 043 044 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.CompartmentType> convertCompartmentCode(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode> src) throws FHIRException { 045 if (src == null || src.isEmpty()) 046 return null; 047 org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.CompartmentType> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.CompartmentTypeEnumFactory()); 048 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 049 switch (src.getValue()) { 050 case PATIENT: 051 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.CompartmentType.PATIENT); 052 break; 053 case ENCOUNTER: 054 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.CompartmentType.ENCOUNTER); 055 break; 056 case RELATEDPERSON: 057 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.CompartmentType.RELATEDPERSON); 058 break; 059 case PRACTITIONER: 060 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.CompartmentType.PRACTITIONER); 061 break; 062 case DEVICE: 063 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.CompartmentType.DEVICE); 064 break; 065 default: 066 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.CompartmentType.NULL); 067 break; 068 } 069 return tgt; 070 } 071 072 static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule> convertGraphCompartmentRule(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRule> src) throws FHIRException { 073 if (src == null || src.isEmpty()) 074 return null; 075 org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRuleEnumFactory()); 076 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 077 switch (src.getValue()) { 078 case IDENTICAL: 079 tgt.setValue(org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule.IDENTICAL); 080 break; 081 case MATCHING: 082 tgt.setValue(org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule.MATCHING); 083 break; 084 case DIFFERENT: 085 tgt.setValue(org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule.DIFFERENT); 086 break; 087 case CUSTOM: 088 tgt.setValue(org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule.CUSTOM); 089 break; 090 default: 091 tgt.setValue(org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule.NULL); 092 break; 093 } 094 return tgt; 095 } 096 097 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRule> convertGraphCompartmentRule(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule> src) throws FHIRException { 098 if (src == null || src.isEmpty()) 099 return null; 100 org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRule> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRuleEnumFactory()); 101 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 102 switch (src.getValue()) { 103 case IDENTICAL: 104 tgt.setValue(org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRule.IDENTICAL); 105 break; 106 case MATCHING: 107 tgt.setValue(org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRule.MATCHING); 108 break; 109 case DIFFERENT: 110 tgt.setValue(org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRule.DIFFERENT); 111 break; 112 case CUSTOM: 113 tgt.setValue(org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRule.CUSTOM); 114 break; 115 default: 116 tgt.setValue(org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRule.NULL); 117 break; 118 } 119 return tgt; 120 } 121 122 public static org.hl7.fhir.r5.model.GraphDefinition convertGraphDefinition(org.hl7.fhir.dstu3.model.GraphDefinition src) throws FHIRException { 123 if (src == null) 124 return null; 125 org.hl7.fhir.r5.model.GraphDefinition tgt = new org.hl7.fhir.r5.model.GraphDefinition(); 126 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt); 127 if (src.hasUrl()) 128 tgt.setUrlElement(Uri30_50.convertUri(src.getUrlElement())); 129 if (src.hasVersion()) 130 tgt.setVersionElement(String30_50.convertString(src.getVersionElement())); 131 if (src.hasName()) 132 tgt.setNameElement(String30_50.convertString(src.getNameElement())); 133 if (src.hasStatus()) 134 tgt.setStatusElement(Enumerations30_50.convertPublicationStatus(src.getStatusElement())); 135 if (src.hasExperimental()) 136 tgt.setExperimentalElement(Boolean30_50.convertBoolean(src.getExperimentalElement())); 137 if (src.hasDate()) 138 tgt.setDateElement(DateTime30_50.convertDateTime(src.getDateElement())); 139 if (src.hasPublisher()) 140 tgt.setPublisherElement(String30_50.convertString(src.getPublisherElement())); 141 for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) 142 tgt.addContact(ContactDetail30_50.convertContactDetail(t)); 143 if (src.hasDescription()) 144 tgt.setDescriptionElement(MarkDown30_50.convertMarkdown(src.getDescriptionElement())); 145 for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) 146 tgt.addUseContext(UsageContext30_50.convertUsageContext(t)); 147 for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) 148 tgt.addJurisdiction(CodeableConcept30_50.convertCodeableConcept(t)); 149 if (src.hasPurpose()) 150 tgt.setPurposeElement(MarkDown30_50.convertMarkdown(src.getPurposeElement())); 151// if (src.hasStart()) 152// tgt.setStartElement(Code30_50.convertCode(src.getStartElement())); 153// if (src.hasProfile()) 154// tgt.setProfile(src.getProfile()); 155// for (org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkComponent t : src.getLink()) 156// tgt.addLink(convertGraphDefinitionLinkComponent(t)); 157 return tgt; 158 } 159 160 public static org.hl7.fhir.dstu3.model.GraphDefinition convertGraphDefinition(org.hl7.fhir.r5.model.GraphDefinition src) throws FHIRException { 161 if (src == null) 162 return null; 163 org.hl7.fhir.dstu3.model.GraphDefinition tgt = new org.hl7.fhir.dstu3.model.GraphDefinition(); 164 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt); 165 if (src.hasUrl()) 166 tgt.setUrlElement(Uri30_50.convertUri(src.getUrlElement())); 167 if (src.hasVersion()) 168 tgt.setVersionElement(String30_50.convertString(src.getVersionElement())); 169 if (src.hasName()) 170 tgt.setNameElement(String30_50.convertString(src.getNameElement())); 171 if (src.hasStatus()) 172 tgt.setStatusElement(Enumerations30_50.convertPublicationStatus(src.getStatusElement())); 173 if (src.hasExperimental()) 174 tgt.setExperimentalElement(Boolean30_50.convertBoolean(src.getExperimentalElement())); 175 if (src.hasDate()) 176 tgt.setDateElement(DateTime30_50.convertDateTime(src.getDateElement())); 177 if (src.hasPublisher()) 178 tgt.setPublisherElement(String30_50.convertString(src.getPublisherElement())); 179 for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) 180 tgt.addContact(ContactDetail30_50.convertContactDetail(t)); 181 if (src.hasDescription()) 182 tgt.setDescriptionElement(MarkDown30_50.convertMarkdown(src.getDescriptionElement())); 183 for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) 184 tgt.addUseContext(UsageContext30_50.convertUsageContext(t)); 185 for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) 186 tgt.addJurisdiction(CodeableConcept30_50.convertCodeableConcept(t)); 187 if (src.hasPurpose()) 188 tgt.setPurposeElement(MarkDown30_50.convertMarkdown(src.getPurposeElement())); 189// if (src.hasStart()) 190// tgt.setStartElement(Code30_50.convertCode(src.getStartElement())); 191// if (src.hasProfile()) 192// tgt.setProfile(src.getProfile()); 193// for (org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkComponent t : src.getLink()) 194// tgt.addLink(convertGraphDefinitionLinkComponent(t)); 195 return tgt; 196 } 197 198// public static org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkComponent convertGraphDefinitionLinkComponent(org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkComponent src) throws FHIRException { 199// if (src == null) 200// return null; 201// org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkComponent tgt = new org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkComponent(); 202// ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyBackboneElement(src,tgt); 203// if (src.hasPath()) 204// tgt.setPathElement(String30_50.convertString(src.getPathElement())); 205// if (src.hasSliceName()) 206// tgt.setSliceNameElement(String30_50.convertString(src.getSliceNameElement())); 207// if (src.hasMin()) 208// tgt.setMinElement(Integer30_50.convertInteger(src.getMinElement())); 209// if (src.hasMax()) 210// tgt.setMaxElement(String30_50.convertString(src.getMaxElement())); 211// if (src.hasDescription()) 212// tgt.setDescriptionElement(String30_50.convertString(src.getDescriptionElement())); 213// for (org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetComponent t : src.getTarget()) 214// tgt.addTarget(convertGraphDefinitionLinkTargetComponent(t)); 215// return tgt; 216// } 217// 218// public static org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkComponent convertGraphDefinitionLinkComponent(org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkComponent src) throws FHIRException { 219// if (src == null) 220// return null; 221// org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkComponent tgt = new org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkComponent(); 222// ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyBackboneElement(src,tgt); 223// if (src.hasPath()) 224// tgt.setPathElement(String30_50.convertString(src.getPathElement())); 225// if (src.hasSliceName()) 226// tgt.setSliceNameElement(String30_50.convertString(src.getSliceNameElement())); 227// if (src.hasMin()) 228// tgt.setMinElement(Integer30_50.convertInteger(src.getMinElement())); 229// if (src.hasMax()) 230// tgt.setMaxElement(String30_50.convertString(src.getMaxElement())); 231// if (src.hasDescription()) 232// tgt.setDescriptionElement(String30_50.convertString(src.getDescriptionElement())); 233// for (org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetComponent t : src.getTarget()) 234// tgt.addTarget(convertGraphDefinitionLinkTargetComponent(t)); 235// return tgt; 236// } 237// 238// public static org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent convertGraphDefinitionLinkTargetCompartmentComponent(org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent src) throws FHIRException { 239// if (src == null) 240// return null; 241// org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent tgt = new org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent(); 242// ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyBackboneElement(src,tgt); 243// if (src.hasCode()) 244// tgt.setCodeElement(convertCompartmentCode(src.getCodeElement())); 245// if (src.hasRule()) 246// tgt.setRuleElement(convertGraphCompartmentRule(src.getRuleElement())); 247// if (src.hasExpression()) 248// tgt.setExpressionElement(String30_50.convertString(src.getExpressionElement())); 249// if (src.hasDescription()) 250// tgt.setDescriptionElement(String30_50.convertString(src.getDescriptionElement())); 251// return tgt; 252// } 253// 254// public static org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent convertGraphDefinitionLinkTargetCompartmentComponent(org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent src) throws FHIRException { 255// if (src == null) 256// return null; 257// org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent tgt = new org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent(); 258// ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyBackboneElement(src,tgt); 259// if (src.hasCode()) 260// tgt.setCodeElement(convertCompartmentCode(src.getCodeElement())); 261// if (src.hasRule()) 262// tgt.setRuleElement(convertGraphCompartmentRule(src.getRuleElement())); 263// if (src.hasExpression()) 264// tgt.setExpressionElement(String30_50.convertString(src.getExpressionElement())); 265// if (src.hasDescription()) 266// tgt.setDescriptionElement(String30_50.convertString(src.getDescriptionElement())); 267// return tgt; 268// } 269// 270// public static org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetComponent convertGraphDefinitionLinkTargetComponent(org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetComponent src) throws FHIRException { 271// if (src == null) 272// return null; 273// org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetComponent tgt = new org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetComponent(); 274// ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyBackboneElement(src,tgt); 275// if (src.hasType()) 276// tgt.setTypeElement(Code30_50.convertResourceEnum(src.getTypeElement())); 277// if (src.hasProfile()) 278// tgt.setProfile(src.getProfile()); 279// for (org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent t : src.getCompartment()) 280// tgt.addCompartment(convertGraphDefinitionLinkTargetCompartmentComponent(t)); 281// for (org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkComponent t : src.getLink()) 282// tgt.addLink(convertGraphDefinitionLinkComponent(t)); 283// return tgt; 284// } 285// 286// public static org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetComponent convertGraphDefinitionLinkTargetComponent(org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetComponent src) throws FHIRException { 287// if (src == null) 288// return null; 289// org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetComponent tgt = new org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetComponent(); 290// ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyBackboneElement(src,tgt); 291// if (src.hasType()) 292// tgt.setTypeElement(Code30_50.convertResourceEnum(src.getTypeElement())); 293// if (src.hasProfile()) 294// tgt.setProfile(src.getProfile()); 295// for (org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent t : src.getCompartment()) 296// tgt.addCompartment(convertGraphDefinitionLinkTargetCompartmentComponent(t)); 297// for (org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkComponent t : src.getLink()) 298// tgt.addLink(convertGraphDefinitionLinkComponent(t)); 299// return tgt; 300// } 301}