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